13#ifndef LLVM_CLANG_LIB_SEMA_TREETRANSFORM_H
14#define LLVM_CLANG_LIB_SEMA_TREETRANSFORM_H
49#include "llvm/ADT/ArrayRef.h"
50#include "llvm/Support/ErrorHandling.h"
54using namespace llvm::omp;
121template<
typename Derived>
126 class ForgetPartiallySubstitutedPackRAII {
134 ForgetPartiallySubstitutedPackRAII(Derived &
Self)
135 :
Self(
Self), ResetPackSubstIndex(
Self.getSema(), std::nullopt) {
136 Old =
Self.ForgetPartiallySubstitutedPack();
139 ~ForgetPartiallySubstitutedPackRAII() {
140 Self.RememberPartiallySubstitutedPack(Old);
142 ForgetPartiallySubstitutedPackRAII(
143 const ForgetPartiallySubstitutedPackRAII &) =
delete;
144 ForgetPartiallySubstitutedPackRAII &
145 operator=(
const ForgetPartiallySubstitutedPackRAII &) =
delete;
161 Derived &
getDerived() {
return static_cast<Derived&
>(*this); }
165 return static_cast<const Derived&
>(*this);
233 if (Location.isValid())
234 Self.getDerived().setBase(Location, Entity);
238 Self.getDerived().setBase(OldLocation, OldEntity);
313 bool FailOnPackProducingTemplates,
314 bool &ShouldExpand,
bool &RetainExpansion,
316 ShouldExpand =
false;
344 struct ForgetSubstitutionRAII {
350 Old =
Self.ForgetSubstitution();
353 ~ForgetSubstitutionRAII() {
Self.RememberSubstitution(std::move(Old)); }
453 const X##Attr *Transform##X##Attr(const X##Attr *R) { return R; }
454#include "clang/Basic/AttrList.inc"
464 const X##Attr *TransformStmt##X##Attr(const Stmt *, const Stmt *, \
465 const X##Attr *A) { \
466 return getDerived().Transform##X##Attr(A); \
468#include "clang/Basic/AttrList.inc"
514 bool *ArgChanged =
nullptr);
523 llvm::DenseMap<Decl *, Decl *>::iterator Known
526 return Known->second;
554 assert(
New.size() == 1 &&
555 "must override transformedLocalDecl if performing pack expansion");
593 NamedDecl *FirstQualifierInScope =
nullptr);
638 NamedDecl *FirstQualifierInScope =
nullptr,
639 bool AllowInjectedClassName =
false);
651 bool Uneval =
false);
678 bool Uneval =
false) {
697 template<
typename InputIterator>
701 bool Uneval =
false);
703 template <
typename InputIterator>
707 bool Uneval =
false);
728 return SemaRef.Context.getTrivialTypeSourceInfo(
T,
732#define ABSTRACT_TYPELOC(CLASS, PARENT)
733#define TYPELOC(CLASS, PARENT) \
734 QualType Transform##CLASS##Type(TypeLocBuilder &TLB, CLASS##TypeLoc T);
735#include "clang/AST/TypeLocNodes.def"
739 bool SuppressObjCLifetime);
743 bool SuppressObjCLifetime);
745 template<
typename Fn>
763 bool AllowInjectedClassName);
791 return getDerived().TransformFunctionTypeParams(
792 Loc, Params, ParamTypes, ParamInfos, PTypes, PVars, PInfos,
nullptr);
810 KWLoc, Params,
nullptr,
811 nullptr, PTypes, &TransParams, PInfos))
825 bool ExpectParameterPack);
852 bool IsAddressOfOperand,
860 bool IsAddressOfOperand);
868#define STMT(Node, Parent) \
869 LLVM_ATTRIBUTE_NOINLINE \
870 StmtResult Transform##Node(Node *S);
871#define VALUESTMT(Node, Parent) \
872 LLVM_ATTRIBUTE_NOINLINE \
873 StmtResult Transform##Node(Node *S, StmtDiscardKind SDK);
874#define EXPR(Node, Parent) \
875 LLVM_ATTRIBUTE_NOINLINE \
876 ExprResult Transform##Node(Node *E);
877#define ABSTRACT_STMT(Stmt)
878#include "clang/AST/StmtNodes.inc"
880#define GEN_CLANG_CLAUSE_CLASS
881#define CLAUSE_CLASS(Enum, Str, Class) \
882 LLVM_ATTRIBUTE_NOINLINE \
883 OMPClause *Transform##Class(Class *S);
884#include "llvm/Frontend/OpenMP/OMP.inc"
962 const llvm::APInt *Size,
Expr *SizeExpr,
963 unsigned IndexTypeQuals,
SourceRange BracketsRange);
972 const llvm::APInt &Size,
Expr *SizeExpr,
973 unsigned IndexTypeQuals,
983 unsigned IndexTypeQuals,
993 unsigned IndexTypeQuals,
1004 unsigned IndexTypeQuals,
1042 unsigned NumColumns);
1059 Expr *AddrSpaceExpr,
1083 return SemaRef.Context.getUsingType(
Keyword, Qualifier, D, UnderlyingType);
1096 return SemaRef.Context.getMacroQualifiedType(
T, MacroII);
1106 return SemaRef.Context.getCanonicalTagType(Tag);
1123 UnaryTransformType::UTTKind UKind,
1135 bool FullySubstituted,
1149 TypeConstraintConcept,
1150 TypeConstraintArgs);
1157 return SemaRef.Context.getDeducedTemplateSpecializationType(
1176 return SemaRef.BuildParenType(InnerType);
1189 bool DeducedTSTContext) {
1191 SS.
Adopt(QualifierLoc);
1195 if (!
SemaRef.computeDeclContext(SS))
1203 return SemaRef.CheckTypenameType(
Keyword, KeywordLoc, QualifierLoc,
1204 *Id, IdLoc, DeducedTSTContext);
1217 if (
SemaRef.RequireCompleteDeclContext(SS, DC))
1222 switch (
Result.getResultKind()) {
1233 llvm_unreachable(
"Tag lookup cannot find non-tags");
1245 switch (
Result.getResultKind()) {
1251 SemaRef.Diag(IdLoc, diag::err_tag_reference_non_tag)
1252 << SomeDecl << NTK << Kind;
1257 SemaRef.Diag(IdLoc, diag::err_not_tag_in_scope)
1263 if (!
SemaRef.isAcceptableTagRedeclaration(Tag, Kind,
false,
1265 SemaRef.Diag(KeywordLoc, diag::err_use_with_wrong_tag) << Id;
1266 SemaRef.Diag(Tag->getLocation(), diag::note_previous_use);
1322 bool AllowInjectedClassName);
1335 bool AllowInjectedClassName);
1341 bool AllowInjectedClassName);
1351 Decl *AssociatedDecl,
unsigned Index,
1354 ArgPack, AssociatedDecl, Index, Final);
1408 return SemaRef.ActOnLabelStmt(IdentLoc, L, ColonLoc, SubStmt);
1418 if (
SemaRef.CheckRebuiltStmtAttributes(Attrs))
1420 return SemaRef.BuildAttributedStmt(AttrLoc, Attrs, SubStmt);
1432 Then, ElseLoc, Else);
1486 Inc, RParenLoc, Body);
1531 bool IsVolatile,
unsigned NumOutputs,
1538 NumInputs, Names, Constraints, Exprs,
1539 AsmString, Clobbers, NumLabels, RParenLoc);
1548 StringRef AsmString,
1549 unsigned NumOutputs,
unsigned NumInputs,
1555 NumOutputs, NumInputs,
1556 Constraints, Clobbers, Exprs, EndLoc);
1585 CoawaitLoc, Operand, OpCoawaitLookup);
1589 Suspend.
get(),
true);
1690 Kind, DirName, CancelRegion, Clauses, AStmt, StartLoc, EndLoc);
1702 Kind, DirName, Clauses, AStmt, StartLoc, EndLoc);
1716 NameModifier,
Condition, StartLoc, LParenLoc, NameModifierLoc, ColonLoc,
1742 Modifier, NumThreads, StartLoc, LParenLoc, ModifierLoc, EndLoc);
1803 First, Count, StartLoc, LParenLoc, FirstLoc, CountLoc, EndLoc);
1839 Kind, KindKwLoc, VCKind, VCLoc, StartLoc, LParenLoc, EndLoc);
1852 Kind, KindKwLoc, StartLoc, LParenLoc, EndLoc);
1865 M1, M2, Kind, ChunkSize, StartLoc, LParenLoc, M1Loc, M2Loc, KindLoc,
1927 VarList, LPKind, LPKindLoc, ColonLoc, StartLoc, LParenLoc, EndLoc);
1955 VarList, {Modifier, OriginalSharingModifier}, StartLoc, LParenLoc,
1956 ModifierLoc, ColonLoc, EndLoc, ReductionIdScopeSpec, ReductionId,
1957 UnresolvedReductions);
1971 VarList, StartLoc, LParenLoc, ColonLoc, EndLoc, ReductionIdScopeSpec,
1972 ReductionId, UnresolvedReductions);
1987 VarList, StartLoc, LParenLoc, ColonLoc, EndLoc, ReductionIdScopeSpec,
1988 ReductionId, UnresolvedReductions);
2001 VarList, Step, StartLoc, LParenLoc, Modifier, ModifierLoc, ColonLoc,
2002 StepModifierLoc, EndLoc);
2015 VarList, Alignment, StartLoc, LParenLoc, ColonLoc, EndLoc);
2075 Data, DepModifier, VarList, StartLoc, LParenLoc, EndLoc);
2088 Modifier,
Device, StartLoc, LParenLoc, ModifierLoc, EndLoc);
2103 IteratorModifier, MapTypeModifiers, MapTypeModifiersLoc,
2104 MapperIdScopeSpec, MapperId, MapType, IsMapTypeImplicit, MapLoc,
2105 ColonLoc, VarList, Locs,
2106 false, UnresolvedMappers);
2123 Allocate, Alignment, FirstModifier, FirstModifierLoc, SecondModifier,
2124 SecondModifierLoc, VarList, StartLoc, LParenLoc, ColonLoc, EndLoc);
2172 Modifier,
Device, StartLoc, LParenLoc, ModifierLoc, EndLoc);
2185 Modifier, NumTasks, StartLoc, LParenLoc, ModifierLoc, EndLoc);
2220 Kind, ChunkSize, StartLoc, LParenLoc, KindLoc, CommaLoc, EndLoc);
2235 MotionModifiers, MotionModifiersLoc, IteratorModifier,
2236 MapperIdScopeSpec, MapperId, ColonLoc, VarList, Locs,
2252 MotionModifiers, MotionModifiersLoc, IteratorModifier,
2253 MapperIdScopeSpec, MapperId, ColonLoc, VarList, Locs,
2305 M, Kind, StartLoc, LParenLoc, MLoc, KindLoc, EndLoc);
2352 StartLoc, LParenLoc, EndLoc,
Data);
2365 StartLoc, LParenLoc, ColonLoc, EndLoc, Modifier, Locators);
2377 Modifier, Kind, StartLoc, LParenLoc, ModifierKwLoc, KindKwLoc, EndLoc);
2390 InteropVar, InteropInfo, StartLoc, LParenLoc, VarLoc, EndLoc);
2401 LParenLoc, VarLoc, EndLoc);
2413 InteropVar, StartLoc, LParenLoc, VarLoc, EndLoc);
2484 M1, M2, Size, StartLoc, LParenLoc, M1Loc, M2Loc, EndLoc);
2565 DepType, DepLoc, ColonLoc, VarList, StartLoc, LParenLoc, EndLoc);
2613 ForLoc, Element, Collection, RParenLoc);
2631 StartLoc, IdLoc, Id);
2668 if (
DeclStmt *RangeStmt = dyn_cast<DeclStmt>(Range)) {
2669 if (RangeStmt->isSingleDecl()) {
2670 if (
VarDecl *RangeVar = dyn_cast<VarDecl>(RangeStmt->getSingleDecl())) {
2671 if (RangeVar->isInvalidDecl())
2674 Expr *RangeExpr = RangeVar->getInit();
2681 diag::err_objc_for_range_init_stmt)
2682 <<
Init->getSourceRange();
2685 ForLoc, LoopVar, RangeExpr, RParenLoc);
2692 ForLoc, CoawaitLoc,
Init, ColonLoc, Range, Begin, End,
Cond, Inc,
2706 QualifierLoc, NameInfo, Nested);
2768 SS.
Adopt(QualifierLoc);
2890 if (IsOMPArraySection)
2892 Base, LBracketLoc, LowerBound, ColonLocFirst, ColonLocSecond, Length,
2893 Stride, RBracketLoc);
2895 assert(Stride ==
nullptr && !ColonLocSecond.
isValid() &&
2896 "Stride/second colon not allowed for OpenACC");
2899 Base, LBracketLoc, LowerBound, ColonLocFirst, Length, RBracketLoc);
2911 Base, LParenLoc, RParenLoc, Dims, BracketsRanges);
2923 nullptr, IteratorKwLoc, LLoc, RLoc,
Data);
2933 Expr *ExecConfig =
nullptr) {
2935 nullptr, Callee, LParenLoc, Args, RParenLoc, ExecConfig);
2942 nullptr, Callee, LParenLoc, Args, RParenLoc);
2960 if (!
Member->getDeclName()) {
2964 assert(
Member->getType()->isRecordType() &&
2965 "unnamed member not of record type?");
2978 if (!isArrow &&
Base->isPRValue()) {
2993 SS.
Adopt(QualifierLoc);
2996 if (
Base->containsErrors())
3001 if (isArrow && !BaseType->isPointerType())
3010 if (
getSema().isUnevaluatedContext() &&
Base->isImplicitCXXThis() &&
3015 ->getAsCXXRecordDecl()) {
3019 if (!ThisClass->Equals(
Class) && !ThisClass->isDerivedFrom(
Class))
3027 FirstQualifierInScope,
3028 R, ExplicitTemplateArgs,
3038 bool ForFoldExpression =
false) {
3116 return SemaRef.BuildInitList(LBraceLoc, Inits, RBraceLoc);
3129 =
SemaRef.ActOnDesignatedInitializer(Desig, EqualOrColonLoc, GNUSyntax,
3169 unsigned NumUserSpecifiedExprs,
3174 InitLoc, LParenLoc, RParenLoc);
3204 return SemaRef.ActOnChooseExpr(BuiltinLoc,
3216 Expr *ControllingExpr,
3221 ControllingExpr, Types, Exprs);
3236 ControllingType, Types, Exprs);
3269 case Stmt::CXXStaticCastExprClass:
3270 return getDerived().RebuildCXXStaticCastExpr(OpLoc, LAngleLoc, TInfo,
3271 RAngleLoc, LParenLoc,
3272 SubExpr, RParenLoc);
3274 case Stmt::CXXDynamicCastExprClass:
3275 return getDerived().RebuildCXXDynamicCastExpr(OpLoc, LAngleLoc, TInfo,
3276 RAngleLoc, LParenLoc,
3277 SubExpr, RParenLoc);
3279 case Stmt::CXXReinterpretCastExprClass:
3280 return getDerived().RebuildCXXReinterpretCastExpr(OpLoc, LAngleLoc, TInfo,
3281 RAngleLoc, LParenLoc,
3285 case Stmt::CXXConstCastExprClass:
3286 return getDerived().RebuildCXXConstCastExpr(OpLoc, LAngleLoc, TInfo,
3287 RAngleLoc, LParenLoc,
3288 SubExpr, RParenLoc);
3290 case Stmt::CXXAddrspaceCastExprClass:
3291 return getDerived().RebuildCXXAddrspaceCastExpr(
3292 OpLoc, LAngleLoc, TInfo, RAngleLoc, LParenLoc, SubExpr, RParenLoc);
3295 llvm_unreachable(
"Invalid C++ named cast");
3373 OpLoc, tok::kw_addrspace_cast, TInfo, SubExpr,
3385 bool ListInitialization) {
3389 if (
auto *PLE = dyn_cast<ParenListExpr>(Sub))
3391 TInfo, LParenLoc,
MultiExprArg(PLE->getExprs(), PLE->getNumExprs()),
3392 RParenLoc, ListInitialization);
3394 if (
auto *PLE = dyn_cast<CXXParenListInitExpr>(Sub))
3396 TInfo, LParenLoc, PLE->getInitExprs(), RParenLoc, ListInitialization);
3400 ListInitialization);
3464 if (
getSema().CheckCXXThisType(ThisLoc, ThisType))
3474 bool IsThrownVariableInScope) {
3484 Expr *RewrittenExpr) {
3486 RewrittenExpr,
getSema().CurContext);
3520 std::optional<Expr *> ArraySize,
3539 bool IsGlobalDelete,
3590 bool IsAddressOfOperand,
3593 SS.
Adopt(QualifierLoc);
3595 if (TemplateArgs || TemplateKWLoc.
isValid())
3597 SS, TemplateKWLoc, NameInfo, TemplateArgs, IsAddressOfOperand);
3600 SS, NameInfo, IsAddressOfOperand, RecoveryTSI);
3622 bool IsElidable,
MultiExprArg Args,
bool HadMultipleCandidates,
3623 bool ListInitialization,
bool StdInitListInitialization,
3630 FoundCtor =
Constructor->getInheritedConstructor().getConstructor();
3633 if (
getSema().CompleteConstructorCall(FoundCtor,
T, Args, Loc,
3640 HadMultipleCandidates,
3642 StdInitListInitialization,
3643 RequiresZeroInit, ConstructKind,
3651 bool ConstructsVBase,
3652 bool InheritedFromVBase) {
3654 Loc,
T,
Constructor, ConstructsVBase, InheritedFromVBase);
3665 bool ListInitialization) {
3667 TSInfo, LParenOrBraceLoc, Args, RParenOrBraceLoc, ListInitialization);
3678 bool ListInitialization) {
3680 RParenLoc, ListInitialization);
3697 SS.
Adopt(QualifierLoc);
3699 return SemaRef.BuildMemberReferenceExpr(BaseE, BaseType,
3700 OperatorLoc, IsArrow,
3702 FirstQualifierInScope,
3704 TemplateArgs,
nullptr);
3720 SS.
Adopt(QualifierLoc);
3722 return SemaRef.BuildMemberReferenceExpr(BaseE, BaseType,
3723 OperatorLoc, IsArrow,
3725 FirstQualifierInScope,
3726 R, TemplateArgs,
nullptr);
3734 return SemaRef.BuildCXXNoexceptExpr(Range.getBegin(), Arg, Range.getEnd());
3747 RParenLoc, Length, PartialArgs);
3752 Expr *PackIdExpression,
Expr *IndexExpr,
3754 bool FullySubstituted =
false) {
3756 IndexExpr, RSquareLoc, ExpandedExprs,
3782 NamedConcept, TALI);
3800 LocalParameters, RParenLoc, Requirements,
3807 return SemaRef.BuildTypeRequirement(SubstDiag);
3811 return SemaRef.BuildTypeRequirement(
T);
3819 return SemaRef.BuildExprRequirement(SubstDiag, IsSimple, NoexceptLoc,
3826 return SemaRef.BuildExprRequirement(E, IsSimple, NoexceptLoc,
3833 return SemaRef.BuildNestedRequirement(InvalidConstraintEntity,
3838 return SemaRef.BuildNestedRequirement(Constraint);
3854 Expr **Elements,
unsigned NumElements) {
3864 RB,
Base, Key, getterMethod, setterMethod);
3883 return SemaRef.ObjC().BuildObjCEncodeExpression(AtLoc, EncodeTypeInfo,
3895 return SemaRef.ObjC().BuildClassMessage(
3896 ReceiverTypeInfo, ReceiverTypeInfo->
getType(),
3909 return SemaRef.ObjC().BuildInstanceMessage(Receiver, Receiver->
getType(),
3912 SelectorLocs, RBracLoc, Args);
3924 return Method->isInstanceMethod()
3925 ?
SemaRef.ObjC().BuildInstanceMessage(
3926 nullptr, SuperType, SuperLoc, Sel,
Method, LBracLoc,
3927 SelectorLocs, RBracLoc, Args)
3928 :
SemaRef.ObjC().BuildClassMessage(
nullptr, SuperType, SuperLoc,
3930 SelectorLocs, RBracLoc, Args);
3939 bool IsArrow,
bool IsFreeIvar) {
3948 if (IsFreeIvar &&
Result.isUsable())
3985 PropertyLoc,
Base));
4014 =
SemaRef.Context.Idents.get(
"__builtin_shufflevector");
4017 assert(!Lookup.
empty() &&
"No __builtin_shufflevector?");
4025 Callee =
SemaRef.ImpCastExprToType(Callee, CalleePtrTy,
4026 CK_BuiltinFnToFnPtr).get();
4042 return SemaRef.ConvertVectorExpr(SrcExpr, DstTInfo, BuiltinLoc, RParenLoc);
4057 EllipsisLoc, NumExpansions);
4081 llvm_unreachable(
"Pack expansion pattern has no parameter packs");
4117 EllipsisLoc, RHS, RParenLoc,
4126 Init->containsUnexpandedParameterPack();
4127 else if (PVD->hasUninstantiatedDefaultArg())
4129 PVD->getUninstantiatedDefaultArg()
4130 ->containsUnexpandedParameterPack();
4284 Exprs.push_back(DevNumExpr);
4285 llvm::append_range(Exprs, QueueIdExprs);
4322 AssociatedDecl, NTTP, Loc, Arg, PackIndex, Final);
4338 ObjectType, FirstQualifierInScope);
4344 QualType TransformDependentNameType(TypeLocBuilder &TLB,
4345 DependentNameTypeLoc TL,
4346 bool DeducibleTSTContext,
4347 QualType ObjectType = QualType(),
4348 NamedDecl *UnqualLookup =
nullptr);
4351 TransformOpenACCClauseList(OpenACCDirectiveKind DirKind,
4356 OpenACCDirectiveKind DirKind,
4357 const OpenACCClause *OldClause);
4360template <
typename Derived>
4370#define STMT(Node, Parent) \
4371 case Stmt::Node##Class: return getDerived().Transform##Node(cast<Node>(S));
4372#define VALUESTMT(Node, Parent) \
4373 case Stmt::Node##Class: \
4374 return getDerived().Transform##Node(cast<Node>(S), SDK);
4375#define ABSTRACT_STMT(Node)
4376#define EXPR(Node, Parent)
4377#include "clang/AST/StmtNodes.inc"
4380#define STMT(Node, Parent)
4381#define ABSTRACT_STMT(Stmt)
4382#define EXPR(Node, Parent) case Stmt::Node##Class:
4383#include "clang/AST/StmtNodes.inc"
4388 E =
getSema().ActOnStmtExprResult(E);
4396template<
typename Derived>
4404#define GEN_CLANG_CLAUSE_CLASS
4405#define CLAUSE_CLASS(Enum, Str, Class) \
4407 return getDerived().Transform##Class(cast<Class>(S));
4408#include "llvm/Frontend/OpenMP/OMP.inc"
4415template<
typename Derived>
4422#define STMT(Node, Parent) case Stmt::Node##Class: break;
4423#define ABSTRACT_STMT(Stmt)
4424#define EXPR(Node, Parent) \
4425 case Stmt::Node##Class: return getDerived().Transform##Node(cast<Node>(E));
4426#include "clang/AST/StmtNodes.inc"
4432template<
typename Derived>
4440 if (
auto *FE = dyn_cast<FullExpr>(
Init))
4441 Init = FE->getSubExpr();
4443 if (
auto *AIL = dyn_cast<ArrayInitLoopExpr>(
Init)) {
4449 Init = MTE->getSubExpr();
4452 Init = Binder->getSubExpr();
4455 Init = ICE->getSubExprAsWritten();
4458 dyn_cast<CXXStdInitializerListExpr>(
Init))
4495 getSema().currentEvaluationContext().InLifetimeExtendingContext =
4496 getSema().parentEvaluationContext().InLifetimeExtendingContext;
4497 getSema().currentEvaluationContext().RebuildDefaultArgOrDefaultInit =
4498 getSema().parentEvaluationContext().RebuildDefaultArgOrDefaultInit;
4500 bool ArgChanged =
false;
4502 true, NewArgs, &ArgChanged))
4512 if (
Parens.isInvalid()) {
4515 assert(NewArgs.empty() &&
4516 "no parens or braces but have direct init with arguments?");
4523template<
typename Derived>
4529 for (
unsigned I = 0; I != NumInputs; ++I) {
4539 Expr *Pattern = Expansion->getPattern();
4542 getSema().collectUnexpandedParameterPacks(Pattern, Unexpanded);
4543 assert(!Unexpanded.empty() &&
"Pack expansion without parameter packs?");
4548 bool RetainExpansion =
false;
4549 UnsignedOrNone OrigNumExpansions = Expansion->getNumExpansions();
4553 Unexpanded,
true, Expand,
4554 RetainExpansion, NumExpansions))
4567 Expansion->getEllipsisLoc(),
4569 if (Out.isInvalid())
4574 Outputs.push_back(Out.get());
4580 if (ArgChanged) *ArgChanged =
true;
4584 for (
unsigned I = 0; I != *NumExpansions; ++I) {
4587 if (Out.isInvalid())
4590 if (Out.get()->containsUnexpandedParameterPack()) {
4592 Out.get(), Expansion->getEllipsisLoc(), OrigNumExpansions);
4593 if (Out.isInvalid())
4597 Outputs.push_back(Out.get());
4602 if (RetainExpansion) {
4603 ForgetPartiallySubstitutedPackRAII Forget(
getDerived());
4606 if (Out.isInvalid())
4610 Out.get(), Expansion->getEllipsisLoc(), OrigNumExpansions);
4611 if (Out.isInvalid())
4614 Outputs.push_back(Out.get());
4621 IsCall ?
getDerived().TransformInitializer(Inputs[I],
false)
4626 if (
Result.get() != Inputs[I] && ArgChanged)
4629 Outputs.push_back(
Result.get());
4635template <
typename Derived>
4646 VarDecl *ConditionVar = cast_or_null<VarDecl>(
4652 return getSema().ActOnConditionVariable(ConditionVar, Loc, Kind);
4661 return getSema().ActOnCondition(
nullptr, Loc, CondExpr.
get(), Kind,
4668template <
typename Derived>
4676 Qualifier = Qualifier.getAsNamespaceAndPrefix().Prefix)
4688 llvm_unreachable(
"unexpected null nested name specifier");
4719 QualifierLoc =
getDerived().TransformNestedNameSpecifierLoc(
4720 QualifierLoc, ObjectType, FirstQualifierInScope);
4724 FirstQualifierInScope =
nullptr;
4726 SS.
Adopt(QualifierLoc);
4730 if (
SemaRef.BuildCXXNestedNameSpecifier(
nullptr, IdInfo,
4732 FirstQualifierInScope,
false))
4740 T = TransformTypeInObjectScope(TLB, TL, ObjectType,
4741 FirstQualifierInScope);
4747 if (
T->isDependentType() ||
T->isRecordType() ||
4748 (
SemaRef.getLangOpts().CPlusPlus11 &&
T->isEnumeralType())) {
4749 if (
T->isEnumeralType())
4751 diag::warn_cxx98_compat_enum_nested_name_spec);
4758 if (!TTL || !TTL.
getDecl()->isInvalidDecl()) {
4782template<
typename Derived>
4802 TemplateDecl *NewTemplate = cast_or_null<TemplateDecl>(
4809 SemaRef.Context.DeclarationNames.getCXXDeductionGuideName(NewTemplate));
4819 NewTInfo =
getDerived().TransformType(OldTInfo);
4822 NewCanTy =
SemaRef.Context.getCanonicalType(NewTInfo->
getType());
4830 NewCanTy =
SemaRef.Context.getCanonicalType(NewT);
4843 llvm_unreachable(
"Unknown name kind.");
4846template <
typename Derived>
4850 QualType ObjectType,
bool AllowInjectedClassName) {
4852 return getDerived().RebuildTemplateName(SS, TemplateKWLoc, *II, NameLoc,
4853 ObjectType, AllowInjectedClassName);
4855 NameLoc, ObjectType,
4856 AllowInjectedClassName);
4859template <
typename Derived>
4863 NamedDecl *FirstQualifierInScope,
bool AllowInjectedClassName) {
4865 TemplateName UnderlyingName = QTN->getUnderlyingTemplate();
4868 QualifierLoc =
getDerived().TransformNestedNameSpecifierLoc(
4869 QualifierLoc, ObjectType, FirstQualifierInScope);
4876 UnderlyingQualifier, TemplateKWLoc, UnderlyingName, NameLoc, ObjectType,
4877 FirstQualifierInScope, AllowInjectedClassName);
4878 if (NewUnderlyingName.
isNull())
4880 assert(!UnderlyingQualifier &&
"unexpected qualifier");
4884 NewUnderlyingName == UnderlyingName)
4887 SS.
Adopt(QualifierLoc);
4888 return getDerived().RebuildTemplateName(SS, QTN->hasTemplateKeyword(),
4894 QualifierLoc =
getDerived().TransformNestedNameSpecifierLoc(
4895 QualifierLoc, ObjectType, FirstQualifierInScope);
4909 SS.
Adopt(QualifierLoc);
4910 return getDerived().RebuildTemplateName(SS, TemplateKWLoc, DTN->getName(),
4911 NameLoc, ObjectType,
4912 AllowInjectedClassName);
4917 assert(!QualifierLoc &&
"Unexpected qualified SubstTemplateTemplateParm");
4924 ReplacementQualifierLoc = Builder.getWithLocInContext(
SemaRef.Context);
4928 ReplacementQualifierLoc, TemplateKWLoc, ReplacementName, NameLoc,
4929 ObjectType, FirstQualifierInScope, AllowInjectedClassName);
4932 Decl *AssociatedDecl =
4933 getDerived().TransformDecl(NameLoc, S->getAssociatedDecl());
4935 AssociatedDecl == S->getAssociatedDecl())
4937 return SemaRef.Context.getSubstTemplateTemplateParm(
4938 NewName, AssociatedDecl, S->getIndex(), S->getPackIndex(),
4943 "DeducedTemplateName should not escape partial ordering");
4947 assert(!QualifierLoc &&
"Unexpected qualifier");
4954 assert(!QualifierLoc &&
4955 "Unexpected qualified SubstTemplateTemplateParmPack");
4957 SubstPack->getArgumentPack(), SubstPack->getAssociatedDecl(),
4958 SubstPack->getIndex(), SubstPack->getFinal());
4962 llvm_unreachable(
"overloaded function decl survived to here");
4965template <
typename Derived>
4970 QualifierLoc, TemplateKeywordLoc, Name, NameLoc);
4976template<
typename Derived>
4980 Output =
getSema().getTrivialTemplateArgumentLoc(
4984template <
typename Derived>
4992 llvm_unreachable(
"Unexpected TemplateArgument");
5015 if (NewT ==
T && D == NewD)
5032 llvm_unreachable(
"unexpected template argument kind");
5064 llvm_unreachable(
"Caller should expand pack expansions");
5080 E =
SemaRef.ActOnConstantExpression(E);
5095template<
typename Derived,
typename InputIterator>
5103 typedef typename std::iterator_traits<InputIterator>::difference_type
5118 : Self(Self), Iter(Iter) { }
5133 Self.InventTemplateArgumentLoc(*Iter,
Result);
5141 return X.Iter == Y.Iter;
5146 return X.Iter != Y.Iter;
5150template<
typename Derived>
5151template<
typename InputIterator>
5171 PackLocIterator(*
this, In.getArgument().pack_begin()),
5172 PackLocIterator(*
this, In.getArgument().pack_end()), *PackOutput,
5179 if (In.getArgument().isPackExpansion()) {
5191 std::optional<ForgetSubstitutionRAII> ForgetSubst;
5201 if (Out.getArgument().containsUnexpandedParameterPack()) {
5204 if (Out.getArgument().isNull())
5214 ForgetPartiallySubstitutedPackRAII Forget(
getDerived());
5222 if (Out.getArgument().isNull())
5241template <
typename Derived>
5242template <
typename InputIterator>
5251 return !Arg.isDependent() && Arg.isConceptOrConceptTemplateParameter();
5263 PackLocIterator(*
this, In.getArgument().pack_begin()),
5264 PackLocIterator(*
this, In.getArgument().pack_end()), Outputs,
5270 if (!isNonDependentConceptArgument(In.getArgument())) {
5285template <
typename Derived>
5296 Pattern =
getSema().getTemplateArgumentPackExpansionPattern(
5299 getSema().collectUnexpandedParameterPacks(Pattern, Unexpanded);
5300 if (IsLateExpansionAttempt) {
5305 return P.first.dyn_cast<
const SubstBuiltinTemplatePackType *>();
5307 if (!SawPackTypes) {
5312 assert(!Unexpanded.empty() &&
"Pack expansion without parameter packs?");
5320 Info.
Ellipsis, Pattern.getSourceRange(), Unexpanded,
5326 if (ComputeInfo(In,
false, Info, Pattern))
5338 std::optional<Sema::ArgPackSubstIndexRAII> SubstIndex(
5339 std::in_place,
getSema(), std::nullopt);
5345 if (Out.getArgument().isNull())
5382 ForgetSubstitutionRAII ForgetSubst(
getDerived());
5383 if (ComputeInfo(Out,
true, Info, OutPattern))
5396template<
typename Derived>
5414template <
typename Derived>
5434template<
typename Derived>
5437 switch (
T.getTypeLocClass()) {
5438#define ABSTRACT_TYPELOC(CLASS, PARENT)
5439#define TYPELOC(CLASS, PARENT) \
5440 case TypeLoc::CLASS: \
5441 return getDerived().Transform##CLASS##Type(TLB, \
5442 T.castAs<CLASS##TypeLoc>());
5443#include "clang/AST/TypeLocNodes.def"
5446 llvm_unreachable(
"unhandled type loc!");
5449template<
typename Derived>
5462template <
typename Derived>
5500template<
typename Derived>
5505 TypeLoc UnqualTL =
T.getUnqualifiedLoc();
5506 auto SuppressObjCLifetime =
5507 T.getType().getLocalQualifiers().hasObjCLifetime();
5509 Result = getDerived().TransformTemplateTypeParmType(TLB, TTP,
5510 SuppressObjCLifetime);
5511 }
else if (
auto STTP = UnqualTL.
getAs<SubstTemplateTypeParmPackTypeLoc>()) {
5512 Result = getDerived().TransformSubstTemplateTypeParmPackType(
5513 TLB, STTP, SuppressObjCLifetime);
5515 Result = getDerived().TransformType(TLB, UnqualTL);
5534template <
typename Derived>
5544 SemaRef.Diag(Loc, diag::err_address_space_mismatch_templ_inst)
5551 if (
T.getPointerAuth().isPresent()) {
5552 SemaRef.Diag(Loc, diag::err_ptrauth_qualifier_redundant) << TL.
getType();
5555 if (!
T->isDependentType()) {
5556 if (!
T->isSignableType(
SemaRef.getASTContext())) {
5557 SemaRef.Diag(Loc, diag::err_ptrauth_qualifier_invalid_target) <<
T;
5565 if (
T->isFunctionType()) {
5566 T =
SemaRef.getASTContext().getAddrSpaceQualType(
T,
5576 if (
T->isReferenceType()) {
5586 if (!
T->isObjCLifetimeType() && !
T->isDependentType())
5588 else if (
T.getObjCLifetime()) {
5592 const AutoType *AutoTy;
5593 if ((AutoTy = dyn_cast<AutoType>(
T)) && AutoTy->isDeduced()) {
5595 QualType Deduced = AutoTy->getDeducedType();
5600 T =
SemaRef.Context.getAutoType(Deduced, AutoTy->getKeyword(),
5603 AutoTy->getTypeConstraintConcept(),
5604 AutoTy->getTypeConstraintArguments());
5609 SemaRef.Diag(Loc, diag::err_attr_objc_ownership_redundant) <<
T;
5615 return SemaRef.BuildQualifiedType(
T, Loc, Quals);
5618template <
typename Derived>
5619QualType TreeTransform<Derived>::TransformTypeInObjectScope(
5622 assert(!getDerived().AlreadyTransformed(TL.
getType()));
5625 case TypeLoc::TemplateSpecialization:
5626 return getDerived().TransformTemplateSpecializationType(
5628 FirstQualifierInScope,
true);
5629 case TypeLoc::DependentName:
5630 return getDerived().TransformDependentNameType(
5632 ObjectType, FirstQualifierInScope);
5636 return getDerived().TransformType(TLB, TL);
5640template <
class TyLoc>
static inline
5642 TyLoc NewT = TLB.
push<TyLoc>(
T.getType());
5643 NewT.setNameLoc(
T.getNameLoc());
5647template<
typename Derived>
5648QualType TreeTransform<Derived>::TransformBuiltinType(TypeLocBuilder &TLB,
5650 BuiltinTypeLoc NewT = TLB.push<BuiltinTypeLoc>(T.getType());
5651 NewT.setBuiltinLoc(T.getBuiltinLoc());
5652 if (T.needsExtraLocalData())
5653 NewT.getWrittenBuiltinSpecs() = T.getWrittenBuiltinSpecs();
5657template<
typename Derived>
5664template <
typename Derived>
5668 return getDerived().
TransformType(TLB, TL.getOriginalLoc());
5671template<
typename Derived>
5674 QualType OriginalType = getDerived().TransformType(TLB, TL.getOriginalLoc());
5675 if (OriginalType.isNull())
5679 if (getDerived().AlwaysRebuild() ||
5680 OriginalType != TL.getOriginalLoc().getType())
5687template <
typename Derived>
5691 QualType OriginalType = getDerived().TransformType(TLB, TL.getElementLoc());
5692 if (OriginalType.isNull())
5696 if (getDerived().AlwaysRebuild() ||
5697 OriginalType != TL.getElementLoc().getType())
5704template<
typename Derived>
5708 = getDerived().TransformType(TLB, TL.getPointeeLoc());
5709 if (PointeeType.isNull())
5713 if (PointeeType->getAs<ObjCObjectType>()) {
5725 if (getDerived().AlwaysRebuild() ||
5726 PointeeType != TL.getPointeeLoc().getType()) {
5727 Result = getDerived().RebuildPointerType(PointeeType, TL.getSigilLoc());
5734 TLB.TypeWasModifiedSafely(
Result->getPointeeType());
5741template<
typename Derived>
5746 = getDerived().TransformType(TLB, TL.getPointeeLoc());
5747 if (PointeeType.isNull())
5751 if (getDerived().AlwaysRebuild() ||
5752 PointeeType != TL.getPointeeLoc().getType()) {
5753 Result = getDerived().RebuildBlockPointerType(PointeeType,
5768template<
typename Derived>
5776 if (PointeeType.
isNull())
5781 PointeeType !=
T->getPointeeTypeAsWritten()) {
5783 T->isSpelledAsLValue(),
5805template<
typename Derived>
5809 return TransformReferenceType(TLB, TL);
5812template<
typename Derived>
5814TreeTransform<Derived>::TransformRValueReferenceType(TypeLocBuilder &TLB,
5815 RValueReferenceTypeLoc TL) {
5816 return TransformReferenceType(TLB, TL);
5819template<
typename Derived>
5823 QualType PointeeType = getDerived().TransformType(TLB, TL.getPointeeLoc());
5824 if (PointeeType.isNull())
5831 getDerived().TransformNestedNameSpecifierLoc(OldQualifierLoc);
5832 if (!NewQualifierLoc)
5835 CXXRecordDecl *OldCls =
T->getMostRecentCXXRecordDecl(), *NewCls =
nullptr;
5837 NewCls = cast_or_null<CXXRecordDecl>(
5838 getDerived().TransformDecl(TL.getStarLoc(), OldCls));
5844 if (getDerived().AlwaysRebuild() || PointeeType !=
T->getPointeeType() ||
5845 NewQualifierLoc.getNestedNameSpecifier() !=
5846 OldQualifierLoc.getNestedNameSpecifier() ||
5849 SS.
Adopt(NewQualifierLoc);
5850 Result = getDerived().RebuildMemberPointerType(PointeeType, SS, NewCls,
5859 if (MPT && PointeeType != MPT->getPointeeType()) {
5866 NewTL.setQualifierLoc(NewQualifierLoc);
5871template<
typename Derived>
5876 QualType ElementType = getDerived().TransformType(TLB, TL.getElementLoc());
5877 if (ElementType.isNull())
5881 Expr *OldSize = TL.getSizeExpr();
5883 OldSize =
const_cast<Expr*
>(
T->getSizeExpr());
5884 Expr *NewSize =
nullptr;
5888 NewSize = getDerived().TransformExpr(OldSize).template getAs<Expr>();
5893 if (getDerived().AlwaysRebuild() ||
5894 ElementType !=
T->getElementType() ||
5895 (
T->getSizeExpr() && NewSize != OldSize)) {
5896 Result = getDerived().RebuildConstantArrayType(ElementType,
5897 T->getSizeModifier(),
5898 T->getSize(), NewSize,
5899 T->getIndexTypeCVRQualifiers(),
5900 TL.getBracketsRange());
5911 NewTL.setRBracketLoc(TL.getRBracketLoc());
5912 NewTL.setSizeExpr(NewSize);
5917template<
typename Derived>
5922 QualType ElementType = getDerived().TransformType(TLB, TL.getElementLoc());
5923 if (ElementType.isNull())
5927 if (getDerived().AlwaysRebuild() ||
5928 ElementType !=
T->getElementType()) {
5929 Result = getDerived().RebuildIncompleteArrayType(ElementType,
5930 T->getSizeModifier(),
5931 T->getIndexTypeCVRQualifiers(),
5932 TL.getBracketsRange());
5939 NewTL.setRBracketLoc(TL.getRBracketLoc());
5940 NewTL.setSizeExpr(
nullptr);
5945template<
typename Derived>
5950 QualType ElementType = getDerived().TransformType(TLB, TL.getElementLoc());
5951 if (ElementType.isNull())
5958 SizeResult = getDerived().TransformExpr(
T->getSizeExpr());
5960 if (SizeResult.isInvalid())
5964 if (SizeResult.isInvalid())
5970 if (getDerived().AlwaysRebuild() ||
5971 ElementType !=
T->getElementType() ||
5972 Size !=
T->getSizeExpr()) {
5973 Result = getDerived().RebuildVariableArrayType(ElementType,
5974 T->getSizeModifier(),
5976 T->getIndexTypeCVRQualifiers(),
5977 TL.getBracketsRange());
5986 NewTL.setRBracketLoc(TL.getRBracketLoc());
5987 NewTL.setSizeExpr(Size);
5992template<
typename Derived>
5997 QualType ElementType = getDerived().TransformType(TLB, TL.getElementLoc());
5998 if (ElementType.isNull())
6006 SemaRef.
ExprEvalContexts.back().InConditionallyConstantEvaluateContext =
true;
6009 Expr *origSize = TL.getSizeExpr();
6010 if (!origSize) origSize =
T->getSizeExpr();
6013 = getDerived().TransformExpr(origSize);
6015 if (sizeResult.isInvalid())
6018 Expr *size = sizeResult.get();
6021 if (getDerived().AlwaysRebuild() ||
6022 ElementType !=
T->getElementType() ||
6024 Result = getDerived().RebuildDependentSizedArrayType(ElementType,
6025 T->getSizeModifier(),
6027 T->getIndexTypeCVRQualifiers(),
6028 TL.getBracketsRange());
6037 NewTL.setRBracketLoc(TL.getRBracketLoc());
6038 NewTL.setSizeExpr(size);
6043template <
typename Derived>
6047 QualType ElementType = getDerived().TransformType(TLB, TL.getElementLoc());
6048 if (ElementType.isNull())
6056 if (
Size.isInvalid())
6060 if (getDerived().AlwaysRebuild() || ElementType !=
T->getElementType() ||
6061 Size.get() !=
T->getSizeExpr()) {
6062 Result = getDerived().RebuildDependentVectorType(
6063 ElementType,
Size.get(),
T->getAttributeLoc(),
T->getVectorKind());
6081template<
typename Derived>
6088 QualType ElementType = getDerived().TransformType(TLB, TL.getElementLoc());
6089 if (ElementType.isNull())
6098 if (
Size.isInvalid())
6102 if (getDerived().AlwaysRebuild() ||
6103 ElementType !=
T->getElementType() ||
6104 Size.get() !=
T->getSizeExpr()) {
6105 Result = getDerived().RebuildDependentSizedExtVectorType(ElementType,
6107 T->getAttributeLoc());
6125template <
typename Derived>
6130 QualType ElementType = getDerived().TransformType(
T->getElementType());
6131 if (ElementType.isNull())
6135 if (getDerived().AlwaysRebuild() || ElementType !=
T->getElementType()) {
6136 Result = getDerived().RebuildConstantMatrixType(
6137 ElementType,
T->getNumRows(),
T->getNumColumns());
6144 NewTL.setAttrOperandParensRange(TL.getAttrOperandParensRange());
6145 NewTL.setAttrRowOperand(TL.getAttrRowOperand());
6146 NewTL.setAttrColumnOperand(TL.getAttrColumnOperand());
6151template <
typename Derived>
6156 QualType ElementType = getDerived().TransformType(
T->getElementType());
6157 if (ElementType.isNull()) {
6165 Expr *origRows = TL.getAttrRowOperand();
6167 origRows =
T->getRowExpr();
6168 Expr *origColumns = TL.getAttrColumnOperand();
6170 origColumns =
T->getColumnExpr();
6172 ExprResult rowResult = getDerived().TransformExpr(origRows);
6174 if (rowResult.isInvalid())
6177 ExprResult columnResult = getDerived().TransformExpr(origColumns);
6179 if (columnResult.isInvalid())
6182 Expr *rows = rowResult.get();
6183 Expr *columns = columnResult.get();
6186 if (getDerived().AlwaysRebuild() || ElementType !=
T->getElementType() ||
6187 rows != origRows || columns != origColumns) {
6188 Result = getDerived().RebuildDependentSizedMatrixType(
6189 ElementType, rows, columns,
T->getAttributeLoc());
6199 NewTL.setAttrOperandParensRange(TL.getAttrOperandParensRange());
6200 NewTL.setAttrRowOperand(rows);
6201 NewTL.setAttrColumnOperand(columns);
6205template <
typename Derived>
6211 getDerived().TransformType(TLB, TL.getPointeeTypeLoc());
6213 if (pointeeType.isNull())
6220 ExprResult AddrSpace = getDerived().TransformExpr(
T->getAddrSpaceExpr());
6222 if (AddrSpace.isInvalid())
6226 if (getDerived().AlwaysRebuild() || pointeeType !=
T->getPointeeType() ||
6227 AddrSpace.get() !=
T->getAddrSpaceExpr()) {
6228 Result = getDerived().RebuildDependentAddressSpaceType(
6229 pointeeType, AddrSpace.get(),
T->getAttributeLoc());
6240 NewTL.setAttrExprOperand(TL.getAttrExprOperand());
6241 NewTL.setAttrNameLoc(TL.getAttrNameLoc());
6244 TLB.TypeWasModifiedSafely(
Result);
6250template <
typename Derived>
6254 QualType ElementType = getDerived().TransformType(TLB, TL.getElementLoc());
6255 if (ElementType.isNull())
6259 if (getDerived().AlwaysRebuild() ||
6260 ElementType !=
T->getElementType()) {
6261 Result = getDerived().RebuildVectorType(ElementType,
T->getNumElements(),
6262 T->getVectorKind());
6273template<
typename Derived>
6277 QualType ElementType = getDerived().TransformType(TLB, TL.getElementLoc());
6278 if (ElementType.isNull())
6282 if (getDerived().AlwaysRebuild() ||
6283 ElementType !=
T->getElementType()) {
6284 Result = getDerived().RebuildExtVectorType(ElementType,
6285 T->getNumElements(),
6297template <
typename Derived>
6300 bool ExpectParameterPack) {
6335 if (NewTSI == OldTSI && indexAdjustment == 0)
6345 getDerived().transformedLocalDecl(OldParm, {newParm});
6349template <
typename Derived>
6357 unsigned *LastParamTransformed) {
6358 int indexAdjustment = 0;
6360 unsigned NumParams = Params.size();
6361 for (
unsigned i = 0; i != NumParams; ++i) {
6362 if (LastParamTransformed)
6363 *LastParamTransformed = i;
6365 assert(OldParm->getFunctionScopeIndex() == i);
6369 if (OldParm->isParameterPack()) {
6374 TypeLoc TL = OldParm->getTypeSourceInfo()->getTypeLoc();
6377 SemaRef.collectUnexpandedParameterPacks(Pattern, Unexpanded);
6380 bool ShouldExpand =
false;
6381 bool RetainExpansion =
false;
6383 if (Unexpanded.size() > 0) {
6384 OrigNumExpansions = ExpansionTL.
getTypePtr()->getNumExpansions();
6385 NumExpansions = OrigNumExpansions;
6389 ShouldExpand, RetainExpansion, NumExpansions)) {
6394 const AutoType *AT =
6395 Pattern.getType().getTypePtr()->getContainedAutoType();
6396 assert((AT && (!AT->isDeduced() || AT->getDeducedType().isNull())) &&
6397 "Could not find parameter packs or undeduced auto type!");
6404 getDerived().ExpandingFunctionParameterPack(OldParm);
6405 for (
unsigned I = 0; I != *NumExpansions; ++I) {
6408 =
getDerived().TransformFunctionTypeParam(OldParm,
6416 PInfos.
set(OutParamTypes.size(), ParamInfos[i]);
6417 OutParamTypes.push_back(NewParm->
getType());
6419 PVars->push_back(NewParm);
6424 if (RetainExpansion) {
6425 ForgetPartiallySubstitutedPackRAII Forget(
getDerived());
6427 =
getDerived().TransformFunctionTypeParam(OldParm,
6435 PInfos.
set(OutParamTypes.size(), ParamInfos[i]);
6436 OutParamTypes.push_back(NewParm->
getType());
6438 PVars->push_back(NewParm);
6454 NewParm =
getDerived().TransformFunctionTypeParam(OldParm,
6459 "Parameter pack no longer a parameter pack after "
6462 NewParm =
getDerived().TransformFunctionTypeParam(
6463 OldParm, indexAdjustment, std::nullopt,
6471 PInfos.
set(OutParamTypes.size(), ParamInfos[i]);
6472 OutParamTypes.push_back(NewParm->
getType());
6474 PVars->push_back(NewParm);
6482 bool IsPackExpansion =
false;
6485 if (
const PackExpansionType *Expansion
6486 = dyn_cast<PackExpansionType>(OldType)) {
6488 QualType Pattern = Expansion->getPattern();
6490 getSema().collectUnexpandedParameterPacks(Pattern, Unexpanded);
6493 bool ShouldExpand =
false;
6494 bool RetainExpansion =
false;
6498 RetainExpansion, NumExpansions)) {
6505 for (
unsigned I = 0; I != *NumExpansions; ++I) {
6512 NewType =
getSema().getASTContext().getPackExpansionType(
6513 NewType, std::nullopt);
6520 PInfos.
set(OutParamTypes.size(), ParamInfos[i]);
6521 OutParamTypes.push_back(NewType);
6523 PVars->push_back(
nullptr);
6532 if (RetainExpansion) {
6533 ForgetPartiallySubstitutedPackRAII Forget(
getDerived());
6539 PInfos.
set(OutParamTypes.size(), ParamInfos[i]);
6540 OutParamTypes.push_back(NewType);
6542 PVars->push_back(
nullptr);
6547 OldType = Expansion->getPattern();
6548 IsPackExpansion =
true;
6550 NewType =
getDerived().TransformType(OldType);
6552 NewType =
getDerived().TransformType(OldType);
6558 if (IsPackExpansion)
6559 NewType =
getSema().Context.getPackExpansionType(NewType,
6563 PInfos.
set(OutParamTypes.size(), ParamInfos[i]);
6564 OutParamTypes.push_back(NewType);
6566 PVars->push_back(
nullptr);
6571 for (
unsigned i = 0, e = PVars->size(); i != e; ++i)
6573 assert(parm->getFunctionScopeIndex() == i);
6580template<
typename Derived>
6585 return getDerived().TransformFunctionProtoType(
6589 ExceptionStorage, Changed);
6593template<
typename Derived>
template<
typename Fn>
6612 if (
T->hasTrailingReturn()) {
6616 T->getExtParameterInfosOrNull(),
6617 ParamTypes, &ParamDecls, ExtParamInfos))
6627 auto *RD = dyn_cast<CXXRecordDecl>(
SemaRef.getCurLexicalContext());
6629 SemaRef, !ThisContext && RD ? RD : ThisContext, ThisTypeQuals);
6644 T->getExtParameterInfosOrNull(),
6645 ParamTypes, &ParamDecls, ExtParamInfos))
6651 bool EPIChanged =
false;
6656 if (
auto NewExtParamInfos =
6672 std::optional<FunctionEffectSet> NewFX;
6684 std::optional<FunctionEffectMode> Mode =
6704 "FunctionEffectMode::None shouldn't be possible here");
6707 if (!
SemaRef.diagnoseConflictingFunctionEffect(*NewFX, NewEC,
6710 NewFX->insert(NewEC, Errs);
6711 assert(Errs.empty());
6721 Result =
getDerived().RebuildFunctionProtoType(ResultType, ParamTypes, EPI);
6732 for (
unsigned i = 0, e = NewTL.
getNumParams(); i != e; ++i)
6738template<
typename Derived>
6761 getSema().ActOnNoexceptSpec(NoexceptExpr.
get(), EST);
6776 if (
const PackExpansionType *PackExpansion =
6777 T->getAs<PackExpansionType>()) {
6782 SemaRef.collectUnexpandedParameterPacks(PackExpansion->getPattern(),
6784 assert(!Unexpanded.empty() &&
"Pack expansion without parameter packs?");
6789 bool Expand =
false;
6790 bool RetainExpansion =
false;
6791 UnsignedOrNone NumExpansions = PackExpansion->getNumExpansions();
6796 true, Expand, RetainExpansion,
6809 U =
SemaRef.Context.getPackExpansionType(
U, NumExpansions);
6810 Exceptions.push_back(
U);
6816 for (
unsigned ArgIdx = 0; ArgIdx != *NumExpansions; ++ArgIdx) {
6820 if (
U.isNull() ||
SemaRef.CheckSpecifiedExceptionType(
U, Loc))
6823 Exceptions.push_back(
U);
6827 if (
U.isNull() ||
SemaRef.CheckSpecifiedExceptionType(
U, Loc))
6832 Exceptions.push_back(
U);
6842template<
typename Derived>
6852 if (getDerived().AlwaysRebuild() || ResultType !=
T->getReturnType())
6853 Result = getDerived().RebuildFunctionNoProtoType(ResultType);
6864template <
typename Derived>
6865QualType TreeTransform<Derived>::TransformUnresolvedUsingType(
6866 TypeLocBuilder &TLB, UnresolvedUsingTypeLoc TL) {
6868 const UnresolvedUsingType *T = TL.getTypePtr();
6869 bool Changed =
false;
6871 NestedNameSpecifierLoc QualifierLoc = TL.getQualifierLoc();
6872 if (NestedNameSpecifierLoc OldQualifierLoc = QualifierLoc) {
6873 QualifierLoc = getDerived().TransformNestedNameSpecifierLoc(QualifierLoc);
6876 Changed |= QualifierLoc != OldQualifierLoc;
6879 auto *D = getDerived().TransformDecl(TL.getNameLoc(),
T->getDecl());
6885 if (getDerived().AlwaysRebuild() || Changed) {
6886 Result = getDerived().RebuildUnresolvedUsingType(
6887 T->getKeyword(), QualifierLoc.getNestedNameSpecifier(), TL.getNameLoc(),
6895 QualifierLoc, TL.getNameLoc());
6898 QualifierLoc, TL.getNameLoc());
6902template <
typename Derived>
6910 QualifierLoc = getDerived().TransformNestedNameSpecifierLoc(QualifierLoc);
6913 Changed |= QualifierLoc != OldQualifierLoc;
6916 auto *D = cast_or_null<UsingShadowDecl>(
6917 getDerived().TransformDecl(TL.getNameLoc(),
T->getDecl()));
6922 QualType UnderlyingType = getDerived().TransformType(
T->desugar());
6923 if (UnderlyingType.isNull())
6925 Changed |= UnderlyingType !=
T->desugar();
6928 if (getDerived().AlwaysRebuild() || Changed) {
6929 Result = getDerived().RebuildUsingType(
6930 T->getKeyword(), QualifierLoc.getNestedNameSpecifier(), D,
6940template<
typename Derived>
6948 QualifierLoc = getDerived().TransformNestedNameSpecifierLoc(QualifierLoc);
6951 Changed |= QualifierLoc != OldQualifierLoc;
6954 auto *
Typedef = cast_or_null<TypedefNameDecl>(
6955 getDerived().TransformDecl(TL.getNameLoc(),
T->getDecl()));
6963 if (getDerived().AlwaysRebuild() || Changed) {
6964 Result = getDerived().RebuildTypedefType(
6965 T->getKeyword(), QualifierLoc.getNestedNameSpecifier(),
Typedef);
6971 QualifierLoc, TL.getNameLoc());
6975template<
typename Derived>
6983 ExprResult E = getDerived().TransformExpr(TL.getUnderlyingExpr());
6993 if (getDerived().AlwaysRebuild() || E.get() != TL.getUnderlyingExpr()) {
6995 getDerived().RebuildTypeOfExprType(E.get(), TL.getTypeofLoc(), Kind);
7002 NewTL.setLParenLoc(TL.getLParenLoc());
7003 NewTL.setRParenLoc(TL.getRParenLoc());
7008template<
typename Derived>
7012 TypeSourceInfo* New_Under_TI = getDerived().TransformType(Old_Under_TI);
7018 if (getDerived().AlwaysRebuild() || New_Under_TI != Old_Under_TI) {
7019 Result = getDerived().RebuildTypeOfType(New_Under_TI->getType(), Kind);
7026 NewTL.setLParenLoc(TL.getLParenLoc());
7027 NewTL.setRParenLoc(TL.getRParenLoc());
7028 NewTL.setUnmodifiedTInfo(New_Under_TI);
7033template<
typename Derived>
7036 const DecltypeType *
T = TL.getTypePtr();
7043 ExprResult E = getDerived().TransformExpr(
T->getUnderlyingExpr());
7047 E = getSema().ActOnDecltypeExpression(E.get());
7052 if (getDerived().AlwaysRebuild() ||
7053 E.get() !=
T->getUnderlyingExpr()) {
7054 Result = getDerived().RebuildDecltypeType(E.get(), TL.getDecltypeLoc());
7062 NewTL.setRParenLoc(TL.getRParenLoc());
7066template <
typename Derived>
7076 IndexExpr = getDerived().TransformExpr(TL.getIndexExpr());
7077 if (IndexExpr.isInvalid())
7080 QualType Pattern = TL.getPattern();
7082 const PackIndexingType *PIT = TL.
getTypePtr();
7086 bool NotYetExpanded = Types.empty();
7087 bool FullySubstituted =
true;
7089 if (Types.empty() && !PIT->expandsToEmptyPack())
7093 if (!
T->containsUnexpandedParameterPack()) {
7094 QualType Transformed = getDerived().TransformType(
T);
7095 if (Transformed.isNull())
7097 SubtitutedTypes.push_back(Transformed);
7102 getSema().collectUnexpandedParameterPacks(
T, Unexpanded);
7103 assert(!Unexpanded.empty() &&
"Pack expansion without parameter packs?");
7106 bool ShouldExpand =
true;
7107 bool RetainExpansion =
false;
7109 if (getDerived().TryExpandParameterPacks(
7112 RetainExpansion, NumExpansions))
7114 if (!ShouldExpand) {
7120 QualType Pack = getDerived().TransformType(TLB, TI->getTypeLoc());
7123 if (NotYetExpanded) {
7124 FullySubstituted =
false;
7125 QualType Out = getDerived().RebuildPackIndexingType(
7135 SubtitutedTypes.push_back(Pack);
7138 for (
unsigned I = 0; I != *NumExpansions; ++I) {
7143 SubtitutedTypes.push_back(Out);
7144 FullySubstituted &= !
Out->containsUnexpandedParameterPack();
7148 if (RetainExpansion) {
7149 FullySubstituted =
false;
7150 ForgetPartiallySubstitutedPackRAII Forget(getDerived());
7154 SubtitutedTypes.push_back(Out);
7162 QualType Result = getDerived().TransformType(TLB, TL.getPatternLoc());
7164 QualType Out = getDerived().RebuildPackIndexingType(
7166 FullySubstituted, SubtitutedTypes);
7175template<
typename Derived>
7181 if (
Result->isDependentType()) {
7182 const UnaryTransformType *
T = TL.getTypePtr();
7184 NewBaseTSI = getDerived().TransformType(TL.getUnderlyingTInfo());
7187 QualType NewBase = NewBaseTSI->getType();
7189 Result = getDerived().RebuildUnaryTransformType(NewBase,
7198 NewTL.setParensRange(TL.getParensRange());
7199 NewTL.setUnderlyingTInfo(NewBaseTSI);
7203template<
typename Derived>
7206 const DeducedTemplateSpecializationType *
T = TL.getTypePtr();
7211 TL.getTemplateNameLoc());
7215 QualType OldDeduced =
T->getDeducedType();
7217 if (!OldDeduced.isNull()) {
7218 NewDeduced = getDerived().TransformType(OldDeduced);
7219 if (NewDeduced.isNull())
7223 QualType Result = getDerived().RebuildDeducedTemplateSpecializationType(
7230 NewTL.setTemplateNameLoc(TL.getTemplateNameLoc());
7231 NewTL.setQualifierLoc(QualifierLoc);
7235template <
typename Derived>
7242 QualifierLoc =
getDerived().TransformNestedNameSpecifierLoc(QualifierLoc);
7247 auto *TD = cast_or_null<TagDecl>(
7254 TD !=
T->getDecl()) {
7255 if (
T->isCanonicalUnqualified())
7272template <
typename Derived>
7278template <
typename Derived>
7279QualType TreeTransform<Derived>::TransformRecordType(TypeLocBuilder &TLB,
7281 return getDerived().TransformTagType(TLB, TL);
7284template<
typename Derived>
7291template<
typename Derived>
7295 return getDerived().TransformTemplateTypeParmType(
7300template <
typename Derived>
7306template<
typename Derived>
7307QualType TreeTransform<Derived>::TransformSubstTemplateTypeParmType(
7308 TypeLocBuilder &TLB,
7309 SubstTemplateTypeParmTypeLoc TL) {
7310 const SubstTemplateTypeParmType *T = TL.getTypePtr();
7313 getDerived().TransformDecl(TL.getNameLoc(), T->getAssociatedDecl());
7318 TemporaryBase Rebase(*
this, TL.getNameLoc(), DeclarationName());
7319 QualType Replacement = getDerived().TransformType(T->getReplacementType());
7320 if (Replacement.isNull())
7324 Replacement, NewReplaced, T->getIndex(), T->getPackIndex(),
7328 SubstTemplateTypeParmTypeLoc NewTL
7329 = TLB.push<SubstTemplateTypeParmTypeLoc>(Result);
7330 NewTL.setNameLoc(TL.getNameLoc());
7334template <
typename Derived>
7340template<
typename Derived>
7344 return getDerived().TransformSubstTemplateTypeParmPackType(
7348template <
typename Derived>
7354template<
typename Derived>
7355QualType TreeTransform<Derived>::TransformAtomicType(TypeLocBuilder &TLB,
7357 QualType ValueType = getDerived().TransformType(TLB, TL.getValueLoc());
7358 if (ValueType.isNull())
7361 QualType Result = TL.getType();
7362 if (getDerived().AlwaysRebuild() ||
7363 ValueType != TL.getValueLoc().getType()) {
7364 Result = getDerived().RebuildAtomicType(ValueType, TL.getKWLoc());
7365 if (Result.isNull())
7371 NewTL.setLParenLoc(TL.getLParenLoc());
7372 NewTL.setRParenLoc(TL.getRParenLoc());
7377template <
typename Derived>
7380 QualType ValueType = getDerived().TransformType(TLB, TL.getValueLoc());
7381 if (ValueType.isNull())
7385 if (getDerived().AlwaysRebuild() || ValueType != TL.getValueLoc().getType()) {
7388 Result = getDerived().RebuildPipeType(ValueType, TL.getKWLoc(), isReadPipe);
7399template <
typename Derived>
7405 if (getDerived().AlwaysRebuild()) {
7406 Result = getDerived().RebuildBitIntType(EIT->isUnsigned(),
7407 EIT->getNumBits(), TL.getNameLoc());
7417template <
typename Derived>
7424 ExprResult BitsExpr = getDerived().TransformExpr(EIT->getNumBitsExpr());
7427 if (BitsExpr.isInvalid())
7432 if (getDerived().AlwaysRebuild() || BitsExpr.get() != EIT->getNumBitsExpr()) {
7433 Result = getDerived().RebuildDependentBitIntType(
7434 EIT->isUnsigned(), BitsExpr.get(), TL.getNameLoc());
7450template <
typename Derived>
7453 llvm_unreachable(
"This type does not need to be transformed.");
7461 template<
typename ArgLocContainer>
7463 ArgLocContainer *Container;
7488 : Container(&Container), Index(Index) { }
7502 return Container->getArgLoc(Index);
7506 return pointer(Container->getArgLoc(Index));
7511 return X.Container == Y.Container &&
X.Index == Y.Index;
7520template<
typename Derived>
7521QualType TreeTransform<Derived>::TransformAutoType(TypeLocBuilder &TLB,
7523 const AutoType *T = TL.getTypePtr();
7524 QualType OldDeduced = T->getDeducedType();
7525 QualType NewDeduced;
7526 if (!OldDeduced.isNull()) {
7527 NewDeduced = getDerived().TransformType(OldDeduced);
7528 if (NewDeduced.isNull())
7535 if (
T->isConstrained()) {
7536 assert(TL.getConceptReference());
7537 NewCD = cast_or_null<ConceptDecl>(getDerived().TransformDecl(
7538 TL.getConceptNameLoc(),
T->getTypeConstraintConcept()));
7540 NewTemplateArgs.setLAngleLoc(TL.getLAngleLoc());
7541 NewTemplateArgs.setRAngleLoc(TL.getRAngleLoc());
7543 if (getDerived().TransformTemplateArguments(
7544 ArgIterator(TL, 0), ArgIterator(TL, TL.getNumArgs()),
7548 if (TL.getNestedNameSpecifierLoc()) {
7550 = getDerived().TransformNestedNameSpecifierLoc(
7551 TL.getNestedNameSpecifierLoc());
7552 if (!NewNestedNameSpec)
7558 if (getDerived().AlwaysRebuild() || NewDeduced != OldDeduced ||
7559 T->isDependentType() ||
T->isConstrained()) {
7562 NewArgList.reserve(NewTemplateArgs.size());
7563 for (
const auto &ArgLoc : NewTemplateArgs.arguments())
7564 NewArgList.push_back(ArgLoc.getArgument());
7565 Result = getDerived().RebuildAutoType(NewDeduced,
T->getKeyword(), NewCD,
7573 NewTL.setRParenLoc(TL.getRParenLoc());
7574 NewTL.setConceptReference(
nullptr);
7576 if (
T->isConstrained()) {
7578 TL.getTypePtr()->getTypeConstraintConcept()->getDeclName(),
7579 TL.getConceptNameLoc(),
7580 TL.getTypePtr()->getTypeConstraintConcept()->getDeclName());
7582 SemaRef.
Context, NewNestedNameSpec, TL.getTemplateKWLoc(), DNI,
7583 TL.getFoundDecl(), TL.getTypePtr()->getTypeConstraintConcept(),
7585 NewTL.setConceptReference(CR);
7591template <
typename Derived>
7594 return getDerived().TransformTemplateSpecializationType(
7599template <
typename Derived>
7602 NamedDecl *FirstQualifierInScope,
bool AllowInjectedClassName) {
7603 const TemplateSpecializationType *
T = TL.
getTypePtr();
7609 AllowInjectedClassName);
7618 if (getDerived().TransformTemplateArguments(ArgIterator(TL, 0),
7627 QualType Result = getDerived().RebuildTemplateSpecializationType(
7640template <
typename Derived>
7644 QualType modifiedType = getDerived().TransformType(TLB, TL.getModifiedLoc());
7645 if (modifiedType.isNull())
7649 const Attr *oldAttr = TL.getAttr();
7650 const Attr *newAttr = oldAttr ? getDerived().TransformAttr(oldAttr) :
nullptr;
7651 if (oldAttr && !newAttr)
7657 if (getDerived().AlwaysRebuild() ||
7658 modifiedType != oldType->getModifiedType()) {
7671 QualType equivalentType = modifiedType;
7672 if (TL.getModifiedLoc().getType() != TL.getEquivalentTypeLoc().getType()) {
7674 AuxiliaryTLB.
reserve(TL.getFullDataSize());
7676 getDerived().TransformType(AuxiliaryTLB, TL.getEquivalentTypeLoc());
7677 if (equivalentType.isNull())
7683 if (
auto nullability = oldType->getImmediateNullability()) {
7684 if (!modifiedType->canHaveNullability()) {
7685 SemaRef.
Diag((TL.getAttr() ? TL.getAttr()->getLocation()
7686 : TL.getModifiedLoc().getBeginLoc()),
7687 diag::err_nullability_nonpointer)
7704template <
typename Derived>
7708 QualType InnerTy = getDerived().TransformType(TLB, TL.getInnerLoc());
7709 if (InnerTy.isNull())
7712 Expr *OldCount = TL.getCountExpr();
7713 Expr *NewCount =
nullptr;
7715 ExprResult CountResult = getDerived().TransformExpr(OldCount);
7716 if (CountResult.isInvalid())
7718 NewCount = CountResult.get();
7722 if (getDerived().AlwaysRebuild() || InnerTy != OldTy->desugar() ||
7723 OldCount != NewCount) {
7726 InnerTy, NewCount, OldTy->isCountInBytes(), OldTy->isOrNull());
7733template <
typename Derived>
7737 llvm_unreachable(
"Unexpected TreeTransform for BTFTagAttributedType");
7740template <
typename Derived>
7744 const HLSLAttributedResourceType *oldType = TL.getTypePtr();
7746 QualType WrappedTy = getDerived().TransformType(TLB, TL.getWrappedLoc());
7747 if (WrappedTy.isNull())
7751 QualType OldContainedTy = oldType->getContainedType();
7752 if (!OldContainedTy.isNull()) {
7753 TypeSourceInfo *oldContainedTSI = TL.getContainedTypeSourceInfo();
7754 if (!oldContainedTSI)
7755 oldContainedTSI = getSema().getASTContext().getTrivialTypeSourceInfo(
7757 TypeSourceInfo *ContainedTSI = getDerived().TransformType(oldContainedTSI);
7760 ContainedTy = ContainedTSI->getType();
7764 if (getDerived().AlwaysRebuild() || WrappedTy != oldType->getWrappedType() ||
7765 ContainedTy != oldType->getContainedType()) {
7767 WrappedTy, ContainedTy, oldType->getAttrs());
7774template <
typename Derived>
7778 return TL.getType();
7781template<
typename Derived>
7785 QualType Inner = getDerived().TransformType(TLB, TL.getInnerLoc());
7790 if (getDerived().AlwaysRebuild() ||
7791 Inner != TL.getInnerLoc().getType()) {
7792 Result = getDerived().RebuildParenType(Inner);
7799 NewTL.setRParenLoc(TL.getRParenLoc());
7803template <
typename Derived>
7807 QualType Inner = getDerived().TransformType(TLB, TL.getInnerLoc());
7812 if (getDerived().AlwaysRebuild() || Inner != TL.getInnerLoc().getType()) {
7814 getDerived().RebuildMacroQualifiedType(Inner, TL.getMacroIdentifier());
7824template<
typename Derived>
7825QualType TreeTransform<Derived>::TransformDependentNameType(
7827 return TransformDependentNameType(TLB, TL,
false);
7830template <
typename Derived>
7831QualType TreeTransform<Derived>::TransformDependentNameType(
7834 const DependentNameType *
T = TL.getTypePtr();
7838 QualifierLoc = getDerived().TransformNestedNameSpecifierLoc(
7839 QualifierLoc, ObjectType, UnqualLookup);
7843 assert((ObjectType.isNull() && !UnqualLookup) &&
7844 "must be transformed by TransformNestedNameSpecifierLoc");
7848 = getDerived().RebuildDependentNameType(
T->getKeyword(),
7849 TL.getElaboratedKeywordLoc(),
7860 NewTL.setQualifierLoc(QualifierLoc);
7861 NewTL.setNameLoc(TL.getNameLoc());
7865 NewTL.setTemplateNameLoc(TL.getNameLoc());
7866 NewTL.setQualifierLoc(QualifierLoc);
7869 QualifierLoc, TL.getNameLoc());
7872 NewTL.
set(TL.getElaboratedKeywordLoc(), QualifierLoc, TL.getNameLoc());
7876 NewTL.setQualifierLoc(QualifierLoc);
7877 NewTL.setNameLoc(TL.getNameLoc());
7882template<
typename Derived>
7886 = getDerived().TransformType(TLB, TL.getPatternLoc());
7887 if (Pattern.isNull())
7891 if (getDerived().AlwaysRebuild() ||
7892 Pattern != TL.getPatternLoc().getType()) {
7893 Result = getDerived().RebuildPackExpansionType(Pattern,
7894 TL.getPatternLoc().getSourceRange(),
7895 TL.getEllipsisLoc(),
7896 TL.getTypePtr()->getNumExpansions());
7906template<
typename Derived>
7911 TLB.pushFullCopy(TL);
7912 return TL.getType();
7915template<
typename Derived>
7919 const ObjCTypeParamType *
T = TL.getTypePtr();
7921 getDerived().TransformDecl(
T->getDecl()->getLocation(),
T->getDecl()));
7926 if (getDerived().AlwaysRebuild() ||
7927 OTP !=
T->getDecl()) {
7928 Result = getDerived().RebuildObjCTypeParamType(
7929 OTP, TL.getProtocolLAngleLoc(),
7930 llvm::ArrayRef(TL.getTypePtr()->qual_begin(), TL.getNumProtocols()),
7931 TL.getProtocolLocs(), TL.getProtocolRAngleLoc());
7937 if (TL.getNumProtocols()) {
7938 NewTL.setProtocolLAngleLoc(TL.getProtocolLAngleLoc());
7939 for (
unsigned i = 0, n = TL.getNumProtocols(); i != n; ++i)
7940 NewTL.setProtocolLoc(i, TL.getProtocolLoc(i));
7941 NewTL.setProtocolRAngleLoc(TL.getProtocolRAngleLoc());
7946template<
typename Derived>
7951 QualType BaseType = getDerived().TransformType(TLB, TL.getBaseLoc());
7952 if (BaseType.isNull())
7955 bool AnyChanged = BaseType != TL.getBaseLoc().getType();
7959 for (
unsigned i = 0, n = TL.getNumTypeArgs(); i != n; ++i) {
7961 TypeLoc TypeArgLoc = TypeArgInfo->getTypeLoc();
7962 QualType TypeArg = TypeArgInfo->getType();
7967 const auto *PackExpansion = PackExpansionLoc.getType()
7968 ->castAs<PackExpansionType>();
7972 assert(!Unexpanded.empty() &&
"Pack expansion without parameter packs?");
7976 TypeLoc PatternLoc = PackExpansionLoc.getPatternLoc();
7977 bool Expand =
false;
7978 bool RetainExpansion =
false;
7979 UnsignedOrNone NumExpansions = PackExpansion->getNumExpansions();
7980 if (getDerived().TryExpandParameterPacks(
7981 PackExpansionLoc.getEllipsisLoc(), PatternLoc.getSourceRange(),
7982 Unexpanded,
true, Expand,
7983 RetainExpansion, NumExpansions))
7993 TypeArgBuilder.
reserve(PatternLoc.getFullDataSize());
7994 QualType NewPatternType = getDerived().TransformType(TypeArgBuilder,
7996 if (NewPatternType.isNull())
8000 NewPatternType, NumExpansions);
8002 NewExpansionLoc.
setEllipsisLoc(PackExpansionLoc.getEllipsisLoc());
8003 NewTypeArgInfos.push_back(
8004 TypeArgBuilder.getTypeSourceInfo(SemaRef.
Context, NewExpansionType));
8010 for (
unsigned ArgIdx = 0; ArgIdx != *NumExpansions; ++ArgIdx) {
8014 TypeArgBuilder.
reserve(PatternLoc.getFullDataSize());
8016 QualType NewTypeArg = getDerived().TransformType(TypeArgBuilder,
8018 if (NewTypeArg.isNull())
8021 NewTypeArgInfos.push_back(
8022 TypeArgBuilder.getTypeSourceInfo(SemaRef.
Context, NewTypeArg));
8029 TypeArgBuilder.
reserve(TypeArgLoc.getFullDataSize());
8031 getDerived().TransformType(TypeArgBuilder, TypeArgLoc);
8032 if (NewTypeArg.isNull())
8036 if (NewTypeArg == TypeArg) {
8037 NewTypeArgInfos.push_back(TypeArgInfo);
8041 NewTypeArgInfos.push_back(
8042 TypeArgBuilder.getTypeSourceInfo(SemaRef.
Context, NewTypeArg));
8047 if (getDerived().AlwaysRebuild() || AnyChanged) {
8049 Result = getDerived().RebuildObjCObjectType(
8050 BaseType, TL.getBeginLoc(), TL.getTypeArgsLAngleLoc(), NewTypeArgInfos,
8051 TL.getTypeArgsRAngleLoc(), TL.getProtocolLAngleLoc(),
8052 llvm::ArrayRef(TL.getTypePtr()->qual_begin(), TL.getNumProtocols()),
8053 TL.getProtocolLocs(), TL.getProtocolRAngleLoc());
8061 NewT.setTypeArgsLAngleLoc(TL.getTypeArgsLAngleLoc());
8062 for (
unsigned i = 0, n = TL.getNumTypeArgs(); i != n; ++i)
8063 NewT.setTypeArgTInfo(i, NewTypeArgInfos[i]);
8064 NewT.setTypeArgsRAngleLoc(TL.getTypeArgsRAngleLoc());
8065 NewT.setProtocolLAngleLoc(TL.getProtocolLAngleLoc());
8066 for (
unsigned i = 0, n = TL.getNumProtocols(); i != n; ++i)
8067 NewT.setProtocolLoc(i, TL.getProtocolLoc(i));
8068 NewT.setProtocolRAngleLoc(TL.getProtocolRAngleLoc());
8072template<
typename Derived>
8076 QualType PointeeType = getDerived().TransformType(TLB, TL.getPointeeLoc());
8077 if (PointeeType.isNull())
8081 if (getDerived().AlwaysRebuild() ||
8082 PointeeType != TL.getPointeeLoc().getType()) {
8083 Result = getDerived().RebuildObjCObjectPointerType(PointeeType,
8097template<
typename Derived>
8103template<
typename Derived>
8106 return getDerived().TransformCompoundStmt(S,
false);
8109template<
typename Derived>
8116 getSema().resetFPOptions(
8119 bool SubStmtInvalid =
false;
8120 bool SubStmtChanged =
false;
8122 for (
auto *B : S->
body()) {
8124 B, IsStmtExpr && B == S->
body_back() ? StmtDiscardKind::StmtExprResult
8125 : StmtDiscardKind::Discarded);
8127 if (
Result.isInvalid()) {
8134 SubStmtInvalid =
true;
8138 SubStmtChanged = SubStmtChanged || Result.get() != B;
8139 Statements.push_back(Result.getAs<Stmt>());
8145 if (!getDerived().AlwaysRebuild() &&
8149 return getDerived().RebuildCompoundStmt(S->
getLBracLoc(),
8155template<
typename Derived>
8164 LHS = getDerived().TransformExpr(S->getLHS());
8166 if (LHS.isInvalid())
8170 RHS = getDerived().TransformExpr(S->getRHS());
8172 if (RHS.isInvalid())
8179 StmtResult Case = getDerived().RebuildCaseStmt(S->getCaseLoc(),
8181 S->getEllipsisLoc(),
8184 if (Case.isInvalid())
8189 getDerived().TransformStmt(S->getSubStmt());
8190 if (SubStmt.isInvalid())
8194 return getDerived().RebuildCaseStmtBody(Case.get(), SubStmt.get());
8197template <
typename Derived>
8201 getDerived().TransformStmt(S->getSubStmt());
8202 if (SubStmt.isInvalid())
8206 return getDerived().RebuildDefaultStmt(S->getDefaultLoc(), S->getColonLoc(),
8210template<
typename Derived>
8213 StmtResult SubStmt = getDerived().TransformStmt(S->getSubStmt(), SDK);
8214 if (SubStmt.isInvalid())
8217 Decl *LD = getDerived().TransformDecl(S->getDecl()->getLocation(),
8225 if (LD == S->getDecl())
8226 S->getDecl()->setStmt(
nullptr);
8229 return getDerived().RebuildLabelStmt(S->getIdentLoc(),
8234template <
typename Derived>
8243 return getDerived().Transform##X##Attr(cast<X##Attr>(R));
8244#include "clang/Basic/AttrList.inc"
8249template <
typename Derived>
8260 return getDerived().TransformStmt##X##Attr(OrigS, InstS, cast<X##Attr>(R));
8261#include "clang/Basic/AttrList.inc"
8266template <
typename Derived>
8269 StmtDiscardKind SDK) {
8274 bool AttrsChanged =
false;
8278 for (
const auto *I : S->
getAttrs()) {
8280 getDerived().TransformStmtAttr(S->
getSubStmt(), SubStmt.
get(), I);
8281 AttrsChanged |= (I != R);
8294 return getDerived().RebuildAttributedStmt(S->
getAttrLoc(), Attrs,
8298template<
typename Derived>
8303 if (
Init.isInvalid())
8307 if (!S->isConsteval()) {
8309 Cond = getDerived().TransformCondition(
8310 S->getIfLoc(), S->getConditionVariable(), S->getCond(),
8313 if (
Cond.isInvalid())
8318 std::optional<bool> ConstexprConditionValue;
8319 if (S->isConstexpr())
8320 ConstexprConditionValue =
Cond.getKnownValue();
8324 if (!ConstexprConditionValue || *ConstexprConditionValue) {
8328 S->isNonNegatedConsteval());
8330 Then = getDerived().TransformStmt(S->getThen());
8331 if (Then.isInvalid())
8337 Then =
new (getSema().Context)
8338 CompoundStmt(S->getThen()->getBeginLoc(), S->getThen()->getEndLoc());
8343 if (!ConstexprConditionValue || !*ConstexprConditionValue) {
8347 S->isNegatedConsteval());
8349 Else = getDerived().TransformStmt(S->getElse());
8350 if (Else.isInvalid())
8352 }
else if (S->getElse() && ConstexprConditionValue &&
8353 *ConstexprConditionValue) {
8357 Else =
new (getSema().Context)
8358 CompoundStmt(S->getElse()->getBeginLoc(), S->getElse()->getEndLoc());
8361 if (!getDerived().AlwaysRebuild() &&
8362 Init.get() == S->getInit() &&
8363 Cond.get() == std::make_pair(S->getConditionVariable(), S->getCond()) &&
8364 Then.get() == S->getThen() &&
8365 Else.get() == S->getElse())
8368 return getDerived().RebuildIfStmt(
8369 S->getIfLoc(), S->getStatementKind(), S->getLParenLoc(),
Cond,
8370 S->getRParenLoc(),
Init.get(), Then.get(), S->getElseLoc(), Else.get());
8373template<
typename Derived>
8378 if (
Init.isInvalid())
8383 S->getSwitchLoc(), S->getConditionVariable(), S->getCond(),
8385 if (
Cond.isInvalid())
8390 getDerived().RebuildSwitchStmtStart(S->getSwitchLoc(), S->getLParenLoc(),
8391 Init.get(),
Cond, S->getRParenLoc());
8396 StmtResult Body = getDerived().TransformStmt(S->getBody());
8397 if (Body.isInvalid())
8401 return getDerived().RebuildSwitchStmtBody(S->getSwitchLoc(),
Switch.get(),
8405template<
typename Derived>
8410 S->getWhileLoc(), S->getConditionVariable(), S->getCond(),
8412 if (
Cond.isInvalid())
8421 StmtResult Body = getDerived().TransformStmt(S->getBody());
8422 if (Body.isInvalid())
8425 if (!getDerived().AlwaysRebuild() &&
8426 Cond.get() == std::make_pair(S->getConditionVariable(), S->getCond()) &&
8427 Body.get() == S->getBody())
8430 return getDerived().RebuildWhileStmt(S->getWhileLoc(), S->getLParenLoc(),
8431 Cond, S->getRParenLoc(), Body.get());
8434template<
typename Derived>
8443 StmtResult Body = getDerived().TransformStmt(S->getBody());
8444 if (Body.isInvalid())
8449 if (
Cond.isInvalid())
8452 if (!getDerived().AlwaysRebuild() &&
8453 Cond.get() == S->getCond() &&
8454 Body.get() == S->getBody())
8457 return getDerived().RebuildDoStmt(S->getDoLoc(), Body.get(), S->getWhileLoc(),
8458 S->getWhileLoc(),
Cond.get(),
8462template<
typename Derived>
8465 if (getSema().getLangOpts().OpenMP)
8466 getSema().OpenMP().startOpenMPLoop();
8470 if (
Init.isInvalid())
8475 if (getSema().getLangOpts().OpenMP &&
Init.isUsable())
8476 getSema().OpenMP().ActOnOpenMPLoopInitialization(S->getForLoc(),
8481 S->getForLoc(), S->getConditionVariable(), S->getCond(),
8483 if (
Cond.isInvalid())
8488 if (
Inc.isInvalid())
8492 if (S->getInc() && !FullInc.get())
8499 S->getBeginLoc(), S->getInit(),
Init.get(), S->getCond(),
8500 Cond.get().second, S->getInc(),
Inc.get());
8503 StmtResult Body = getDerived().TransformStmt(S->getBody());
8504 if (Body.isInvalid())
8509 if (!getDerived().AlwaysRebuild() &&
8510 Init.get() == S->getInit() &&
8511 Cond.get() == std::make_pair(S->getConditionVariable(), S->getCond()) &&
8512 Inc.get() == S->getInc() &&
8513 Body.get() == S->getBody())
8516 return getDerived().RebuildForStmt(S->getForLoc(), S->getLParenLoc(),
8518 S->getRParenLoc(), Body.get());
8521template<
typename Derived>
8524 Decl *LD = getDerived().TransformDecl(S->getLabel()->getLocation(),
8530 return getDerived().RebuildGotoStmt(S->getGotoLoc(), S->getLabelLoc(),
8534template<
typename Derived>
8542 if (!getDerived().AlwaysRebuild() &&
8543 Target.get() == S->getTarget())
8546 return getDerived().RebuildIndirectGotoStmt(S->getGotoLoc(), S->getStarLoc(),
8550template<
typename Derived>
8553 if (!S->hasLabelTarget())
8556 Decl *LD = getDerived().TransformDecl(S->getLabelDecl()->getLocation(),
8565template<
typename Derived>
8568 if (!S->hasLabelTarget())
8571 Decl *LD = getDerived().TransformDecl(S->getLabelDecl()->getLocation(),
8580template <
typename Derived>
8588template<
typename Derived>
8598 return getDerived().RebuildReturnStmt(S->getReturnLoc(),
Result.get());
8601template<
typename Derived>
8604 bool DeclChanged =
false;
8607 for (
auto *D : S->decls()) {
8608 Decl *Transformed = getDerived().TransformDefinition(D->getLocation(), D);
8612 if (Transformed != D)
8616 if (
auto *TD = dyn_cast<TypeDecl>(Transformed)) {
8617 if (
auto *TN = dyn_cast<TypedefNameDecl>(TD)) {
8618 LSI->ContainsUnexpandedParameterPack |=
8619 TN->getUnderlyingType()->containsUnexpandedParameterPack();
8621 LSI->ContainsUnexpandedParameterPack |=
8624 .getTypeDeclType(TD)
8625 ->containsUnexpandedParameterPack();
8628 if (
auto *VD = dyn_cast<VarDecl>(Transformed))
8629 LSI->ContainsUnexpandedParameterPack |=
8630 VD->getType()->containsUnexpandedParameterPack();
8633 Decls.push_back(Transformed);
8636 if (!getDerived().AlwaysRebuild() && !DeclChanged)
8639 return getDerived().RebuildDeclStmt(Decls, S->getBeginLoc(), S->getEndLoc());
8642template<
typename Derived>
8652 bool ExprsChanged =
false;
8654 auto RebuildString = [&](
Expr *E) {
8659 ExprsChanged =
true;
8666 for (
unsigned I = 0, E = S->getNumOutputs(); I != E; ++I) {
8667 Names.push_back(S->getOutputIdentifier(I));
8673 Constraints.push_back(
Result.get());
8676 Expr *OutputExpr = S->getOutputExpr(I);
8677 Result = getDerived().TransformExpr(OutputExpr);
8681 ExprsChanged |=
Result.get() != OutputExpr;
8683 Exprs.push_back(
Result.get());
8687 for (
unsigned I = 0, E = S->getNumInputs(); I != E; ++I) {
8688 Names.push_back(S->getInputIdentifier(I));
8694 Constraints.push_back(
Result.get());
8697 Expr *InputExpr = S->getInputExpr(I);
8698 Result = getDerived().TransformExpr(InputExpr);
8702 ExprsChanged |=
Result.get() != InputExpr;
8704 Exprs.push_back(
Result.get());
8708 for (
unsigned I = 0, E = S->getNumLabels(); I != E; ++I) {
8709 Names.push_back(S->getLabelIdentifier(I));
8714 ExprsChanged |=
Result.get() != S->getLabelExpr(I);
8715 Exprs.push_back(
Result.get());
8719 for (
unsigned I = 0, E = S->getNumClobbers(); I != E; ++I) {
8723 Clobbers.push_back(
Result.get());
8726 ExprResult AsmString = RebuildString(S->getAsmStringExpr());
8727 if (AsmString.isInvalid())
8730 if (!getDerived().AlwaysRebuild() && !ExprsChanged)
8733 return getDerived().RebuildGCCAsmStmt(S->getAsmLoc(), S->isSimple(),
8734 S->isVolatile(), S->getNumOutputs(),
8735 S->getNumInputs(), Names.data(),
8736 Constraints, Exprs, AsmString.get(),
8737 Clobbers, S->getNumLabels(),
8741template<
typename Derived>
8746 bool HadError =
false, HadChange =
false;
8750 TransformedExprs.reserve(SrcExprs.size());
8751 for (
unsigned i = 0, e = SrcExprs.size(); i != e; ++i) {
8753 if (!
Result.isUsable()) {
8756 HadChange |= (
Result.get() != SrcExprs[i]);
8757 TransformedExprs.push_back(
Result.get());
8762 if (!HadChange && !getDerived().AlwaysRebuild())
8765 return getDerived().RebuildMSAsmStmt(S->getAsmLoc(), S->getLBraceLoc(),
8766 AsmToks, S->getAsmString(),
8767 S->getNumOutputs(), S->getNumInputs(),
8768 S->getAllConstraints(), S->getClobbers(),
8769 TransformedExprs, S->getEndLoc());
8773template<
typename Derived>
8778 assert(FD && ScopeInfo && !ScopeInfo->CoroutinePromise &&
8779 ScopeInfo->NeedsCoroutineSuspends &&
8780 ScopeInfo->CoroutineSuspends.first ==
nullptr &&
8781 ScopeInfo->CoroutineSuspends.second ==
nullptr &&
8782 "expected clean scope info");
8786 ScopeInfo->setNeedsCoroutineSuspends(
false);
8799 getDerived().transformedLocalDecl(S->getPromiseDecl(), {Promise});
8800 ScopeInfo->CoroutinePromise = Promise;
8805 StmtResult InitSuspend = getDerived().TransformStmt(S->getInitSuspendStmt());
8806 if (InitSuspend.isInvalid())
8809 getDerived().TransformStmt(S->getFinalSuspendStmt());
8810 if (FinalSuspend.isInvalid() ||
8813 ScopeInfo->setCoroutineSuspends(InitSuspend.get(), FinalSuspend.get());
8816 StmtResult BodyRes = getDerived().TransformStmt(S->getBody());
8817 if (BodyRes.isInvalid())
8821 if (Builder.isInvalid())
8824 Expr *ReturnObject = S->getReturnValueInit();
8825 assert(ReturnObject &&
"the return object is expected to be valid");
8826 ExprResult Res = getDerived().TransformInitializer(ReturnObject,
8828 if (Res.isInvalid())
8830 Builder.ReturnValue = Res.get();
8835 if (S->hasDependentPromiseType()) {
8838 if (!Promise->getType()->isDependentType()) {
8839 assert(!S->getFallthroughHandler() && !S->getExceptionHandler() &&
8840 !S->getReturnStmtOnAllocFailure() && !S->getDeallocate() &&
8841 "these nodes should not have been built yet");
8842 if (!Builder.buildDependentStatements())
8846 if (
auto *OnFallthrough = S->getFallthroughHandler()) {
8847 StmtResult Res = getDerived().TransformStmt(OnFallthrough);
8848 if (Res.isInvalid())
8850 Builder.OnFallthrough = Res.get();
8853 if (
auto *OnException = S->getExceptionHandler()) {
8854 StmtResult Res = getDerived().TransformStmt(OnException);
8855 if (Res.isInvalid())
8857 Builder.OnException = Res.get();
8860 if (
auto *OnAllocFailure = S->getReturnStmtOnAllocFailure()) {
8861 StmtResult Res = getDerived().TransformStmt(OnAllocFailure);
8862 if (Res.isInvalid())
8864 Builder.ReturnStmtOnAllocFailure = Res.get();
8868 assert(S->getAllocate() && S->getDeallocate() &&
8869 "allocation and deallocation calls must already be built");
8870 ExprResult AllocRes = getDerived().TransformExpr(S->getAllocate());
8871 if (AllocRes.isInvalid())
8873 Builder.Allocate = AllocRes.get();
8875 ExprResult DeallocRes = getDerived().TransformExpr(S->getDeallocate());
8876 if (DeallocRes.isInvalid())
8878 Builder.Deallocate = DeallocRes.get();
8880 if (
auto *ResultDecl = S->getResultDecl()) {
8881 StmtResult Res = getDerived().TransformStmt(ResultDecl);
8882 if (Res.isInvalid())
8884 Builder.ResultDecl = Res.get();
8889 if (Res.isInvalid())
8891 Builder.ReturnStmt = Res.get();
8895 return getDerived().RebuildCoroutineBodyStmt(Builder);
8898template<
typename Derived>
8908 return getDerived().RebuildCoreturnStmt(S->getKeywordLoc(),
Result.get(),
8912template <
typename Derived>
8925 ExprResult Lookup = getSema().BuildOperatorCoawaitLookupExpr(
8926 getSema().getCurScope(), E->getKeywordLoc());
8930 return getDerived().RebuildCoawaitExpr(
8931 E->getKeywordLoc(),
Operand.get(),
8935template <
typename Derived>
8938 ExprResult OperandResult = getDerived().TransformInitializer(E->getOperand(),
8940 if (OperandResult.isInvalid())
8944 E->getOperatorCoawaitLookup());
8951 return getDerived().RebuildDependentCoawaitExpr(
8952 E->getKeywordLoc(), OperandResult.get(),
8956template<
typename Derived>
8966 return getDerived().RebuildCoyieldExpr(E->getKeywordLoc(),
Result.get());
8971template<
typename Derived>
8975 StmtResult TryBody = getDerived().TransformStmt(S->getTryBody());
8976 if (TryBody.isInvalid())
8980 bool AnyCatchChanged =
false;
8982 for (
unsigned I = 0, N = S->getNumCatchStmts(); I != N; ++I) {
8983 StmtResult Catch = getDerived().TransformStmt(S->getCatchStmt(I));
8984 if (Catch.isInvalid())
8986 if (Catch.get() != S->getCatchStmt(I))
8987 AnyCatchChanged =
true;
8988 CatchStmts.push_back(Catch.get());
8993 if (S->getFinallyStmt()) {
8994 Finally = getDerived().TransformStmt(S->getFinallyStmt());
8995 if (Finally.isInvalid())
9000 if (!getDerived().AlwaysRebuild() &&
9001 TryBody.get() == S->getTryBody() &&
9003 Finally.get() == S->getFinallyStmt())
9007 return getDerived().RebuildObjCAtTryStmt(S->getAtTryLoc(), TryBody.get(),
9008 CatchStmts, Finally.get());
9011template<
typename Derived>
9016 if (
VarDecl *FromVar = S->getCatchParamDecl()) {
9018 if (FromVar->getTypeSourceInfo()) {
9019 TSInfo = getDerived().TransformType(FromVar->getTypeSourceInfo());
9026 T = TSInfo->getType();
9028 T = getDerived().TransformType(FromVar->getType());
9033 Var = getDerived().RebuildObjCExceptionDecl(FromVar, TSInfo,
T);
9038 StmtResult Body = getDerived().TransformStmt(S->getCatchBody());
9039 if (Body.isInvalid())
9042 return getDerived().RebuildObjCAtCatchStmt(S->getAtCatchLoc(),
9047template<
typename Derived>
9051 StmtResult Body = getDerived().TransformStmt(S->getFinallyBody());
9052 if (Body.isInvalid())
9056 if (!getDerived().AlwaysRebuild() &&
9057 Body.get() == S->getFinallyBody())
9061 return getDerived().RebuildObjCAtFinallyStmt(S->getAtFinallyLoc(),
9065template<
typename Derived>
9069 if (S->getThrowExpr()) {
9070 Operand = getDerived().TransformExpr(S->getThrowExpr());
9075 if (!getDerived().AlwaysRebuild() &&
9076 Operand.get() == S->getThrowExpr())
9079 return getDerived().RebuildObjCAtThrowStmt(S->getThrowLoc(),
Operand.get());
9082template<
typename Derived>
9091 getDerived().RebuildObjCAtSynchronizedOperand(S->getAtSynchronizedLoc(),
9097 StmtResult Body = getDerived().TransformStmt(S->getSynchBody());
9098 if (Body.isInvalid())
9102 if (!getDerived().AlwaysRebuild() &&
9103 Object.get() == S->getSynchExpr() &&
9104 Body.get() == S->getSynchBody())
9108 return getDerived().RebuildObjCAtSynchronizedStmt(S->getAtSynchronizedLoc(),
9109 Object.get(), Body.get());
9112template<
typename Derived>
9117 StmtResult Body = getDerived().TransformStmt(S->getSubStmt());
9118 if (Body.isInvalid())
9122 if (!getDerived().AlwaysRebuild() &&
9123 Body.get() == S->getSubStmt())
9127 return getDerived().RebuildObjCAutoreleasePoolStmt(
9128 S->getAtLoc(), Body.get());
9131template<
typename Derived>
9136 StmtResult Element = getDerived().TransformStmt(
9137 S->getElement(), StmtDiscardKind::NotDiscarded);
9138 if (Element.isInvalid())
9142 ExprResult Collection = getDerived().TransformExpr(S->getCollection());
9143 if (Collection.isInvalid())
9147 StmtResult Body = getDerived().TransformStmt(S->getBody());
9148 if (Body.isInvalid())
9152 if (!getDerived().AlwaysRebuild() &&
9153 Element.get() == S->getElement() &&
9154 Collection.get() == S->getCollection() &&
9155 Body.get() == S->getBody())
9159 return getDerived().RebuildObjCForCollectionStmt(S->getForLoc(),
9166template <
typename Derived>
9170 if (
VarDecl *ExceptionDecl = S->getExceptionDecl()) {
9172 getDerived().TransformType(ExceptionDecl->getTypeSourceInfo());
9176 Var = getDerived().RebuildExceptionDecl(
9177 ExceptionDecl,
T, ExceptionDecl->getInnerLocStart(),
9178 ExceptionDecl->getLocation(), ExceptionDecl->getIdentifier());
9179 if (!Var || Var->isInvalidDecl())
9184 StmtResult Handler = getDerived().TransformStmt(S->getHandlerBlock());
9185 if (Handler.isInvalid())
9188 if (!getDerived().AlwaysRebuild() && !Var &&
9189 Handler.get() == S->getHandlerBlock())
9192 return getDerived().RebuildCXXCatchStmt(S->getCatchLoc(), Var, Handler.get());
9195template <
typename Derived>
9198 StmtResult TryBlock = getDerived().TransformCompoundStmt(S->getTryBlock());
9199 if (TryBlock.isInvalid())
9203 bool HandlerChanged =
false;
9205 for (
unsigned I = 0, N = S->getNumHandlers(); I != N; ++I) {
9206 StmtResult Handler = getDerived().TransformCXXCatchStmt(S->getHandler(I));
9207 if (Handler.isInvalid())
9210 HandlerChanged = HandlerChanged || Handler.get() != S->getHandler(I);
9211 Handlers.push_back(Handler.getAs<
Stmt>());
9214 getSema().DiagnoseExceptionUse(S->getTryLoc(),
true);
9216 if (!getDerived().AlwaysRebuild() && TryBlock.get() == S->getTryBlock() &&
9220 return getDerived().RebuildCXXTryStmt(S->getTryLoc(), TryBlock.get(),
9224template<
typename Derived>
9235 auto &LastRecord = getSema().currentEvaluationContext();
9236 LastRecord.InLifetimeExtendingContext =
true;
9237 LastRecord.RebuildDefaultArgOrDefaultInit =
true;
9240 S->getInit() ? getDerived().TransformStmt(S->getInit()) :
StmtResult();
9241 if (
Init.isInvalid())
9245 if (
Range.isInvalid())
9250 getSema().ExprEvalContexts.back().ForRangeLifetimeExtendTemps.empty());
9251 auto ForRangeLifetimeExtendTemps =
9252 getSema().ExprEvalContexts.back().ForRangeLifetimeExtendTemps;
9254 StmtResult Begin = getDerived().TransformStmt(S->getBeginStmt());
9255 if (Begin.isInvalid())
9257 StmtResult End = getDerived().TransformStmt(S->getEndStmt());
9258 if (End.isInvalid())
9262 if (
Cond.isInvalid())
9266 if (
Cond.isInvalid())
9272 if (
Inc.isInvalid())
9277 StmtResult LoopVar = getDerived().TransformStmt(S->getLoopVarStmt());
9278 if (LoopVar.isInvalid())
9282 if (getDerived().AlwaysRebuild() ||
9283 Init.get() != S->getInit() ||
9284 Range.get() != S->getRangeStmt() ||
9285 Begin.get() != S->getBeginStmt() ||
9286 End.get() != S->getEndStmt() ||
9287 Cond.get() != S->getCond() ||
9288 Inc.get() != S->getInc() ||
9289 LoopVar.get() != S->getLoopVarStmt()) {
9290 NewStmt = getDerived().RebuildCXXForRangeStmt(
9291 S->getForLoc(), S->getCoawaitLoc(),
Init.get(), S->getColonLoc(),
9292 Range.get(), Begin.get(), End.get(),
Cond.get(),
Inc.get(),
9293 LoopVar.get(), S->getRParenLoc(), ForRangeLifetimeExtendTemps);
9294 if (NewStmt.isInvalid() && LoopVar.get() != S->getLoopVarStmt()) {
9296 getSema().ActOnInitializerError(
9307 StmtResult Body = getDerived().TransformStmt(S->getBody());
9308 if (Body.isInvalid())
9315 if (Body.get() != S->getBody() && NewStmt.get() == S) {
9316 NewStmt = getDerived().RebuildCXXForRangeStmt(
9317 S->getForLoc(), S->getCoawaitLoc(),
Init.get(), S->getColonLoc(),
9318 Range.get(), Begin.get(), End.get(),
Cond.get(),
Inc.get(),
9319 LoopVar.get(), S->getRParenLoc(), ForRangeLifetimeExtendTemps);
9320 if (NewStmt.isInvalid())
9324 if (NewStmt.get() == S)
9327 return FinishCXXForRangeStmt(NewStmt.get(), Body.get());
9330template<
typename Derived>
9336 if (S->getQualifierLoc()) {
9338 = getDerived().TransformNestedNameSpecifierLoc(S->getQualifierLoc());
9345 if (NameInfo.getName()) {
9346 NameInfo = getDerived().TransformDeclarationNameInfo(NameInfo);
9347 if (!NameInfo.getName())
9352 if (!getDerived().AlwaysRebuild() &&
9353 QualifierLoc == S->getQualifierLoc() &&
9354 NameInfo.getName() == S->getNameInfo().getName())
9359 SS.
Adopt(QualifierLoc);
9361 switch (getSema().CheckMicrosoftIfExistsSymbol(
nullptr, SS, NameInfo)) {
9363 if (S->isIfExists())
9366 return new (getSema().Context)
NullStmt(S->getKeywordLoc());
9369 if (S->isIfNotExists())
9372 return new (getSema().Context)
NullStmt(S->getKeywordLoc());
9383 StmtResult SubStmt = getDerived().TransformCompoundStmt(S->getSubStmt());
9384 if (SubStmt.isInvalid())
9392 return getDerived().RebuildMSDependentExistsStmt(S->getKeywordLoc(),
9399template<
typename Derived>
9403 if (E->getQualifierLoc()) {
9405 = getDerived().TransformNestedNameSpecifierLoc(E->getQualifierLoc());
9411 getDerived().TransformDecl(E->getMemberLoc(), E->getPropertyDecl()));
9416 if (
Base.isInvalid())
9422 QualifierLoc, E->getMemberLoc());
9425template <
typename Derived>
9429 if (BaseRes.isInvalid())
9431 auto IdxRes = getDerived().TransformExpr(E->getIdx());
9432 if (IdxRes.isInvalid())
9435 if (!getDerived().AlwaysRebuild() &&
9436 BaseRes.get() == E->getBase() &&
9437 IdxRes.get() == E->getIdx())
9440 return getDerived().RebuildArraySubscriptExpr(
9441 BaseRes.get(),
SourceLocation(), IdxRes.get(), E->getRBracketLoc());
9444template <
typename Derived>
9446 StmtResult TryBlock = getDerived().TransformCompoundStmt(S->getTryBlock());
9447 if (TryBlock.isInvalid())
9450 StmtResult Handler = getDerived().TransformSEHHandler(S->getHandler());
9451 if (Handler.isInvalid())
9454 if (!getDerived().AlwaysRebuild() && TryBlock.get() == S->getTryBlock() &&
9455 Handler.get() == S->getHandler())
9458 return getDerived().RebuildSEHTryStmt(S->getIsCXXTry(), S->getTryLoc(),
9459 TryBlock.get(), Handler.get());
9462template <
typename Derived>
9465 if (
Block.isInvalid())
9468 return getDerived().RebuildSEHFinallyStmt(S->getFinallyLoc(),
Block.get());
9471template <
typename Derived>
9473 ExprResult FilterExpr = getDerived().TransformExpr(S->getFilterExpr());
9474 if (FilterExpr.isInvalid())
9478 if (
Block.isInvalid())
9481 return getDerived().RebuildSEHExceptStmt(S->getExceptLoc(), FilterExpr.get(),
9485template <
typename Derived>
9493template<
typename Derived>
9503template <
typename Derived>
9505TreeTransform<Derived>::TransformOMPCanonicalLoop(OMPCanonicalLoop *L) {
9509 return getDerived().TransformStmt(L->getLoopStmt());
9512template <
typename Derived>
9519 TClauses.reserve(Clauses.size());
9523 getDerived().getSema().OpenMP().StartOpenMPClause((*I)->getClauseKind());
9525 getDerived().getSema().OpenMP().EndOpenMPClause();
9527 TClauses.push_back(Clause);
9529 TClauses.push_back(
nullptr);
9533 if (D->hasAssociatedStmt() && D->getAssociatedStmt()) {
9534 getDerived().getSema().OpenMP().ActOnOpenMPRegionStart(
9535 D->getDirectiveKind(),
9541 if (D->getDirectiveKind() == OMPD_atomic ||
9542 D->getDirectiveKind() == OMPD_critical ||
9543 D->getDirectiveKind() == OMPD_section ||
9544 D->getDirectiveKind() == OMPD_master)
9545 CS = D->getAssociatedStmt();
9547 CS = D->getRawStmt();
9550 getSema().getLangOpts().OpenMPIRBuilder)
9554 getDerived().getSema().OpenMP().ActOnOpenMPRegionEnd(Body, TClauses);
9559 if (TClauses.size() != Clauses.size()) {
9565 if (D->getDirectiveKind() == OMPD_critical) {
9567 DirName =
getDerived().TransformDeclarationNameInfo(DirName);
9570 if (D->getDirectiveKind() == OMPD_cancellation_point) {
9572 }
else if (D->getDirectiveKind() == OMPD_cancel) {
9576 return getDerived().RebuildOMPExecutableDirective(
9577 D->getDirectiveKind(), DirName, CancelRegion, TClauses,
9578 AssociatedStmt.
get(), D->getBeginLoc(), D->getEndLoc());
9586template <
typename Derived>
9593 TClauses.reserve(Clauses.size());
9596 getDerived().getSema().OpenMP().StartOpenMPClause(
C->getClauseKind());
9598 getDerived().getSema().OpenMP().EndOpenMPClause();
9600 TClauses.push_back(Clause);
9602 TClauses.push_back(
nullptr);
9606 if (D->hasAssociatedStmt() && D->getAssociatedStmt()) {
9607 getDerived().getSema().OpenMP().ActOnOpenMPRegionStart(
9608 D->getDirectiveKind(),
9613 assert(D->getDirectiveKind() == OMPD_assume &&
9614 "Unexpected informational directive");
9615 Stmt *CS = D->getAssociatedStmt();
9619 getDerived().getSema().OpenMP().ActOnOpenMPRegionEnd(Body, TClauses);
9623 if (TClauses.size() != Clauses.size())
9628 return getDerived().RebuildOMPInformationalDirective(
9629 D->getDirectiveKind(), DirName, TClauses, AssociatedStmt.
get(),
9630 D->getBeginLoc(), D->getEndLoc());
9633template <
typename Derived>
9638 SemaRef.
Diag(D->getBeginLoc(), diag::err_omp_instantiation_not_supported)
9639 << getOpenMPDirectiveName(D->getDirectiveKind(), OMPVersion);
9643template <
typename Derived>
9645TreeTransform<Derived>::TransformOMPParallelDirective(OMPParallelDirective *D) {
9646 DeclarationNameInfo DirName;
9647 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
9648 OMPD_parallel, DirName,
nullptr, D->getBeginLoc());
9649 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
9650 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
9654template <
typename Derived>
9658 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
9659 OMPD_simd, DirName,
nullptr, D->getBeginLoc());
9660 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
9661 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
9665template <
typename Derived>
9669 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
9670 D->getDirectiveKind(), DirName,
nullptr, D->getBeginLoc());
9671 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
9672 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
9676template <
typename Derived>
9680 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
9681 D->getDirectiveKind(), DirName,
nullptr, D->getBeginLoc());
9682 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
9683 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
9687template <
typename Derived>
9691 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
9692 D->getDirectiveKind(), DirName,
nullptr, D->getBeginLoc());
9693 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
9694 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
9698template <
typename Derived>
9702 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
9703 D->getDirectiveKind(), DirName,
nullptr, D->getBeginLoc());
9704 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
9705 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
9709template <
typename Derived>
9711 OMPInterchangeDirective *D) {
9713 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
9714 D->getDirectiveKind(), DirName,
nullptr, D->getBeginLoc());
9715 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
9716 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
9720template <
typename Derived>
9724 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
9725 D->getDirectiveKind(), DirName,
nullptr, D->getBeginLoc());
9726 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
9727 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
9731template <
typename Derived>
9735 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
9736 OMPD_for, DirName,
nullptr, D->getBeginLoc());
9737 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
9738 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
9742template <
typename Derived>
9746 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
9747 OMPD_for_simd, DirName,
nullptr, D->getBeginLoc());
9748 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
9749 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
9753template <
typename Derived>
9757 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
9758 OMPD_sections, DirName,
nullptr, D->getBeginLoc());
9759 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
9760 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
9764template <
typename Derived>
9768 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
9769 OMPD_section, DirName,
nullptr, D->getBeginLoc());
9770 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
9771 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
9775template <
typename Derived>
9779 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
9780 OMPD_scope, DirName,
nullptr, D->getBeginLoc());
9781 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
9782 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
9786template <
typename Derived>
9790 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
9791 OMPD_single, DirName,
nullptr, D->getBeginLoc());
9792 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
9793 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
9797template <
typename Derived>
9801 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
9802 OMPD_master, DirName,
nullptr, D->getBeginLoc());
9803 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
9804 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
9808template <
typename Derived>
9812 OMPD_critical, D->getDirectiveName(),
nullptr, D->getBeginLoc());
9813 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
9814 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
9818template <
typename Derived>
9820 OMPParallelForDirective *D) {
9822 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
9823 OMPD_parallel_for, DirName,
nullptr, D->getBeginLoc());
9824 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
9825 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
9829template <
typename Derived>
9831 OMPParallelForSimdDirective *D) {
9833 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
9834 OMPD_parallel_for_simd, DirName,
nullptr, D->getBeginLoc());
9835 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
9836 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
9840template <
typename Derived>
9842 OMPParallelMasterDirective *D) {
9844 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
9845 OMPD_parallel_master, DirName,
nullptr, D->getBeginLoc());
9846 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
9847 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
9851template <
typename Derived>
9853 OMPParallelMaskedDirective *D) {
9855 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
9856 OMPD_parallel_masked, DirName,
nullptr, D->getBeginLoc());
9857 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
9858 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
9862template <
typename Derived>
9864 OMPParallelSectionsDirective *D) {
9866 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
9867 OMPD_parallel_sections, DirName,
nullptr, D->getBeginLoc());
9868 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
9869 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
9873template <
typename Derived>
9877 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
9878 OMPD_task, DirName,
nullptr, D->getBeginLoc());
9879 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
9880 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
9884template <
typename Derived>
9886 OMPTaskyieldDirective *D) {
9888 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
9889 OMPD_taskyield, DirName,
nullptr, D->getBeginLoc());
9890 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
9891 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
9895template <
typename Derived>
9899 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
9900 OMPD_barrier, DirName,
nullptr, D->getBeginLoc());
9901 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
9902 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
9906template <
typename Derived>
9910 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
9911 OMPD_taskwait, DirName,
nullptr, D->getBeginLoc());
9912 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
9913 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
9917template <
typename Derived>
9921 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
9922 OMPD_assume, DirName,
nullptr, D->getBeginLoc());
9923 StmtResult Res = getDerived().TransformOMPInformationalDirective(D);
9924 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
9928template <
typename Derived>
9932 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
9933 OMPD_error, DirName,
nullptr, D->getBeginLoc());
9934 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
9935 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
9939template <
typename Derived>
9941 OMPTaskgroupDirective *D) {
9943 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
9944 OMPD_taskgroup, DirName,
nullptr, D->getBeginLoc());
9945 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
9946 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
9950template <
typename Derived>
9954 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
9955 OMPD_flush, DirName,
nullptr, D->getBeginLoc());
9956 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
9957 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
9961template <
typename Derived>
9965 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
9966 OMPD_depobj, DirName,
nullptr, D->getBeginLoc());
9967 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
9968 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
9972template <
typename Derived>
9976 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
9977 OMPD_scan, DirName,
nullptr, D->getBeginLoc());
9978 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
9979 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
9983template <
typename Derived>
9987 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
9988 OMPD_ordered, DirName,
nullptr, D->getBeginLoc());
9989 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
9990 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
9994template <
typename Derived>
9998 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
9999 OMPD_atomic, DirName,
nullptr, D->getBeginLoc());
10000 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
10001 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
10005template <
typename Derived>
10009 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
10010 OMPD_target, DirName,
nullptr, D->getBeginLoc());
10011 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
10012 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
10016template <
typename Derived>
10018 OMPTargetDataDirective *D) {
10020 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
10021 OMPD_target_data, DirName,
nullptr, D->getBeginLoc());
10022 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
10023 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
10027template <
typename Derived>
10029 OMPTargetEnterDataDirective *D) {
10031 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
10032 OMPD_target_enter_data, DirName,
nullptr, D->getBeginLoc());
10033 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
10034 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
10038template <
typename Derived>
10040 OMPTargetExitDataDirective *D) {
10042 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
10043 OMPD_target_exit_data, DirName,
nullptr, D->getBeginLoc());
10044 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
10045 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
10049template <
typename Derived>
10051 OMPTargetParallelDirective *D) {
10053 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
10054 OMPD_target_parallel, DirName,
nullptr, D->getBeginLoc());
10055 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
10056 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
10060template <
typename Derived>
10062 OMPTargetParallelForDirective *D) {
10064 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
10065 OMPD_target_parallel_for, DirName,
nullptr, D->getBeginLoc());
10066 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
10067 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
10071template <
typename Derived>
10073 OMPTargetUpdateDirective *D) {
10075 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
10076 OMPD_target_update, DirName,
nullptr, D->getBeginLoc());
10077 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
10078 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
10082template <
typename Derived>
10086 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
10087 OMPD_teams, DirName,
nullptr, D->getBeginLoc());
10088 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
10089 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
10093template <
typename Derived>
10095 OMPCancellationPointDirective *D) {
10097 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
10098 OMPD_cancellation_point, DirName,
nullptr, D->getBeginLoc());
10099 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
10100 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
10104template <
typename Derived>
10108 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
10109 OMPD_cancel, DirName,
nullptr, D->getBeginLoc());
10110 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
10111 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
10115template <
typename Derived>
10119 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
10120 OMPD_taskloop, DirName,
nullptr, D->getBeginLoc());
10121 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
10122 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
10126template <
typename Derived>
10128 OMPTaskLoopSimdDirective *D) {
10130 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
10131 OMPD_taskloop_simd, DirName,
nullptr, D->getBeginLoc());
10132 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
10133 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
10137template <
typename Derived>
10139 OMPMasterTaskLoopDirective *D) {
10141 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
10142 OMPD_master_taskloop, DirName,
nullptr, D->getBeginLoc());
10143 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
10144 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
10148template <
typename Derived>
10150 OMPMaskedTaskLoopDirective *D) {
10152 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
10153 OMPD_masked_taskloop, DirName,
nullptr, D->getBeginLoc());
10154 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
10155 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
10159template <
typename Derived>
10161 OMPMasterTaskLoopSimdDirective *D) {
10163 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
10164 OMPD_master_taskloop_simd, DirName,
nullptr, D->getBeginLoc());
10165 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
10166 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
10170template <
typename Derived>
10172 OMPMaskedTaskLoopSimdDirective *D) {
10174 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
10175 OMPD_masked_taskloop_simd, DirName,
nullptr, D->getBeginLoc());
10176 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
10177 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
10181template <
typename Derived>
10183 OMPParallelMasterTaskLoopDirective *D) {
10185 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
10186 OMPD_parallel_master_taskloop, DirName,
nullptr, D->getBeginLoc());
10187 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
10188 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
10192template <
typename Derived>
10194 OMPParallelMaskedTaskLoopDirective *D) {
10196 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
10197 OMPD_parallel_masked_taskloop, DirName,
nullptr, D->getBeginLoc());
10198 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
10199 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
10203template <
typename Derived>
10206 OMPParallelMasterTaskLoopSimdDirective *D) {
10208 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
10209 OMPD_parallel_master_taskloop_simd, DirName,
nullptr, D->getBeginLoc());
10210 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
10211 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
10215template <
typename Derived>
10218 OMPParallelMaskedTaskLoopSimdDirective *D) {
10220 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
10221 OMPD_parallel_masked_taskloop_simd, DirName,
nullptr, D->getBeginLoc());
10222 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
10223 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
10227template <
typename Derived>
10229 OMPDistributeDirective *D) {
10231 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
10232 OMPD_distribute, DirName,
nullptr, D->getBeginLoc());
10233 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
10234 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
10238template <
typename Derived>
10240 OMPDistributeParallelForDirective *D) {
10242 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
10243 OMPD_distribute_parallel_for, DirName,
nullptr, D->getBeginLoc());
10244 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
10245 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
10249template <
typename Derived>
10252 OMPDistributeParallelForSimdDirective *D) {
10254 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
10255 OMPD_distribute_parallel_for_simd, DirName,
nullptr, D->getBeginLoc());
10256 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
10257 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
10261template <
typename Derived>
10263 OMPDistributeSimdDirective *D) {
10265 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
10266 OMPD_distribute_simd, DirName,
nullptr, D->getBeginLoc());
10267 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
10268 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
10272template <
typename Derived>
10274 OMPTargetParallelForSimdDirective *D) {
10276 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
10277 OMPD_target_parallel_for_simd, DirName,
nullptr, D->getBeginLoc());
10278 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
10279 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
10283template <
typename Derived>
10285 OMPTargetSimdDirective *D) {
10287 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
10288 OMPD_target_simd, DirName,
nullptr, D->getBeginLoc());
10289 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
10290 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
10294template <
typename Derived>
10296 OMPTeamsDistributeDirective *D) {
10298 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
10299 OMPD_teams_distribute, DirName,
nullptr, D->getBeginLoc());
10300 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
10301 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
10305template <
typename Derived>
10307 OMPTeamsDistributeSimdDirective *D) {
10309 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
10310 OMPD_teams_distribute_simd, DirName,
nullptr, D->getBeginLoc());
10311 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
10312 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
10316template <
typename Derived>
10318 OMPTeamsDistributeParallelForSimdDirective *D) {
10320 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
10321 OMPD_teams_distribute_parallel_for_simd, DirName,
nullptr,
10323 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
10324 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
10328template <
typename Derived>
10330 OMPTeamsDistributeParallelForDirective *D) {
10332 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
10333 OMPD_teams_distribute_parallel_for, DirName,
nullptr, D->getBeginLoc());
10334 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
10335 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
10339template <
typename Derived>
10341 OMPTargetTeamsDirective *D) {
10343 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
10344 OMPD_target_teams, DirName,
nullptr, D->getBeginLoc());
10345 auto Res = getDerived().TransformOMPExecutableDirective(D);
10346 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
10350template <
typename Derived>
10352 OMPTargetTeamsDistributeDirective *D) {
10354 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
10355 OMPD_target_teams_distribute, DirName,
nullptr, D->getBeginLoc());
10356 auto Res = getDerived().TransformOMPExecutableDirective(D);
10357 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
10361template <
typename Derived>
10364 OMPTargetTeamsDistributeParallelForDirective *D) {
10366 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
10367 OMPD_target_teams_distribute_parallel_for, DirName,
nullptr,
10369 auto Res = getDerived().TransformOMPExecutableDirective(D);
10370 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
10374template <
typename Derived>
10377 OMPTargetTeamsDistributeParallelForSimdDirective *D) {
10379 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
10380 OMPD_target_teams_distribute_parallel_for_simd, DirName,
nullptr,
10382 auto Res = getDerived().TransformOMPExecutableDirective(D);
10383 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
10387template <
typename Derived>
10390 OMPTargetTeamsDistributeSimdDirective *D) {
10392 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
10393 OMPD_target_teams_distribute_simd, DirName,
nullptr, D->getBeginLoc());
10394 auto Res = getDerived().TransformOMPExecutableDirective(D);
10395 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
10399template <
typename Derived>
10403 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
10404 OMPD_interop, DirName,
nullptr, D->getBeginLoc());
10405 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
10406 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
10410template <
typename Derived>
10414 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
10415 OMPD_dispatch, DirName,
nullptr, D->getBeginLoc());
10416 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
10417 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
10421template <
typename Derived>
10425 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
10426 OMPD_masked, DirName,
nullptr, D->getBeginLoc());
10427 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
10428 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
10432template <
typename Derived>
10434 OMPGenericLoopDirective *D) {
10436 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
10437 OMPD_loop, DirName,
nullptr, D->getBeginLoc());
10438 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
10439 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
10443template <
typename Derived>
10445 OMPTeamsGenericLoopDirective *D) {
10447 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
10448 OMPD_teams_loop, DirName,
nullptr, D->getBeginLoc());
10449 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
10450 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
10454template <
typename Derived>
10456 OMPTargetTeamsGenericLoopDirective *D) {
10458 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
10459 OMPD_target_teams_loop, DirName,
nullptr, D->getBeginLoc());
10460 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
10461 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
10465template <
typename Derived>
10467 OMPParallelGenericLoopDirective *D) {
10469 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
10470 OMPD_parallel_loop, DirName,
nullptr, D->getBeginLoc());
10471 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
10472 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
10476template <
typename Derived>
10479 OMPTargetParallelGenericLoopDirective *D) {
10481 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
10482 OMPD_target_parallel_loop, DirName,
nullptr, D->getBeginLoc());
10483 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
10484 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
10491template <
typename Derived>
10494 if (
Cond.isInvalid())
10496 return getDerived().RebuildOMPIfClause(
10497 C->getNameModifier(),
Cond.get(),
C->getBeginLoc(),
C->getLParenLoc(),
10498 C->getNameModifierLoc(),
C->getColonLoc(),
C->getEndLoc());
10501template <
typename Derived>
10504 if (
Cond.isInvalid())
10506 return getDerived().RebuildOMPFinalClause(
Cond.get(),
C->getBeginLoc(),
10507 C->getLParenLoc(),
C->getEndLoc());
10510template <
typename Derived>
10513 ExprResult NumThreads = getDerived().TransformExpr(
C->getNumThreads());
10514 if (NumThreads.isInvalid())
10516 return getDerived().RebuildOMPNumThreadsClause(
10517 C->getModifier(), NumThreads.get(),
C->getBeginLoc(),
C->getLParenLoc(),
10518 C->getModifierLoc(),
C->getEndLoc());
10521template <
typename Derived>
10524 ExprResult E = getDerived().TransformExpr(
C->getSafelen());
10527 return getDerived().RebuildOMPSafelenClause(
10528 E.get(),
C->getBeginLoc(),
C->getLParenLoc(),
C->getEndLoc());
10531template <
typename Derived>
10534 ExprResult E = getDerived().TransformExpr(
C->getAllocator());
10537 return getDerived().RebuildOMPAllocatorClause(
10538 E.get(),
C->getBeginLoc(),
C->getLParenLoc(),
C->getEndLoc());
10541template <
typename Derived>
10544 ExprResult E = getDerived().TransformExpr(
C->getSimdlen());
10547 return getDerived().RebuildOMPSimdlenClause(
10548 E.get(),
C->getBeginLoc(),
C->getLParenLoc(),
C->getEndLoc());
10551template <
typename Derived>
10554 TransformedSizes.reserve(
C->getNumSizes());
10556 for (
Expr *E :
C->getSizesRefs()) {
10558 TransformedSizes.push_back(
nullptr);
10567 TransformedSizes.push_back(
T.get());
10570 if (!Changed && !getDerived().AlwaysRebuild())
10572 return RebuildOMPSizesClause(TransformedSizes,
C->getBeginLoc(),
10573 C->getLParenLoc(),
C->getEndLoc());
10576template <
typename Derived>
10580 TransformedArgs.reserve(
C->getNumLoops());
10582 for (
Expr *E :
C->getArgsRefs()) {
10584 TransformedArgs.push_back(
nullptr);
10593 TransformedArgs.push_back(
T.get());
10596 if (!Changed && !getDerived().AlwaysRebuild())
10598 return RebuildOMPPermutationClause(TransformedArgs,
C->getBeginLoc(),
10599 C->getLParenLoc(),
C->getEndLoc());
10602template <
typename Derived>
10604 if (!getDerived().AlwaysRebuild())
10606 return RebuildOMPFullClause(
C->getBeginLoc(),
C->getEndLoc());
10609template <
typename Derived>
10612 ExprResult T = getDerived().TransformExpr(
C->getFactor());
10615 Expr *Factor =
T.get();
10616 bool Changed = Factor !=
C->getFactor();
10618 if (!Changed && !getDerived().AlwaysRebuild())
10620 return RebuildOMPPartialClause(Factor,
C->getBeginLoc(),
C->getLParenLoc(),
10624template <
typename Derived>
10627 ExprResult F = getDerived().TransformExpr(
C->getFirst());
10631 ExprResult Cn = getDerived().TransformExpr(
C->getCount());
10632 if (Cn.isInvalid())
10636 Expr *Count = Cn.get();
10638 bool Changed = (
First !=
C->getFirst()) || (Count !=
C->getCount());
10641 if (!Changed && !getDerived().AlwaysRebuild())
10644 return RebuildOMPLoopRangeClause(
First, Count,
C->getBeginLoc(),
10645 C->getLParenLoc(),
C->getFirstLoc(),
10646 C->getCountLoc(),
C->getEndLoc());
10649template <
typename Derived>
10652 ExprResult E = getDerived().TransformExpr(
C->getNumForLoops());
10655 return getDerived().RebuildOMPCollapseClause(
10656 E.get(),
C->getBeginLoc(),
C->getLParenLoc(),
C->getEndLoc());
10659template <
typename Derived>
10663 C->getDefaultKind(),
C->getDefaultKindKwLoc(),
C->getDefaultVC(),
10664 C->getDefaultVCLoc(),
C->getBeginLoc(),
C->getLParenLoc(),
10668template <
typename Derived>
10675template <
typename Derived>
10679 C->getProcBindKind(),
C->getProcBindKindKwLoc(),
C->getBeginLoc(),
10680 C->getLParenLoc(),
C->getEndLoc());
10683template <
typename Derived>
10686 ExprResult E = getDerived().TransformExpr(
C->getChunkSize());
10689 return getDerived().RebuildOMPScheduleClause(
10690 C->getFirstScheduleModifier(),
C->getSecondScheduleModifier(),
10691 C->getScheduleKind(), E.get(),
C->getBeginLoc(),
C->getLParenLoc(),
10692 C->getFirstScheduleModifierLoc(),
C->getSecondScheduleModifierLoc(),
10693 C->getScheduleKindLoc(),
C->getCommaLoc(),
C->getEndLoc());
10696template <
typename Derived>
10700 if (
auto *
Num =
C->getNumForLoops()) {
10701 E = getDerived().TransformExpr(
Num);
10705 return getDerived().RebuildOMPOrderedClause(
C->getBeginLoc(),
C->getEndLoc(),
10706 C->getLParenLoc(), E.get());
10709template <
typename Derived>
10713 if (
Expr *Evt =
C->getEventHandler()) {
10714 E = getDerived().TransformExpr(Evt);
10718 return getDerived().RebuildOMPDetachClause(E.get(),
C->getBeginLoc(),
10719 C->getLParenLoc(),
C->getEndLoc());
10722template <
typename Derived>
10728 if (
Cond.isInvalid())
10731 return getDerived().RebuildOMPNowaitClause(
Cond.get(),
C->getBeginLoc(),
10732 C->getLParenLoc(),
C->getEndLoc());
10735template <
typename Derived>
10742template <
typename Derived>
10749template <
typename Derived>
10755template <
typename Derived>
10761template <
typename Derived>
10768template <
typename Derived>
10775template <
typename Derived>
10782template <
typename Derived>
10788template <
typename Derived>
10794template <
typename Derived>
10796 ExprResult E = getDerived().TransformExpr(
C->getExpr());
10799 return getDerived().RebuildOMPHoldsClause(E.get(),
C->getBeginLoc(),
10800 C->getLParenLoc(),
C->getEndLoc());
10803template <
typename Derived>
10809template <
typename Derived>
10814template <
typename Derived>
10819template <
typename Derived>
10824template <
typename Derived>
10830template <
typename Derived>
10837template <
typename Derived>
10844template <
typename Derived>
10851template <
typename Derived>
10858template <
typename Derived>
10865template <
typename Derived>
10871template <
typename Derived>
10878template <
typename Derived>
10884template <
typename Derived>
10891template <
typename Derived>
10893 ExprResult IVR = getDerived().TransformExpr(
C->getInteropVar());
10894 if (IVR.isInvalid())
10898 InteropInfo.PreferTypes.reserve(
C->varlist_size() - 1);
10899 for (
Expr *E : llvm::drop_begin(
C->varlist())) {
10901 if (ER.isInvalid())
10903 InteropInfo.PreferTypes.push_back(ER.get());
10905 return getDerived().RebuildOMPInitClause(IVR.get(), InteropInfo,
10906 C->getBeginLoc(),
C->getLParenLoc(),
10907 C->getVarLoc(),
C->getEndLoc());
10910template <
typename Derived>
10912 ExprResult ER = getDerived().TransformExpr(
C->getInteropVar());
10913 if (ER.isInvalid())
10915 return getDerived().RebuildOMPUseClause(ER.get(),
C->getBeginLoc(),
10916 C->getLParenLoc(),
C->getVarLoc(),
10920template <
typename Derived>
10924 if (
Expr *IV =
C->getInteropVar()) {
10925 ER = getDerived().TransformExpr(IV);
10926 if (ER.isInvalid())
10929 return getDerived().RebuildOMPDestroyClause(ER.get(),
C->getBeginLoc(),
10930 C->getLParenLoc(),
C->getVarLoc(),
10934template <
typename Derived>
10938 if (
Cond.isInvalid())
10940 return getDerived().RebuildOMPNovariantsClause(
10941 Cond.get(),
C->getBeginLoc(),
C->getLParenLoc(),
C->getEndLoc());
10944template <
typename Derived>
10948 if (
Cond.isInvalid())
10950 return getDerived().RebuildOMPNocontextClause(
10951 Cond.get(),
C->getBeginLoc(),
C->getLParenLoc(),
C->getEndLoc());
10954template <
typename Derived>
10957 ExprResult ThreadID = getDerived().TransformExpr(
C->getThreadID());
10958 if (ThreadID.isInvalid())
10960 return getDerived().RebuildOMPFilterClause(ThreadID.get(),
C->getBeginLoc(),
10961 C->getLParenLoc(),
C->getEndLoc());
10964template <
typename Derived>
10966 ExprResult E = getDerived().TransformExpr(
C->getAlignment());
10969 return getDerived().RebuildOMPAlignClause(E.get(),
C->getBeginLoc(),
10970 C->getLParenLoc(),
C->getEndLoc());
10973template <
typename Derived>
10976 llvm_unreachable(
"unified_address clause cannot appear in dependent context");
10979template <
typename Derived>
10983 "unified_shared_memory clause cannot appear in dependent context");
10986template <
typename Derived>
10989 llvm_unreachable(
"reverse_offload clause cannot appear in dependent context");
10992template <
typename Derived>
10996 "dynamic_allocators clause cannot appear in dependent context");
10999template <
typename Derived>
11003 "atomic_default_mem_order clause cannot appear in dependent context");
11006template <
typename Derived>
11009 llvm_unreachable(
"self_maps clause cannot appear in dependent context");
11012template <
typename Derived>
11015 C->getBeginLoc(),
C->getLParenLoc(),
11019template <
typename Derived>
11023 C->getSeverityKind(),
C->getSeverityKindKwLoc(),
C->getBeginLoc(),
11024 C->getLParenLoc(),
C->getEndLoc());
11027template <
typename Derived>
11030 ExprResult E = getDerived().TransformExpr(
C->getMessageString());
11033 return getDerived().RebuildOMPMessageClause(
11034 E.get(),
C->getBeginLoc(),
C->getLParenLoc(),
C->getEndLoc());
11037template <
typename Derived>
11041 Vars.reserve(
C->varlist_size());
11042 for (
auto *
VE :
C->varlist()) {
11044 if (EVar.isInvalid())
11046 Vars.push_back(EVar.get());
11048 return getDerived().RebuildOMPPrivateClause(
11049 Vars,
C->getBeginLoc(),
C->getLParenLoc(),
C->getEndLoc());
11052template <
typename Derived>
11056 Vars.reserve(
C->varlist_size());
11057 for (
auto *
VE :
C->varlist()) {
11059 if (EVar.isInvalid())
11061 Vars.push_back(EVar.get());
11063 return getDerived().RebuildOMPFirstprivateClause(
11064 Vars,
C->getBeginLoc(),
C->getLParenLoc(),
C->getEndLoc());
11067template <
typename Derived>
11071 Vars.reserve(
C->varlist_size());
11072 for (
auto *
VE :
C->varlist()) {
11074 if (EVar.isInvalid())
11076 Vars.push_back(EVar.get());
11078 return getDerived().RebuildOMPLastprivateClause(
11079 Vars,
C->getKind(),
C->getKindLoc(),
C->getColonLoc(),
C->getBeginLoc(),
11080 C->getLParenLoc(),
C->getEndLoc());
11083template <
typename Derived>
11087 Vars.reserve(
C->varlist_size());
11088 for (
auto *
VE :
C->varlist()) {
11090 if (EVar.isInvalid())
11092 Vars.push_back(EVar.get());
11094 return getDerived().RebuildOMPSharedClause(Vars,
C->getBeginLoc(),
11095 C->getLParenLoc(),
C->getEndLoc());
11098template <
typename Derived>
11102 Vars.reserve(
C->varlist_size());
11103 for (
auto *
VE :
C->varlist()) {
11105 if (EVar.isInvalid())
11107 Vars.push_back(EVar.get());
11110 ReductionIdScopeSpec.
Adopt(
C->getQualifierLoc());
11113 if (NameInfo.getName()) {
11114 NameInfo = getDerived().TransformDeclarationNameInfo(NameInfo);
11115 if (!NameInfo.getName())
11121 for (
auto *E :
C->reduction_ops()) {
11126 for (
auto *D : ULE->decls()) {
11129 Decls.addDecl(InstD, InstD->getAccess());
11133 ReductionIdScopeSpec.getWithLocInContext(SemaRef.
Context), NameInfo,
11134 true, Decls.begin(), Decls.end(),
11137 UnresolvedReductions.push_back(
nullptr);
11139 return getDerived().RebuildOMPReductionClause(
11140 Vars,
C->getModifier(),
C->getOriginalSharingModifier(),
C->getBeginLoc(),
11141 C->getLParenLoc(),
C->getModifierLoc(),
C->getColonLoc(),
C->getEndLoc(),
11142 ReductionIdScopeSpec, NameInfo, UnresolvedReductions);
11145template <
typename Derived>
11149 Vars.reserve(
C->varlist_size());
11150 for (
auto *
VE :
C->varlist()) {
11152 if (EVar.isInvalid())
11154 Vars.push_back(EVar.get());
11157 ReductionIdScopeSpec.
Adopt(
C->getQualifierLoc());
11160 if (NameInfo.getName()) {
11161 NameInfo = getDerived().TransformDeclarationNameInfo(NameInfo);
11162 if (!NameInfo.getName())
11168 for (
auto *E :
C->reduction_ops()) {
11173 for (
auto *D : ULE->decls()) {
11176 Decls.addDecl(InstD, InstD->getAccess());
11180 ReductionIdScopeSpec.getWithLocInContext(SemaRef.
Context), NameInfo,
11181 true, Decls.begin(), Decls.end(),
11184 UnresolvedReductions.push_back(
nullptr);
11186 return getDerived().RebuildOMPTaskReductionClause(
11187 Vars,
C->getBeginLoc(),
C->getLParenLoc(),
C->getColonLoc(),
11188 C->getEndLoc(), ReductionIdScopeSpec, NameInfo, UnresolvedReductions);
11191template <
typename Derived>
11195 Vars.reserve(
C->varlist_size());
11196 for (
auto *
VE :
C->varlist()) {
11198 if (EVar.isInvalid())
11200 Vars.push_back(EVar.get());
11203 ReductionIdScopeSpec.
Adopt(
C->getQualifierLoc());
11206 if (NameInfo.getName()) {
11207 NameInfo = getDerived().TransformDeclarationNameInfo(NameInfo);
11208 if (!NameInfo.getName())
11214 for (
auto *E :
C->reduction_ops()) {
11219 for (
auto *D : ULE->decls()) {
11222 Decls.addDecl(InstD, InstD->getAccess());
11226 ReductionIdScopeSpec.getWithLocInContext(SemaRef.
Context), NameInfo,
11227 true, Decls.begin(), Decls.end(),
11230 UnresolvedReductions.push_back(
nullptr);
11232 return getDerived().RebuildOMPInReductionClause(
11233 Vars,
C->getBeginLoc(),
C->getLParenLoc(),
C->getColonLoc(),
11234 C->getEndLoc(), ReductionIdScopeSpec, NameInfo, UnresolvedReductions);
11237template <
typename Derived>
11241 Vars.reserve(
C->varlist_size());
11242 for (
auto *
VE :
C->varlist()) {
11244 if (EVar.isInvalid())
11246 Vars.push_back(EVar.get());
11248 ExprResult Step = getDerived().TransformExpr(
C->getStep());
11249 if (Step.isInvalid())
11251 return getDerived().RebuildOMPLinearClause(
11252 Vars, Step.get(),
C->getBeginLoc(),
C->getLParenLoc(),
C->getModifier(),
11253 C->getModifierLoc(),
C->getColonLoc(),
C->getStepModifierLoc(),
11257template <
typename Derived>
11261 Vars.reserve(
C->varlist_size());
11262 for (
auto *
VE :
C->varlist()) {
11264 if (EVar.isInvalid())
11266 Vars.push_back(EVar.get());
11268 ExprResult Alignment = getDerived().TransformExpr(
C->getAlignment());
11269 if (Alignment.isInvalid())
11271 return getDerived().RebuildOMPAlignedClause(
11272 Vars, Alignment.get(),
C->getBeginLoc(),
C->getLParenLoc(),
11273 C->getColonLoc(),
C->getEndLoc());
11276template <
typename Derived>
11280 Vars.reserve(
C->varlist_size());
11281 for (
auto *
VE :
C->varlist()) {
11283 if (EVar.isInvalid())
11285 Vars.push_back(EVar.get());
11287 return getDerived().RebuildOMPCopyinClause(Vars,
C->getBeginLoc(),
11288 C->getLParenLoc(),
C->getEndLoc());
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());
11302 return getDerived().RebuildOMPCopyprivateClause(
11303 Vars,
C->getBeginLoc(),
C->getLParenLoc(),
C->getEndLoc());
11306template <
typename Derived>
11309 Vars.reserve(
C->varlist_size());
11310 for (
auto *
VE :
C->varlist()) {
11312 if (EVar.isInvalid())
11314 Vars.push_back(EVar.get());
11316 return getDerived().RebuildOMPFlushClause(Vars,
C->getBeginLoc(),
11317 C->getLParenLoc(),
C->getEndLoc());
11320template <
typename Derived>
11323 ExprResult E = getDerived().TransformExpr(
C->getDepobj());
11326 return getDerived().RebuildOMPDepobjClause(E.get(),
C->getBeginLoc(),
11327 C->getLParenLoc(),
C->getEndLoc());
11330template <
typename Derived>
11334 Expr *DepModifier =
C->getModifier();
11336 ExprResult DepModRes = getDerived().TransformExpr(DepModifier);
11337 if (DepModRes.isInvalid())
11339 DepModifier = DepModRes.get();
11341 Vars.reserve(
C->varlist_size());
11342 for (
auto *
VE :
C->varlist()) {
11344 if (EVar.isInvalid())
11346 Vars.push_back(EVar.get());
11348 return getDerived().RebuildOMPDependClause(
11349 {
C->getDependencyKind(),
C->getDependencyLoc(),
C->getColonLoc(),
11350 C->getOmpAllMemoryLoc()},
11351 DepModifier, Vars,
C->getBeginLoc(),
C->getLParenLoc(),
C->getEndLoc());
11354template <
typename Derived>
11357 ExprResult E = getDerived().TransformExpr(
C->getDevice());
11360 return getDerived().RebuildOMPDeviceClause(
11361 C->getModifier(), E.get(),
C->getBeginLoc(),
C->getLParenLoc(),
11362 C->getModifierLoc(),
C->getEndLoc());
11365template <
typename Derived,
class T>
11372 Vars.reserve(
C->varlist_size());
11373 for (
auto *
VE :
C->varlist()) {
11377 Vars.push_back(EVar.
get());
11381 if (
C->getMapperQualifierLoc()) {
11382 QualifierLoc = TT.
getDerived().TransformNestedNameSpecifierLoc(
11383 C->getMapperQualifierLoc());
11387 MapperIdScopeSpec.
Adopt(QualifierLoc);
11388 MapperIdInfo =
C->getMapperIdInfo();
11389 if (MapperIdInfo.
getName()) {
11390 MapperIdInfo = TT.
getDerived().TransformDeclarationNameInfo(MapperIdInfo);
11396 for (
auto *E :
C->mapperlists()) {
11401 for (
auto *D : ULE->decls()) {
11404 Decls.addDecl(InstD, InstD->
getAccess());
11409 MapperIdInfo,
true, Decls.begin(), Decls.end(),
11412 UnresolvedMappers.push_back(
nullptr);
11418template <
typename Derived>
11419OMPClause *TreeTransform<Derived>::TransformOMPMapClause(OMPMapClause *
C) {
11420 OMPVarListLocTy Locs(
C->getBeginLoc(),
C->getLParenLoc(),
C->getEndLoc());
11422 Expr *IteratorModifier =
C->getIteratorModifier();
11423 if (IteratorModifier) {
11424 ExprResult MapModRes = getDerived().TransformExpr(IteratorModifier);
11425 if (MapModRes.isInvalid())
11427 IteratorModifier = MapModRes.
get();
11433 *
this,
C, Vars, MapperIdScopeSpec, MapperIdInfo, UnresolvedMappers))
11435 return getDerived().RebuildOMPMapClause(
11436 IteratorModifier,
C->getMapTypeModifiers(),
C->getMapTypeModifiersLoc(),
11437 MapperIdScopeSpec, MapperIdInfo,
C->getMapType(),
C->isImplicitMapType(),
11438 C->getMapLoc(),
C->getColonLoc(), Vars, Locs, UnresolvedMappers);
11441template <
typename Derived>
11444 Expr *Allocator =
C->getAllocator();
11446 ExprResult AllocatorRes = getDerived().TransformExpr(Allocator);
11447 if (AllocatorRes.isInvalid())
11449 Allocator = AllocatorRes.get();
11451 Expr *Alignment =
C->getAlignment();
11453 ExprResult AlignmentRes = getDerived().TransformExpr(Alignment);
11454 if (AlignmentRes.isInvalid())
11456 Alignment = AlignmentRes.get();
11459 Vars.reserve(
C->varlist_size());
11460 for (
auto *
VE :
C->varlist()) {
11462 if (EVar.isInvalid())
11464 Vars.push_back(EVar.get());
11466 return getDerived().RebuildOMPAllocateClause(
11467 Allocator, Alignment,
C->getFirstAllocateModifier(),
11468 C->getFirstAllocateModifierLoc(),
C->getSecondAllocateModifier(),
11469 C->getSecondAllocateModifierLoc(), Vars,
C->getBeginLoc(),
11470 C->getLParenLoc(),
C->getColonLoc(),
C->getEndLoc());
11473template <
typename Derived>
11477 Vars.reserve(
C->varlist_size());
11478 for (
auto *
VE :
C->varlist()) {
11480 if (EVar.isInvalid())
11482 Vars.push_back(EVar.get());
11484 return getDerived().RebuildOMPNumTeamsClause(
11485 Vars,
C->getBeginLoc(),
C->getLParenLoc(),
C->getEndLoc());
11488template <
typename Derived>
11492 Vars.reserve(
C->varlist_size());
11493 for (
auto *
VE :
C->varlist()) {
11495 if (EVar.isInvalid())
11497 Vars.push_back(EVar.get());
11499 return getDerived().RebuildOMPThreadLimitClause(
11500 Vars,
C->getBeginLoc(),
C->getLParenLoc(),
C->getEndLoc());
11503template <
typename Derived>
11506 ExprResult E = getDerived().TransformExpr(
C->getPriority());
11509 return getDerived().RebuildOMPPriorityClause(
11510 E.get(),
C->getBeginLoc(),
C->getLParenLoc(),
C->getEndLoc());
11513template <
typename Derived>
11516 ExprResult E = getDerived().TransformExpr(
C->getGrainsize());
11519 return getDerived().RebuildOMPGrainsizeClause(
11520 C->getModifier(), E.get(),
C->getBeginLoc(),
C->getLParenLoc(),
11521 C->getModifierLoc(),
C->getEndLoc());
11524template <
typename Derived>
11527 ExprResult E = getDerived().TransformExpr(
C->getNumTasks());
11530 return getDerived().RebuildOMPNumTasksClause(
11531 C->getModifier(), E.get(),
C->getBeginLoc(),
C->getLParenLoc(),
11532 C->getModifierLoc(),
C->getEndLoc());
11535template <
typename Derived>
11537 ExprResult E = getDerived().TransformExpr(
C->getHint());
11540 return getDerived().RebuildOMPHintClause(E.get(),
C->getBeginLoc(),
11541 C->getLParenLoc(),
C->getEndLoc());
11544template <
typename Derived>
11547 ExprResult E = getDerived().TransformExpr(
C->getChunkSize());
11550 return getDerived().RebuildOMPDistScheduleClause(
11551 C->getDistScheduleKind(), E.get(),
C->getBeginLoc(),
C->getLParenLoc(),
11552 C->getDistScheduleKindLoc(),
C->getCommaLoc(),
C->getEndLoc());
11555template <
typename Derived>
11561 C->getDefaultmapKind(),
11564 C->getDefaultmapModifierLoc(),
11565 C->getDefaultmapKindLoc(),
11569template <
typename Derived>
11573 Expr *IteratorModifier =
C->getIteratorModifier();
11574 if (IteratorModifier) {
11575 ExprResult MapModRes = getDerived().TransformExpr(IteratorModifier);
11576 if (MapModRes.isInvalid())
11578 IteratorModifier = MapModRes.get();
11584 *
this,
C, Vars, MapperIdScopeSpec, MapperIdInfo, UnresolvedMappers))
11586 return getDerived().RebuildOMPToClause(
11587 C->getMotionModifiers(),
C->getMotionModifiersLoc(), IteratorModifier,
11588 MapperIdScopeSpec, MapperIdInfo,
C->getColonLoc(), Vars, Locs,
11589 UnresolvedMappers);
11592template <
typename Derived>
11596 Expr *IteratorModifier =
C->getIteratorModifier();
11597 if (IteratorModifier) {
11598 ExprResult MapModRes = getDerived().TransformExpr(IteratorModifier);
11599 if (MapModRes.isInvalid())
11601 IteratorModifier = MapModRes.get();
11607 *
this,
C, Vars, MapperIdScopeSpec, MapperIdInfo, UnresolvedMappers))
11609 return getDerived().RebuildOMPFromClause(
11610 C->getMotionModifiers(),
C->getMotionModifiersLoc(), IteratorModifier,
11611 MapperIdScopeSpec, MapperIdInfo,
C->getColonLoc(), Vars, Locs,
11612 UnresolvedMappers);
11615template <
typename Derived>
11619 Vars.reserve(
C->varlist_size());
11620 for (
auto *
VE :
C->varlist()) {
11622 if (EVar.isInvalid())
11624 Vars.push_back(EVar.get());
11627 return getDerived().RebuildOMPUseDevicePtrClause(Vars, Locs);
11630template <
typename Derived>
11634 Vars.reserve(
C->varlist_size());
11635 for (
auto *
VE :
C->varlist()) {
11637 if (EVar.isInvalid())
11639 Vars.push_back(EVar.get());
11642 return getDerived().RebuildOMPUseDeviceAddrClause(Vars, Locs);
11645template <
typename Derived>
11649 Vars.reserve(
C->varlist_size());
11650 for (
auto *
VE :
C->varlist()) {
11652 if (EVar.isInvalid())
11654 Vars.push_back(EVar.get());
11657 return getDerived().RebuildOMPIsDevicePtrClause(Vars, Locs);
11660template <
typename Derived>
11664 Vars.reserve(
C->varlist_size());
11665 for (
auto *
VE :
C->varlist()) {
11667 if (EVar.isInvalid())
11669 Vars.push_back(EVar.get());
11672 return getDerived().RebuildOMPHasDeviceAddrClause(Vars, Locs);
11675template <
typename Derived>
11679 Vars.reserve(
C->varlist_size());
11680 for (
auto *
VE :
C->varlist()) {
11682 if (EVar.isInvalid())
11684 Vars.push_back(EVar.get());
11686 return getDerived().RebuildOMPNontemporalClause(
11687 Vars,
C->getBeginLoc(),
C->getLParenLoc(),
C->getEndLoc());
11690template <
typename Derived>
11694 Vars.reserve(
C->varlist_size());
11695 for (
auto *
VE :
C->varlist()) {
11697 if (EVar.isInvalid())
11699 Vars.push_back(EVar.get());
11701 return getDerived().RebuildOMPInclusiveClause(
11702 Vars,
C->getBeginLoc(),
C->getLParenLoc(),
C->getEndLoc());
11705template <
typename Derived>
11709 Vars.reserve(
C->varlist_size());
11710 for (
auto *
VE :
C->varlist()) {
11712 if (EVar.isInvalid())
11714 Vars.push_back(EVar.get());
11716 return getDerived().RebuildOMPExclusiveClause(
11717 Vars,
C->getBeginLoc(),
C->getLParenLoc(),
C->getEndLoc());
11720template <
typename Derived>
11724 Data.reserve(
C->getNumberOfAllocators());
11725 for (
unsigned I = 0, E =
C->getNumberOfAllocators(); I < E; ++I) {
11727 ExprResult Allocator = getDerived().TransformExpr(D.Allocator);
11728 if (Allocator.isInvalid())
11731 if (
Expr *AT = D.AllocatorTraits) {
11732 AllocatorTraits = getDerived().TransformExpr(AT);
11733 if (AllocatorTraits.isInvalid())
11737 NewD.Allocator = Allocator.get();
11738 NewD.AllocatorTraits = AllocatorTraits.get();
11739 NewD.LParenLoc = D.LParenLoc;
11740 NewD.RParenLoc = D.RParenLoc;
11742 return getDerived().RebuildOMPUsesAllocatorsClause(
11743 Data,
C->getBeginLoc(),
C->getLParenLoc(),
C->getEndLoc());
11746template <
typename Derived>
11750 Locators.reserve(
C->varlist_size());
11752 if (
Expr *Modifier =
C->getModifier()) {
11753 ModifierRes = getDerived().TransformExpr(Modifier);
11754 if (ModifierRes.isInvalid())
11757 for (
Expr *E :
C->varlist()) {
11758 ExprResult Locator = getDerived().TransformExpr(E);
11759 if (Locator.isInvalid())
11761 Locators.push_back(Locator.get());
11763 return getDerived().RebuildOMPAffinityClause(
11764 C->getBeginLoc(),
C->getLParenLoc(),
C->getColonLoc(),
C->getEndLoc(),
11765 ModifierRes.get(), Locators);
11768template <
typename Derived>
11771 C->getKind(),
C->getKindKwLoc(),
C->getBeginLoc(),
C->getLParenLoc(),
11772 C->getEndLoc(),
C->getModifier(),
C->getModifierKwLoc());
11775template <
typename Derived>
11778 C->getBindKind(),
C->getBindKindLoc(),
C->getBeginLoc(),
11779 C->getLParenLoc(),
C->getEndLoc());
11782template <
typename Derived>
11786 if (
Size.isInvalid())
11788 return getDerived().RebuildOMPXDynCGroupMemClause(
11789 Size.get(),
C->getBeginLoc(),
C->getLParenLoc(),
C->getEndLoc());
11792template <
typename Derived>
11796 if (
Size.isInvalid())
11798 return getDerived().RebuildOMPDynGroupprivateClause(
11799 C->getDynGroupprivateModifier(),
C->getDynGroupprivateFallbackModifier(),
11800 Size.get(),
C->getBeginLoc(),
C->getLParenLoc(),
11801 C->getDynGroupprivateModifierLoc(),
11802 C->getDynGroupprivateFallbackModifierLoc(),
C->getEndLoc());
11805template <
typename Derived>
11809 Vars.reserve(
C->varlist_size());
11810 for (
auto *
VE :
C->varlist()) {
11812 if (EVar.isInvalid())
11814 Vars.push_back(EVar.get());
11816 return getDerived().RebuildOMPDoacrossClause(
11817 C->getDependenceType(),
C->getDependenceLoc(),
C->getColonLoc(), Vars,
11818 C->getBeginLoc(),
C->getLParenLoc(),
C->getEndLoc());
11821template <
typename Derived>
11825 for (
auto *A :
C->getAttrs())
11826 NewAttrs.push_back(getDerived().TransformAttr(A));
11827 return getDerived().RebuildOMPXAttributeClause(
11828 NewAttrs,
C->getBeginLoc(),
C->getLParenLoc(),
C->getEndLoc());
11831template <
typename Derived>
11840template <
typename Derived>
11841class OpenACCClauseTransform final
11843 TreeTransform<Derived> &Self;
11844 ArrayRef<const OpenACCClause *> ExistingClauses;
11845 SemaOpenACC::OpenACCParsedClause &ParsedClause;
11846 OpenACCClause *NewClause =
nullptr;
11849 ExprResult Res = Self.TransformExpr(VarRef);
11851 if (!Res.isUsable())
11854 Res = Self.getSema().OpenACC().ActOnVar(ParsedClause.getDirectiveKind(),
11855 ParsedClause.getClauseKind(),
11861 llvm::SmallVector<Expr *> VisitVarList(ArrayRef<Expr *> VarList) {
11862 llvm::SmallVector<Expr *> InstantiatedVarList;
11863 for (Expr *CurVar : VarList) {
11866 if (VarRef.isUsable())
11867 InstantiatedVarList.push_back(VarRef.get());
11870 return InstantiatedVarList;
11874 OpenACCClauseTransform(TreeTransform<Derived> &Self,
11875 ArrayRef<const OpenACCClause *> ExistingClauses,
11876 SemaOpenACC::OpenACCParsedClause &PC)
11877 : Self(Self), ExistingClauses(ExistingClauses), ParsedClause(PC) {}
11879 OpenACCClause *CreatedClause()
const {
return NewClause; }
11881#define VISIT_CLAUSE(CLAUSE_NAME) \
11882 void Visit##CLAUSE_NAME##Clause(const OpenACC##CLAUSE_NAME##Clause &Clause);
11883#include "clang/Basic/OpenACCClauses.def"
11886template <
typename Derived>
11887void OpenACCClauseTransform<Derived>::VisitDefaultClause(
11889 ParsedClause.setDefaultDetails(
C.getDefaultClauseKind());
11892 Self.getSema().getASTContext(), ParsedClause.getDefaultClauseKind(),
11893 ParsedClause.getBeginLoc(), ParsedClause.getLParenLoc(),
11894 ParsedClause.getEndLoc());
11897template <
typename Derived>
11898void OpenACCClauseTransform<Derived>::VisitIfClause(
const OpenACCIfClause &
C) {
11900 assert(
Cond &&
"If constructed with invalid Condition");
11904 if (Res.isInvalid() || !Res.get().second)
11907 ParsedClause.setConditionDetails(Res.get().second);
11910 Self.getSema().getASTContext(), ParsedClause.getBeginLoc(),
11911 ParsedClause.getLParenLoc(), ParsedClause.getConditionExpr(),
11912 ParsedClause.getEndLoc());
11915template <
typename Derived>
11916void OpenACCClauseTransform<Derived>::VisitSelfClause(
11922 for (
Expr *CurVar :
C.getVarList()) {
11925 if (!Res.isUsable())
11928 Res =
Self.getSema().OpenACC().ActOnVar(ParsedClause.getDirectiveKind(),
11929 ParsedClause.getClauseKind(),
11932 if (Res.isUsable())
11933 InstantiatedVarList.push_back(Res.get());
11936 ParsedClause.setVarListDetails(InstantiatedVarList,
11940 Self.getSema().getASTContext(), ParsedClause.getBeginLoc(),
11941 ParsedClause.getLParenLoc(), ParsedClause.getVarList(),
11942 ParsedClause.getEndLoc());
11945 if (
C.hasConditionExpr()) {
11948 Self.TransformCondition(
Cond->getExprLoc(),
nullptr,
Cond,
11951 if (Res.isInvalid() || !Res.get().second)
11954 ParsedClause.setConditionDetails(Res.get().second);
11958 Self.getSema().getASTContext(), ParsedClause.getBeginLoc(),
11959 ParsedClause.getLParenLoc(), ParsedClause.getConditionExpr(),
11960 ParsedClause.getEndLoc());
11964template <
typename Derived>
11965void OpenACCClauseTransform<Derived>::VisitNumGangsClause(
11969 for (
Expr *CurIntExpr :
C.getIntExprs()) {
11972 if (!Res.isUsable())
11977 C.getBeginLoc(), Res.get());
11978 if (!Res.isUsable())
11981 InstantiatedIntExprs.push_back(Res.get());
11984 ParsedClause.setIntExprDetails(InstantiatedIntExprs);
11986 Self.getSema().getASTContext(), ParsedClause.getBeginLoc(),
11987 ParsedClause.getLParenLoc(), ParsedClause.getIntExprs(),
11988 ParsedClause.getEndLoc());
11991template <
typename Derived>
11992void OpenACCClauseTransform<Derived>::VisitPrivateClause(
11997 for (
const auto [RefExpr, InitRecipe] :
11998 llvm::zip(
C.getVarList(),
C.getInitRecipes())) {
12001 if (VarRef.isUsable()) {
12002 InstantiatedVarList.push_back(VarRef.get());
12006 if (InitRecipe.isSet())
12007 InitRecipes.push_back(InitRecipe);
12009 InitRecipes.push_back(
12010 Self.getSema().OpenACC().CreatePrivateInitRecipe(VarRef.get()));
12013 ParsedClause.setVarListDetails(InstantiatedVarList,
12017 Self.getSema().getASTContext(), ParsedClause.getBeginLoc(),
12018 ParsedClause.getLParenLoc(), ParsedClause.getVarList(), InitRecipes,
12019 ParsedClause.getEndLoc());
12022template <
typename Derived>
12023void OpenACCClauseTransform<Derived>::VisitHostClause(
12025 ParsedClause.setVarListDetails(VisitVarList(
C.getVarList()),
12029 Self.getSema().getASTContext(), ParsedClause.getBeginLoc(),
12030 ParsedClause.getLParenLoc(), ParsedClause.getVarList(),
12031 ParsedClause.getEndLoc());
12034template <
typename Derived>
12035void OpenACCClauseTransform<Derived>::VisitDeviceClause(
12037 ParsedClause.setVarListDetails(VisitVarList(
C.getVarList()),
12041 Self.getSema().getASTContext(), ParsedClause.getBeginLoc(),
12042 ParsedClause.getLParenLoc(), ParsedClause.getVarList(),
12043 ParsedClause.getEndLoc());
12046template <
typename Derived>
12047void OpenACCClauseTransform<Derived>::VisitFirstPrivateClause(
12052 for (
const auto [RefExpr, InitRecipe] :
12053 llvm::zip(
C.getVarList(),
C.getInitRecipes())) {
12056 if (VarRef.isUsable()) {
12057 InstantiatedVarList.push_back(VarRef.get());
12061 if (InitRecipe.isSet())
12062 InitRecipes.push_back(InitRecipe);
12064 InitRecipes.push_back(
12065 Self.getSema().OpenACC().CreateFirstPrivateInitRecipe(
12069 ParsedClause.setVarListDetails(InstantiatedVarList,
12073 Self.getSema().getASTContext(), ParsedClause.getBeginLoc(),
12074 ParsedClause.getLParenLoc(), ParsedClause.getVarList(), InitRecipes,
12075 ParsedClause.getEndLoc());
12078template <
typename Derived>
12079void OpenACCClauseTransform<Derived>::VisitNoCreateClause(
12081 ParsedClause.setVarListDetails(VisitVarList(
C.getVarList()),
12085 Self.getSema().getASTContext(), ParsedClause.getBeginLoc(),
12086 ParsedClause.getLParenLoc(), ParsedClause.getVarList(),
12087 ParsedClause.getEndLoc());
12090template <
typename Derived>
12091void OpenACCClauseTransform<Derived>::VisitPresentClause(
12093 ParsedClause.setVarListDetails(VisitVarList(
C.getVarList()),
12097 Self.getSema().getASTContext(), ParsedClause.getBeginLoc(),
12098 ParsedClause.getLParenLoc(), ParsedClause.getVarList(),
12099 ParsedClause.getEndLoc());
12102template <
typename Derived>
12103void OpenACCClauseTransform<Derived>::VisitCopyClause(
12105 ParsedClause.setVarListDetails(VisitVarList(
C.getVarList()),
12106 C.getModifierList());
12109 Self.getSema().getASTContext(), ParsedClause.getClauseKind(),
12110 ParsedClause.getBeginLoc(), ParsedClause.getLParenLoc(),
12111 ParsedClause.getModifierList(), ParsedClause.getVarList(),
12112 ParsedClause.getEndLoc());
12115template <
typename Derived>
12116void OpenACCClauseTransform<Derived>::VisitLinkClause(
12118 llvm_unreachable(
"link clause not valid unless a decl transform");
12121template <
typename Derived>
12122void OpenACCClauseTransform<Derived>::VisitDeviceResidentClause(
12124 llvm_unreachable(
"device_resident clause not valid unless a decl transform");
12126template <
typename Derived>
12127void OpenACCClauseTransform<Derived>::VisitNoHostClause(
12129 llvm_unreachable(
"nohost clause not valid unless a decl transform");
12131template <
typename Derived>
12132void OpenACCClauseTransform<Derived>::VisitBindClause(
12134 llvm_unreachable(
"bind clause not valid unless a decl transform");
12137template <
typename Derived>
12138void OpenACCClauseTransform<Derived>::VisitCopyInClause(
12140 ParsedClause.setVarListDetails(VisitVarList(
C.getVarList()),
12141 C.getModifierList());
12144 Self.getSema().getASTContext(), ParsedClause.getClauseKind(),
12145 ParsedClause.getBeginLoc(), ParsedClause.getLParenLoc(),
12146 ParsedClause.getModifierList(), ParsedClause.getVarList(),
12147 ParsedClause.getEndLoc());
12150template <
typename Derived>
12151void OpenACCClauseTransform<Derived>::VisitCopyOutClause(
12153 ParsedClause.setVarListDetails(VisitVarList(
C.getVarList()),
12154 C.getModifierList());
12157 Self.getSema().getASTContext(), ParsedClause.getClauseKind(),
12158 ParsedClause.getBeginLoc(), ParsedClause.getLParenLoc(),
12159 ParsedClause.getModifierList(), ParsedClause.getVarList(),
12160 ParsedClause.getEndLoc());
12163template <
typename Derived>
12164void OpenACCClauseTransform<Derived>::VisitCreateClause(
12166 ParsedClause.setVarListDetails(VisitVarList(
C.getVarList()),
12167 C.getModifierList());
12170 Self.getSema().getASTContext(), ParsedClause.getClauseKind(),
12171 ParsedClause.getBeginLoc(), ParsedClause.getLParenLoc(),
12172 ParsedClause.getModifierList(), ParsedClause.getVarList(),
12173 ParsedClause.getEndLoc());
12175template <
typename Derived>
12176void OpenACCClauseTransform<Derived>::VisitAttachClause(
12181 llvm::erase_if(VarList, [&](
Expr *E) {
12182 return Self.getSema().OpenACC().CheckVarIsPointerType(
12188 Self.getSema().getASTContext(), ParsedClause.getBeginLoc(),
12189 ParsedClause.getLParenLoc(), ParsedClause.getVarList(),
12190 ParsedClause.getEndLoc());
12193template <
typename Derived>
12194void OpenACCClauseTransform<Derived>::VisitDetachClause(
12199 llvm::erase_if(VarList, [&](
Expr *E) {
12200 return Self.getSema().OpenACC().CheckVarIsPointerType(
12206 Self.getSema().getASTContext(), ParsedClause.getBeginLoc(),
12207 ParsedClause.getLParenLoc(), ParsedClause.getVarList(),
12208 ParsedClause.getEndLoc());
12211template <
typename Derived>
12212void OpenACCClauseTransform<Derived>::VisitDeleteClause(
12214 ParsedClause.setVarListDetails(VisitVarList(
C.getVarList()),
12217 Self.getSema().getASTContext(), ParsedClause.getBeginLoc(),
12218 ParsedClause.getLParenLoc(), ParsedClause.getVarList(),
12219 ParsedClause.getEndLoc());
12222template <
typename Derived>
12223void OpenACCClauseTransform<Derived>::VisitUseDeviceClause(
12225 ParsedClause.setVarListDetails(VisitVarList(
C.getVarList()),
12228 Self.getSema().getASTContext(), ParsedClause.getBeginLoc(),
12229 ParsedClause.getLParenLoc(), ParsedClause.getVarList(),
12230 ParsedClause.getEndLoc());
12233template <
typename Derived>
12234void OpenACCClauseTransform<Derived>::VisitDevicePtrClause(
12239 llvm::erase_if(VarList, [&](
Expr *E) {
12240 return Self.getSema().OpenACC().CheckVarIsPointerType(
12246 Self.getSema().getASTContext(), ParsedClause.getBeginLoc(),
12247 ParsedClause.getLParenLoc(), ParsedClause.getVarList(),
12248 ParsedClause.getEndLoc());
12251template <
typename Derived>
12252void OpenACCClauseTransform<Derived>::VisitNumWorkersClause(
12254 Expr *IntExpr =
const_cast<Expr *
>(
C.getIntExpr());
12255 assert(IntExpr &&
"num_workers clause constructed with invalid int expr");
12258 if (!Res.isUsable())
12263 C.getBeginLoc(), Res.get());
12264 if (!Res.isUsable())
12267 ParsedClause.setIntExprDetails(Res.get());
12269 Self.getSema().getASTContext(), ParsedClause.getBeginLoc(),
12270 ParsedClause.getLParenLoc(), ParsedClause.getIntExprs()[0],
12271 ParsedClause.getEndLoc());
12274template <
typename Derived>
12275void OpenACCClauseTransform<Derived>::VisitDeviceNumClause (
12277 Expr *IntExpr =
const_cast<Expr *
>(
C.getIntExpr());
12278 assert(IntExpr &&
"device_num clause constructed with invalid int expr");
12281 if (!Res.isUsable())
12286 C.getBeginLoc(), Res.get());
12287 if (!Res.isUsable())
12290 ParsedClause.setIntExprDetails(Res.get());
12292 Self.getSema().getASTContext(), ParsedClause.getBeginLoc(),
12293 ParsedClause.getLParenLoc(), ParsedClause.getIntExprs()[0],
12294 ParsedClause.getEndLoc());
12297template <
typename Derived>
12298void OpenACCClauseTransform<Derived>::VisitDefaultAsyncClause(
12300 Expr *IntExpr =
const_cast<Expr *
>(
C.getIntExpr());
12301 assert(IntExpr &&
"default_async clause constructed with invalid int expr");
12304 if (!Res.isUsable())
12309 C.getBeginLoc(), Res.get());
12310 if (!Res.isUsable())
12313 ParsedClause.setIntExprDetails(Res.get());
12315 Self.getSema().getASTContext(), ParsedClause.getBeginLoc(),
12316 ParsedClause.getLParenLoc(), ParsedClause.getIntExprs()[0],
12317 ParsedClause.getEndLoc());
12320template <
typename Derived>
12321void OpenACCClauseTransform<Derived>::VisitVectorLengthClause(
12323 Expr *IntExpr =
const_cast<Expr *
>(
C.getIntExpr());
12324 assert(IntExpr &&
"vector_length clause constructed with invalid int expr");
12327 if (!Res.isUsable())
12332 C.getBeginLoc(), Res.get());
12333 if (!Res.isUsable())
12336 ParsedClause.setIntExprDetails(Res.get());
12338 Self.getSema().getASTContext(), ParsedClause.getBeginLoc(),
12339 ParsedClause.getLParenLoc(), ParsedClause.getIntExprs()[0],
12340 ParsedClause.getEndLoc());
12343template <
typename Derived>
12344void OpenACCClauseTransform<Derived>::VisitAsyncClause(
12346 if (
C.hasIntExpr()) {
12348 if (!Res.isUsable())
12353 C.getBeginLoc(), Res.get());
12354 if (!Res.isUsable())
12356 ParsedClause.setIntExprDetails(Res.get());
12360 Self.getSema().getASTContext(), ParsedClause.getBeginLoc(),
12361 ParsedClause.getLParenLoc(),
12362 ParsedClause.getNumIntExprs() != 0 ? ParsedClause.getIntExprs()[0]
12364 ParsedClause.getEndLoc());
12367template <
typename Derived>
12368void OpenACCClauseTransform<Derived>::VisitWorkerClause(
12370 if (
C.hasIntExpr()) {
12375 if (!Res.isUsable())
12380 C.getBeginLoc(), Res.get());
12381 if (!Res.isUsable())
12383 ParsedClause.setIntExprDetails(Res.get());
12387 Self.getSema().getASTContext(), ParsedClause.getBeginLoc(),
12388 ParsedClause.getLParenLoc(),
12389 ParsedClause.getNumIntExprs() != 0 ? ParsedClause.getIntExprs()[0]
12391 ParsedClause.getEndLoc());
12394template <
typename Derived>
12395void OpenACCClauseTransform<Derived>::VisitVectorClause(
12397 if (
C.hasIntExpr()) {
12402 if (!Res.isUsable())
12407 C.getBeginLoc(), Res.get());
12408 if (!Res.isUsable())
12410 ParsedClause.setIntExprDetails(Res.get());
12414 Self.getSema().getASTContext(), ParsedClause.getBeginLoc(),
12415 ParsedClause.getLParenLoc(),
12416 ParsedClause.getNumIntExprs() != 0 ? ParsedClause.getIntExprs()[0]
12418 ParsedClause.getEndLoc());
12421template <
typename Derived>
12422void OpenACCClauseTransform<Derived>::VisitWaitClause(
12424 if (
C.hasExprs()) {
12425 Expr *DevNumExpr =
nullptr;
12429 if (
C.getDevNumExpr()) {
12431 if (!Res.isUsable())
12435 C.getBeginLoc(), Res.get());
12436 if (!Res.isUsable())
12439 DevNumExpr = Res.get();
12443 for (
Expr *CurQueueIdExpr :
C.getQueueIdExprs()) {
12445 if (!Res.isUsable())
12449 C.getBeginLoc(), Res.get());
12450 if (!Res.isUsable())
12453 InstantiatedQueueIdExprs.push_back(Res.get());
12456 ParsedClause.setWaitDetails(DevNumExpr,
C.getQueuesLoc(),
12457 std::move(InstantiatedQueueIdExprs));
12461 Self.getSema().getASTContext(), ParsedClause.getBeginLoc(),
12462 ParsedClause.getLParenLoc(), ParsedClause.getDevNumExpr(),
12463 ParsedClause.getQueuesLoc(), ParsedClause.getQueueIdExprs(),
12464 ParsedClause.getEndLoc());
12467template <
typename Derived>
12468void OpenACCClauseTransform<Derived>::VisitDeviceTypeClause(
12472 Self.getSema().getASTContext(),
C.getClauseKind(),
12473 ParsedClause.getBeginLoc(), ParsedClause.getLParenLoc(),
12474 C.getArchitectures(), ParsedClause.getEndLoc());
12477template <
typename Derived>
12478void OpenACCClauseTransform<Derived>::VisitAutoClause(
12482 ParsedClause.getBeginLoc(),
12483 ParsedClause.getEndLoc());
12486template <
typename Derived>
12487void OpenACCClauseTransform<Derived>::VisitIndependentClause(
12490 ParsedClause.getBeginLoc(),
12491 ParsedClause.getEndLoc());
12494template <
typename Derived>
12495void OpenACCClauseTransform<Derived>::VisitSeqClause(
12498 ParsedClause.getBeginLoc(),
12499 ParsedClause.getEndLoc());
12501template <
typename Derived>
12502void OpenACCClauseTransform<Derived>::VisitFinalizeClause(
12505 ParsedClause.getBeginLoc(),
12506 ParsedClause.getEndLoc());
12509template <
typename Derived>
12510void OpenACCClauseTransform<Derived>::VisitIfPresentClause(
12513 ParsedClause.getBeginLoc(),
12514 ParsedClause.getEndLoc());
12517template <
typename Derived>
12518void OpenACCClauseTransform<Derived>::VisitReductionClause(
12524 for (
const auto [Var, OrigRecipe] :
12525 llvm::zip(TransformedVars,
C.getRecipes())) {
12527 ParsedClause.getDirectiveKind(),
C.getReductionOp(), Var);
12528 if (Res.isUsable()) {
12529 ValidVars.push_back(Res.get());
12531 if (OrigRecipe.isSet())
12532 Recipes.emplace_back(OrigRecipe.AllocaDecl, OrigRecipe.CombinerRecipes);
12534 Recipes.push_back(
Self.getSema().OpenACC().CreateReductionInitRecipe(
12535 C.getReductionOp(), Res.get()));
12539 NewClause =
Self.getSema().OpenACC().CheckReductionClause(
12540 ExistingClauses, ParsedClause.getDirectiveKind(),
12541 ParsedClause.getBeginLoc(), ParsedClause.getLParenLoc(),
12542 C.getReductionOp(), ValidVars, Recipes, ParsedClause.getEndLoc());
12545template <
typename Derived>
12546void OpenACCClauseTransform<Derived>::VisitCollapseClause(
12548 Expr *LoopCount =
const_cast<Expr *
>(
C.getLoopCount());
12549 assert(LoopCount &&
"collapse clause constructed with invalid loop count");
12553 NewLoopCount =
Self.getSema().OpenACC().ActOnIntExpr(
12555 NewLoopCount.get()->getBeginLoc(), NewLoopCount.get());
12558 Self.getSema().OpenACC().CheckCollapseLoopCount(NewLoopCount.get());
12560 ParsedClause.setCollapseDetails(
C.hasForce(), NewLoopCount.get());
12562 Self.getSema().getASTContext(), ParsedClause.getBeginLoc(),
12563 ParsedClause.getLParenLoc(), ParsedClause.isForce(),
12564 ParsedClause.getLoopCount(), ParsedClause.getEndLoc());
12567template <
typename Derived>
12568void OpenACCClauseTransform<Derived>::VisitTileClause(
12573 for (
Expr *E :
C.getSizeExprs()) {
12576 if (!NewSizeExpr.isUsable())
12579 NewSizeExpr =
Self.getSema().OpenACC().ActOnIntExpr(
12581 NewSizeExpr.get()->getBeginLoc(), NewSizeExpr.get());
12583 NewSizeExpr =
Self.getSema().OpenACC().CheckTileSizeExpr(NewSizeExpr.get());
12585 if (!NewSizeExpr.isUsable())
12587 TransformedExprs.push_back(NewSizeExpr.get());
12590 ParsedClause.setIntExprDetails(TransformedExprs);
12592 Self.getSema().getASTContext(), ParsedClause.getBeginLoc(),
12593 ParsedClause.getLParenLoc(), ParsedClause.getIntExprs(),
12594 ParsedClause.getEndLoc());
12596template <
typename Derived>
12597void OpenACCClauseTransform<Derived>::VisitGangClause(
12602 for (
unsigned I = 0; I <
C.getNumExprs(); ++I) {
12604 if (!ER.isUsable())
12607 ER =
Self.getSema().OpenACC().CheckGangExpr(ExistingClauses,
12608 ParsedClause.getDirectiveKind(),
12609 C.getExpr(I).first, ER.get());
12610 if (!ER.isUsable())
12612 TransformedGangKinds.push_back(
C.getExpr(I).first);
12613 TransformedIntExprs.push_back(ER.get());
12616 NewClause =
Self.getSema().OpenACC().CheckGangClause(
12617 ParsedClause.getDirectiveKind(), ExistingClauses,
12618 ParsedClause.getBeginLoc(), ParsedClause.getLParenLoc(),
12619 TransformedGangKinds, TransformedIntExprs, ParsedClause.getEndLoc());
12622template <
typename Derived>
12623OpenACCClause *TreeTransform<Derived>::TransformOpenACCClause(
12628 DirKind, OldClause->getClauseKind(), OldClause->getBeginLoc());
12629 ParsedClause.setEndLoc(OldClause->getEndLoc());
12631 if (
const auto *WithParms = dyn_cast<OpenACCClauseWithParams>(OldClause))
12632 ParsedClause.setLParenLoc(WithParms->getLParenLoc());
12634 OpenACCClauseTransform<Derived> Transform{*
this, ExistingClauses,
12636 Transform.Visit(OldClause);
12638 return Transform.CreatedClause();
12641template <
typename Derived>
12643TreeTransform<Derived>::TransformOpenACCClauseList(
12646 for (
const auto *Clause : OldClauses) {
12647 if (
OpenACCClause *TransformedClause = getDerived().TransformOpenACCClause(
12648 TransformedClauses, DirKind, Clause))
12649 TransformedClauses.push_back(TransformedClause);
12651 return TransformedClauses;
12654template <
typename Derived>
12657 getSema().OpenACC().ActOnConstruct(
C->getDirectiveKind(),
C->getBeginLoc());
12660 getDerived().TransformOpenACCClauseList(
C->getDirectiveKind(),
12663 if (getSema().OpenACC().ActOnStartStmtDirective(
12664 C->getDirectiveKind(),
C->getBeginLoc(), TransformedClauses))
12669 getSema().OpenACC(),
C->getDirectiveKind(),
C->getDirectiveLoc(),
12670 C->clauses(), TransformedClauses);
12671 StmtResult StrBlock = getDerived().TransformStmt(
C->getStructuredBlock());
12672 StrBlock = getSema().OpenACC().ActOnAssociatedStmt(
12673 C->getBeginLoc(),
C->getDirectiveKind(), TransformedClauses, StrBlock);
12675 return getDerived().RebuildOpenACCComputeConstruct(
12676 C->getDirectiveKind(),
C->getBeginLoc(),
C->getDirectiveLoc(),
12677 C->getEndLoc(), TransformedClauses, StrBlock);
12680template <
typename Derived>
12684 getSema().OpenACC().ActOnConstruct(
C->getDirectiveKind(),
C->getBeginLoc());
12687 getDerived().TransformOpenACCClauseList(
C->getDirectiveKind(),
12690 if (getSema().OpenACC().ActOnStartStmtDirective(
12691 C->getDirectiveKind(),
C->getBeginLoc(), TransformedClauses))
12696 getSema().OpenACC(),
C->getDirectiveKind(),
C->getDirectiveLoc(),
12697 C->clauses(), TransformedClauses);
12699 Loop = getSema().OpenACC().ActOnAssociatedStmt(
12700 C->getBeginLoc(),
C->getDirectiveKind(), TransformedClauses,
Loop);
12702 return getDerived().RebuildOpenACCLoopConstruct(
12703 C->getBeginLoc(),
C->getDirectiveLoc(),
C->getEndLoc(),
12704 TransformedClauses,
Loop);
12707template <
typename Derived>
12709 OpenACCCombinedConstruct *
C) {
12710 getSema().OpenACC().ActOnConstruct(
C->getDirectiveKind(),
C->getBeginLoc());
12713 getDerived().TransformOpenACCClauseList(
C->getDirectiveKind(),
12716 if (getSema().OpenACC().ActOnStartStmtDirective(
12717 C->getDirectiveKind(),
C->getBeginLoc(), TransformedClauses))
12722 getSema().OpenACC(),
C->getDirectiveKind(),
C->getDirectiveLoc(),
12723 C->clauses(), TransformedClauses);
12725 Loop = getSema().OpenACC().ActOnAssociatedStmt(
12726 C->getBeginLoc(),
C->getDirectiveKind(), TransformedClauses,
Loop);
12728 return getDerived().RebuildOpenACCCombinedConstruct(
12729 C->getDirectiveKind(),
C->getBeginLoc(),
C->getDirectiveLoc(),
12730 C->getEndLoc(), TransformedClauses,
Loop);
12733template <
typename Derived>
12736 getSema().OpenACC().ActOnConstruct(
C->getDirectiveKind(),
C->getBeginLoc());
12739 getDerived().TransformOpenACCClauseList(
C->getDirectiveKind(),
12741 if (getSema().OpenACC().ActOnStartStmtDirective(
12742 C->getDirectiveKind(),
C->getBeginLoc(), TransformedClauses))
12746 getSema().OpenACC(),
C->getDirectiveKind(),
C->getDirectiveLoc(),
12747 C->clauses(), TransformedClauses);
12748 StmtResult StrBlock = getDerived().TransformStmt(
C->getStructuredBlock());
12749 StrBlock = getSema().OpenACC().ActOnAssociatedStmt(
12750 C->getBeginLoc(),
C->getDirectiveKind(), TransformedClauses, StrBlock);
12752 return getDerived().RebuildOpenACCDataConstruct(
12753 C->getBeginLoc(),
C->getDirectiveLoc(),
C->getEndLoc(),
12754 TransformedClauses, StrBlock);
12757template <
typename Derived>
12759 OpenACCEnterDataConstruct *
C) {
12760 getSema().OpenACC().ActOnConstruct(
C->getDirectiveKind(),
C->getBeginLoc());
12763 getDerived().TransformOpenACCClauseList(
C->getDirectiveKind(),
12765 if (getSema().OpenACC().ActOnStartStmtDirective(
12766 C->getDirectiveKind(),
C->getBeginLoc(), TransformedClauses))
12769 return getDerived().RebuildOpenACCEnterDataConstruct(
12770 C->getBeginLoc(),
C->getDirectiveLoc(),
C->getEndLoc(),
12771 TransformedClauses);
12774template <
typename Derived>
12776 OpenACCExitDataConstruct *
C) {
12777 getSema().OpenACC().ActOnConstruct(
C->getDirectiveKind(),
C->getBeginLoc());
12780 getDerived().TransformOpenACCClauseList(
C->getDirectiveKind(),
12782 if (getSema().OpenACC().ActOnStartStmtDirective(
12783 C->getDirectiveKind(),
C->getBeginLoc(), TransformedClauses))
12786 return getDerived().RebuildOpenACCExitDataConstruct(
12787 C->getBeginLoc(),
C->getDirectiveLoc(),
C->getEndLoc(),
12788 TransformedClauses);
12791template <
typename Derived>
12793 OpenACCHostDataConstruct *
C) {
12794 getSema().OpenACC().ActOnConstruct(
C->getDirectiveKind(),
C->getBeginLoc());
12797 getDerived().TransformOpenACCClauseList(
C->getDirectiveKind(),
12799 if (getSema().OpenACC().ActOnStartStmtDirective(
12800 C->getDirectiveKind(),
C->getBeginLoc(), TransformedClauses))
12804 getSema().OpenACC(),
C->getDirectiveKind(),
C->getDirectiveLoc(),
12805 C->clauses(), TransformedClauses);
12806 StmtResult StrBlock = getDerived().TransformStmt(
C->getStructuredBlock());
12807 StrBlock = getSema().OpenACC().ActOnAssociatedStmt(
12808 C->getBeginLoc(),
C->getDirectiveKind(), TransformedClauses, StrBlock);
12810 return getDerived().RebuildOpenACCHostDataConstruct(
12811 C->getBeginLoc(),
C->getDirectiveLoc(),
C->getEndLoc(),
12812 TransformedClauses, StrBlock);
12815template <
typename Derived>
12818 getSema().OpenACC().ActOnConstruct(
C->getDirectiveKind(),
C->getBeginLoc());
12821 getDerived().TransformOpenACCClauseList(
C->getDirectiveKind(),
12823 if (getSema().OpenACC().ActOnStartStmtDirective(
12824 C->getDirectiveKind(),
C->getBeginLoc(), TransformedClauses))
12827 return getDerived().RebuildOpenACCInitConstruct(
12828 C->getBeginLoc(),
C->getDirectiveLoc(),
C->getEndLoc(),
12829 TransformedClauses);
12832template <
typename Derived>
12834 OpenACCShutdownConstruct *
C) {
12835 getSema().OpenACC().ActOnConstruct(
C->getDirectiveKind(),
C->getBeginLoc());
12838 getDerived().TransformOpenACCClauseList(
C->getDirectiveKind(),
12840 if (getSema().OpenACC().ActOnStartStmtDirective(
12841 C->getDirectiveKind(),
C->getBeginLoc(), TransformedClauses))
12844 return getDerived().RebuildOpenACCShutdownConstruct(
12845 C->getBeginLoc(),
C->getDirectiveLoc(),
C->getEndLoc(),
12846 TransformedClauses);
12848template <
typename Derived>
12851 getSema().OpenACC().ActOnConstruct(
C->getDirectiveKind(),
C->getBeginLoc());
12854 getDerived().TransformOpenACCClauseList(
C->getDirectiveKind(),
12856 if (getSema().OpenACC().ActOnStartStmtDirective(
12857 C->getDirectiveKind(),
C->getBeginLoc(), TransformedClauses))
12860 return getDerived().RebuildOpenACCSetConstruct(
12861 C->getBeginLoc(),
C->getDirectiveLoc(),
C->getEndLoc(),
12862 TransformedClauses);
12865template <
typename Derived>
12867 OpenACCUpdateConstruct *
C) {
12868 getSema().OpenACC().ActOnConstruct(
C->getDirectiveKind(),
C->getBeginLoc());
12871 getDerived().TransformOpenACCClauseList(
C->getDirectiveKind(),
12873 if (getSema().OpenACC().ActOnStartStmtDirective(
12874 C->getDirectiveKind(),
C->getBeginLoc(), TransformedClauses))
12877 return getDerived().RebuildOpenACCUpdateConstruct(
12878 C->getBeginLoc(),
C->getDirectiveLoc(),
C->getEndLoc(),
12879 TransformedClauses);
12882template <
typename Derived>
12885 getSema().OpenACC().ActOnConstruct(
C->getDirectiveKind(),
C->getBeginLoc());
12888 if (
C->hasDevNumExpr()) {
12889 DevNumExpr = getDerived().TransformExpr(
C->getDevNumExpr());
12891 if (DevNumExpr.isUsable())
12892 DevNumExpr = getSema().OpenACC().ActOnIntExpr(
12894 C->getBeginLoc(), DevNumExpr.get());
12899 for (
Expr *QE :
C->getQueueIdExprs()) {
12900 assert(QE &&
"Null queue id expr?");
12901 ExprResult NewEQ = getDerived().TransformExpr(QE);
12903 if (!NewEQ.isUsable())
12907 C->getBeginLoc(), NewEQ.get());
12908 if (NewEQ.isUsable())
12909 QueueIdExprs.push_back(NewEQ.get());
12913 getDerived().TransformOpenACCClauseList(
C->getDirectiveKind(),
12916 if (getSema().OpenACC().ActOnStartStmtDirective(
12917 C->getDirectiveKind(),
C->getBeginLoc(), TransformedClauses))
12920 return getDerived().RebuildOpenACCWaitConstruct(
12921 C->getBeginLoc(),
C->getDirectiveLoc(),
C->getLParenLoc(),
12922 DevNumExpr.isUsable() ? DevNumExpr.get() :
nullptr,
C->getQueuesLoc(),
12923 QueueIdExprs,
C->getRParenLoc(),
C->getEndLoc(), TransformedClauses);
12925template <
typename Derived>
12927 OpenACCCacheConstruct *
C) {
12928 getSema().OpenACC().ActOnConstruct(
C->getDirectiveKind(),
C->getBeginLoc());
12931 for (
Expr *Var :
C->getVarList()) {
12932 assert(Var &&
"Null var listexpr?");
12934 ExprResult NewVar = getDerived().TransformExpr(Var);
12936 if (!NewVar.isUsable())
12939 NewVar = getSema().OpenACC().ActOnVar(
12941 if (!NewVar.isUsable())
12944 TransformedVarList.push_back(NewVar.get());
12947 if (getSema().OpenACC().ActOnStartStmtDirective(
C->getDirectiveKind(),
12948 C->getBeginLoc(), {}))
12951 return getDerived().RebuildOpenACCCacheConstruct(
12952 C->getBeginLoc(),
C->getDirectiveLoc(),
C->getLParenLoc(),
12953 C->getReadOnlyLoc(), TransformedVarList,
C->getRParenLoc(),
12957template <
typename Derived>
12959 OpenACCAtomicConstruct *
C) {
12960 getSema().OpenACC().ActOnConstruct(
C->getDirectiveKind(),
C->getBeginLoc());
12963 getDerived().TransformOpenACCClauseList(
C->getDirectiveKind(),
12966 if (getSema().OpenACC().ActOnStartStmtDirective(
C->getDirectiveKind(),
12967 C->getBeginLoc(), {}))
12972 getSema().OpenACC(),
C->getDirectiveKind(),
C->getDirectiveLoc(), {}, {});
12974 StmtResult AssocStmt = getDerived().TransformStmt(
C->getAssociatedStmt());
12975 AssocStmt = getSema().OpenACC().ActOnAssociatedStmt(
12976 C->getBeginLoc(),
C->getDirectiveKind(),
C->getAtomicKind(), {},
12979 return getDerived().RebuildOpenACCAtomicConstruct(
12980 C->getBeginLoc(),
C->getDirectiveLoc(),
C->getAtomicKind(),
12981 C->getEndLoc(), TransformedClauses, AssocStmt);
12984template <
typename Derived>
12987 if (getDerived().AlwaysRebuild())
12996template<
typename Derived>
12999 return TransformExpr(E->getSubExpr());
13002template <
typename Derived>
13005 if (!E->isTypeDependent())
13008 TypeSourceInfo *NewT = getDerived().TransformType(E->getTypeSourceInfo());
13013 if (!getDerived().AlwaysRebuild() && E->getTypeSourceInfo() == NewT)
13016 return getDerived().RebuildSYCLUniqueStableNameExpr(
13017 E->getLocation(), E->getLParenLocation(), E->getRParenLocation(), NewT);
13020template<
typename Derived>
13023 if (!E->isTypeDependent())
13027 E->getIdentKind());
13030template<
typename Derived>
13034 if (E->getQualifierLoc()) {
13036 = getDerived().TransformNestedNameSpecifierLoc(E->getQualifierLoc());
13042 = cast_or_null<ValueDecl>(getDerived().TransformDecl(E->getLocation(),
13044 if (!ND || ND->isInvalidDecl())
13048 if (E->getFoundDecl() != E->getDecl()) {
13049 Found = cast_or_null<NamedDecl>(
13050 getDerived().TransformDecl(E->getLocation(), E->getFoundDecl()));
13056 if (NameInfo.getName()) {
13057 NameInfo = getDerived().TransformDeclarationNameInfo(NameInfo);
13058 if (!NameInfo.getName())
13062 if (!getDerived().AlwaysRebuild() &&
13063 !E->isCapturedByCopyInLambdaWithExplicitObjectParameter() &&
13064 QualifierLoc == E->getQualifierLoc() && ND == E->getDecl() &&
13065 Found == E->getFoundDecl() &&
13066 NameInfo.getName() == E->getDecl()->getDeclName() &&
13067 !E->hasExplicitTemplateArgs()) {
13077 if (E->hasExplicitTemplateArgs()) {
13078 TemplateArgs = &TransArgs;
13079 TransArgs.setLAngleLoc(E->getLAngleLoc());
13080 TransArgs.setRAngleLoc(E->getRAngleLoc());
13081 if (getDerived().TransformTemplateArguments(E->getTemplateArgs(),
13082 E->getNumTemplateArgs(),
13087 return getDerived().RebuildDeclRefExpr(QualifierLoc, ND, NameInfo,
13088 Found, TemplateArgs);
13091template<
typename Derived>
13097template <
typename Derived>
13103template<
typename Derived>
13109template<
typename Derived>
13115template<
typename Derived>
13121template<
typename Derived>
13127template<
typename Derived>
13130 return getDerived().TransformCallExpr(E);
13133template<
typename Derived>
13138 if (E->isExprPredicate())
13139 ControllingExpr = getDerived().TransformExpr(E->getControllingExpr());
13141 ControllingType = getDerived().TransformType(E->getControllingType());
13143 if (ControllingExpr.isInvalid() && !ControllingType)
13154 AssocTypes.push_back(AssocType);
13156 AssocTypes.push_back(
nullptr);
13160 getDerived().TransformExpr(Assoc.getAssociationExpr());
13161 if (AssocExpr.isInvalid())
13163 AssocExprs.push_back(AssocExpr.get());
13166 if (!ControllingType)
13167 return getDerived().RebuildGenericSelectionExpr(E->getGenericLoc(),
13168 E->getDefaultLoc(),
13170 ControllingExpr.get(),
13173 return getDerived().RebuildGenericSelectionExpr(
13174 E->getGenericLoc(), E->getDefaultLoc(), E->getRParenLoc(),
13175 ControllingType, AssocTypes, AssocExprs);
13178template<
typename Derived>
13181 ExprResult SubExpr = getDerived().TransformExpr(E->getSubExpr());
13182 if (SubExpr.isInvalid())
13185 if (!getDerived().AlwaysRebuild() && SubExpr.get() == E->getSubExpr())
13188 return getDerived().RebuildParenExpr(SubExpr.get(), E->getLParen(),
13195template<
typename Derived>
13199 return getDerived().TransformDependentScopeDeclRefExpr(
13200 DRE,
true,
nullptr);
13202 return getDerived().TransformUnresolvedLookupExpr(
13208template<
typename Derived>
13213 SubExpr = TransformAddressOfOperand(E->
getSubExpr());
13219 if (!getDerived().AlwaysRebuild() && SubExpr.
get() == E->
getSubExpr())
13227template<
typename Derived>
13229TreeTransform<Derived>::TransformOffsetOfExpr(OffsetOfExpr *E) {
13231 TypeSourceInfo *Type = getDerived().TransformType(E->getTypeSourceInfo());
13241 bool ExprChanged =
false;
13242 typedef Sema::OffsetOfComponent Component;
13244 for (
unsigned I = 0, N = E->getNumComponents(); I != N; ++I) {
13245 const OffsetOfNode &ON = E->getComponent(I);
13247 Comp.isBrackets =
true;
13248 Comp.LocStart = ON.getSourceRange().getBegin();
13249 Comp.LocEnd = ON.getSourceRange().getEnd();
13250 switch (ON.getKind()) {
13252 Expr *FromIndex = E->getIndexExpr(ON.getArrayExprIndex());
13253 ExprResult Index = getDerived().TransformExpr(FromIndex);
13254 if (Index.isInvalid())
13257 ExprChanged = ExprChanged || Index.get() != FromIndex;
13258 Comp.isBrackets =
true;
13259 Comp.U.E = Index.get();
13265 Comp.isBrackets =
false;
13266 Comp.U.IdentInfo = ON.getFieldName();
13267 if (!
Comp.U.IdentInfo)
13277 Components.push_back(Comp);
13281 if (!getDerived().AlwaysRebuild() &&
13282 Type == E->getTypeSourceInfo() &&
13287 return getDerived().RebuildOffsetOfExpr(E->getOperatorLoc(),
Type,
13288 Components, E->getRParenLoc());
13291template<
typename Derived>
13294 assert((!E->getSourceExpr() || getDerived().AlreadyTransformed(E->getType())) &&
13295 "opaque value expression requires transformation");
13299template <
typename Derived>
13303 for (
Expr *
C : E->subExpressions()) {
13305 if (NewC.isInvalid())
13311 if (!getDerived().AlwaysRebuild() && !Changed)
13313 return getDerived().RebuildRecoveryExpr(E->getBeginLoc(), E->getEndLoc(),
13317template<
typename Derived>
13327 ExprResult result = getDerived().TransformExpr(newSyntacticForm);
13328 if (result.isInvalid())
return ExprError();
13333 if (result.get()->hasPlaceholderType(BuiltinType::PseudoObject))
13339template<
typename Derived>
13343 if (E->isArgumentType()) {
13350 if (!getDerived().AlwaysRebuild() && OldT == NewT)
13353 return getDerived().RebuildUnaryExprOrTypeTrait(NewT, E->getOperatorLoc(),
13355 E->getSourceRange());
13369 auto *PE = dyn_cast<ParenExpr>(E->getArgumentExpr());
13371 PE ? dyn_cast<DependentScopeDeclRefExpr>(PE->getSubExpr()) :
nullptr)
13372 SubExpr = getDerived().TransformParenDependentScopeDeclRefExpr(
13373 PE, DRE,
false, &RecoveryTSI);
13375 SubExpr = getDerived().TransformExpr(E->getArgumentExpr());
13378 return getDerived().RebuildUnaryExprOrTypeTrait(
13379 RecoveryTSI, E->getOperatorLoc(), E->getKind(), E->getSourceRange());
13380 }
else if (SubExpr.isInvalid())
13383 if (!getDerived().AlwaysRebuild() && SubExpr.get() == E->getArgumentExpr())
13386 return getDerived().RebuildUnaryExprOrTypeTrait(SubExpr.get(),
13387 E->getOperatorLoc(),
13389 E->getSourceRange());
13392template<
typename Derived>
13395 ExprResult LHS = getDerived().TransformExpr(E->getLHS());
13396 if (LHS.isInvalid())
13399 ExprResult RHS = getDerived().TransformExpr(E->getRHS());
13400 if (RHS.isInvalid())
13404 if (!getDerived().AlwaysRebuild() &&
13405 LHS.get() == E->getLHS() &&
13406 RHS.get() == E->getRHS())
13409 return getDerived().RebuildArraySubscriptExpr(
13411 E->getLHS()->getBeginLoc(), RHS.get(), E->getRBracketLoc());
13414template <
typename Derived>
13418 if (
Base.isInvalid())
13421 ExprResult RowIdx = getDerived().TransformExpr(E->getRowIdx());
13422 if (RowIdx.isInvalid())
13425 if (!getDerived().AlwaysRebuild() &&
Base.get() == E->getBase() &&
13426 RowIdx.get() == E->getRowIdx())
13429 return getDerived().RebuildMatrixSingleSubscriptExpr(
Base.get(), RowIdx.get(),
13430 E->getRBracketLoc());
13433template <
typename Derived>
13437 if (
Base.isInvalid())
13440 ExprResult RowIdx = getDerived().TransformExpr(E->getRowIdx());
13441 if (RowIdx.isInvalid())
13444 ExprResult ColumnIdx = getDerived().TransformExpr(E->getColumnIdx());
13445 if (ColumnIdx.isInvalid())
13448 if (!getDerived().AlwaysRebuild() &&
Base.get() == E->getBase() &&
13449 RowIdx.get() == E->getRowIdx() && ColumnIdx.get() == E->getColumnIdx())
13452 return getDerived().RebuildMatrixSubscriptExpr(
13453 Base.get(), RowIdx.get(), ColumnIdx.get(), E->getRBracketLoc());
13456template <
typename Derived>
13460 if (
Base.isInvalid())
13464 if (E->getLowerBound()) {
13465 LowerBound = getDerived().TransformExpr(E->getLowerBound());
13466 if (LowerBound.isInvalid())
13471 if (E->getLength()) {
13472 Length = getDerived().TransformExpr(E->getLength());
13473 if (Length.isInvalid())
13478 if (E->isOMPArraySection()) {
13479 if (
Expr *Str = E->getStride()) {
13480 Stride = getDerived().TransformExpr(Str);
13481 if (Stride.isInvalid())
13486 if (!getDerived().AlwaysRebuild() &&
Base.get() == E->getBase() &&
13487 LowerBound.get() == E->getLowerBound() &&
13488 Length.get() == E->getLength() &&
13489 (E->isOpenACCArraySection() || Stride.get() == E->getStride()))
13492 return getDerived().RebuildArraySectionExpr(
13493 E->isOMPArraySection(),
Base.get(), E->getBase()->getEndLoc(),
13494 LowerBound.get(), E->getColonLocFirst(),
13495 E->isOMPArraySection() ? E->getColonLocSecond() :
SourceLocation{},
13496 Length.get(), Stride.get(), E->getRBracketLoc());
13499template <
typename Derived>
13503 if (
Base.isInvalid())
13507 bool ErrorFound =
false;
13508 for (
Expr *
Dim : E->getDimensions()) {
13510 if (DimRes.isInvalid()) {
13514 Dims.push_back(DimRes.get());
13519 return getDerived().RebuildOMPArrayShapingExpr(
Base.get(), E->getLParenLoc(),
13520 E->getRParenLoc(), Dims,
13521 E->getBracketsRanges());
13524template <
typename Derived>
13527 unsigned NumIterators = E->numOfIterators();
13530 bool ErrorFound =
false;
13531 bool NeedToRebuild = getDerived().AlwaysRebuild();
13532 for (
unsigned I = 0; I < NumIterators; ++I) {
13534 Data[I].DeclIdent = D->getIdentifier();
13535 Data[I].DeclIdentLoc = D->getLocation();
13536 if (D->getLocation() == D->getBeginLoc()) {
13538 "Implicit type must be int.");
13540 TypeSourceInfo *TSI = getDerived().TransformType(D->getTypeSourceInfo());
13548 ErrorFound = ErrorFound ||
13549 !(!D->getTypeSourceInfo() || (
Data[I].
Type.getAsOpaquePtr() &&
13550 !
Data[I].Type.get().isNull())) ||
13551 Begin.isInvalid() || End.isInvalid() || Step.isInvalid();
13554 Data[I].Range.Begin = Begin.get();
13555 Data[I].Range.End = End.get();
13556 Data[I].Range.Step = Step.get();
13557 Data[I].AssignLoc = E->getAssignLoc(I);
13558 Data[I].ColonLoc = E->getColonLoc(I);
13559 Data[I].SecColonLoc = E->getSecondColonLoc(I);
13562 (D->getTypeSourceInfo() &&
Data[I].
Type.get().getTypePtrOrNull() !=
13563 D->getType().getTypePtrOrNull()) ||
13569 if (!NeedToRebuild)
13572 ExprResult Res = getDerived().RebuildOMPIteratorExpr(
13573 E->getIteratorKwLoc(), E->getLParenLoc(), E->getRParenLoc(),
Data);
13574 if (!Res.isUsable())
13577 for (
unsigned I = 0; I < NumIterators; ++I)
13578 getDerived().transformedLocalDecl(E->getIteratorDecl(I),
13579 IE->getIteratorDecl(I));
13583template<
typename Derived>
13592 bool ArgChanged =
false;
13594 if (getDerived().TransformExprs(E->getArgs(), E->getNumArgs(),
true, Args,
13598 if (!getDerived().AlwaysRebuild() &&
13599 Callee.get() == E->getCallee() &&
13605 = ((
Expr *)
Callee.get())->getSourceRange().getBegin();
13608 if (E->hasStoredFPFeatures()) {
13610 getSema().CurFPFeatures =
13612 getSema().FpPragmaStack.CurrentValue = NewOverrides;
13615 return getDerived().RebuildCallExpr(
Callee.get(), FakeLParenLoc,
13617 E->getRParenLoc());
13620template<
typename Derived>
13624 if (
Base.isInvalid())
13628 if (E->hasQualifier()) {
13630 = getDerived().TransformNestedNameSpecifierLoc(E->getQualifierLoc());
13638 = cast_or_null<ValueDecl>(getDerived().TransformDecl(E->getMemberLoc(),
13639 E->getMemberDecl()));
13643 NamedDecl *FoundDecl = E->getFoundDecl();
13644 if (FoundDecl == E->getMemberDecl()) {
13647 FoundDecl = cast_or_null<NamedDecl>(
13648 getDerived().TransformDecl(E->getMemberLoc(), FoundDecl));
13653 if (!getDerived().AlwaysRebuild() &&
13654 Base.get() == E->getBase() &&
13655 QualifierLoc == E->getQualifierLoc() &&
13656 Member == E->getMemberDecl() &&
13657 FoundDecl == E->getFoundDecl() &&
13658 !E->hasExplicitTemplateArgs()) {
13663 getSema().OpenMP().isOpenMPRebuildMemberExpr(
13673 if (E->hasExplicitTemplateArgs()) {
13674 TransArgs.setLAngleLoc(E->getLAngleLoc());
13675 TransArgs.setRAngleLoc(E->getRAngleLoc());
13676 if (getDerived().TransformTemplateArguments(E->getTemplateArgs(),
13677 E->getNumTemplateArgs(),
13690 NamedDecl *FirstQualifierInScope =
nullptr;
13692 if (MemberNameInfo.getName()) {
13693 MemberNameInfo = getDerived().TransformDeclarationNameInfo(MemberNameInfo);
13694 if (!MemberNameInfo.getName())
13698 return getDerived().RebuildMemberExpr(
Base.get(), FakeOperatorLoc,
13705 (E->hasExplicitTemplateArgs()
13706 ? &TransArgs :
nullptr),
13707 FirstQualifierInScope);
13710template<
typename Derived>
13713 ExprResult LHS = getDerived().TransformExpr(E->getLHS());
13714 if (LHS.isInvalid())
13718 getDerived().TransformInitializer(E->getRHS(),
false);
13719 if (RHS.isInvalid())
13722 if (!getDerived().AlwaysRebuild() &&
13723 LHS.get() == E->getLHS() &&
13724 RHS.get() == E->getRHS())
13727 if (E->isCompoundAssignmentOp())
13729 return getDerived().RebuildBinaryOperator(
13730 E->getOperatorLoc(), E->getOpcode(), LHS.get(), RHS.get());
13733 getSema().CurFPFeatures =
13734 NewOverrides.applyOverrides(getSema().getLangOpts());
13735 getSema().FpPragmaStack.CurrentValue = NewOverrides;
13736 return getDerived().RebuildBinaryOperator(E->getOperatorLoc(), E->getOpcode(),
13737 LHS.get(), RHS.get());
13740template <
typename Derived>
13745 ExprResult LHS = getDerived().TransformExpr(
const_cast<Expr*
>(Decomp.LHS));
13746 if (LHS.isInvalid())
13749 ExprResult RHS = getDerived().TransformExpr(
const_cast<Expr*
>(Decomp.RHS));
13750 if (RHS.isInvalid())
13756 bool ChangedAnyLookups =
false;
13757 Expr *PossibleBinOps[] = {E->getSemanticForm(),
13758 const_cast<Expr *
>(Decomp.InnerBinOp)};
13759 for (
Expr *PossibleBinOp : PossibleBinOps) {
13760 auto *Op = dyn_cast<CXXOperatorCallExpr>(PossibleBinOp->IgnoreImplicit());
13763 auto *
Callee = dyn_cast<DeclRefExpr>(Op->getCallee()->IgnoreImplicit());
13769 NamedDecl *
Found = cast_or_null<NamedDecl>(getDerived().TransformDecl(
13770 E->getOperatorLoc(),
Callee->getFoundDecl()));
13774 ChangedAnyLookups =
true;
13775 UnqualLookups.addDecl(
Found);
13778 if (!getDerived().AlwaysRebuild() && !ChangedAnyLookups &&
13779 LHS.get() == Decomp.LHS && RHS.get() == Decomp.RHS) {
13785 const Expr *StopAt[] = {Decomp.LHS, Decomp.RHS};
13790 return getDerived().RebuildCXXRewrittenBinaryOperator(
13791 E->getOperatorLoc(), Decomp.Opcode, UnqualLookups, LHS.get(), RHS.get());
13794template<
typename Derived>
13800 getSema().CurFPFeatures =
13801 NewOverrides.applyOverrides(getSema().getLangOpts());
13802 getSema().FpPragmaStack.CurrentValue = NewOverrides;
13803 return getDerived().TransformBinaryOperator(E);
13806template<
typename Derived>
13812 ExprResult commonExpr = getDerived().TransformExpr(e->getCommon());
13813 if (commonExpr.isInvalid())
13816 ExprResult rhs = getDerived().TransformExpr(e->getFalseExpr());
13817 if (rhs.isInvalid())
13820 if (!getDerived().AlwaysRebuild() &&
13821 commonExpr.get() == e->getCommon() &&
13822 rhs.get() == e->getFalseExpr())
13825 return getDerived().RebuildConditionalOperator(commonExpr.get(),
13826 e->getQuestionLoc(),
13832template<
typename Derived>
13836 if (
Cond.isInvalid())
13839 ExprResult LHS = getDerived().TransformExpr(E->getLHS());
13840 if (LHS.isInvalid())
13843 ExprResult RHS = getDerived().TransformExpr(E->getRHS());
13844 if (RHS.isInvalid())
13847 if (!getDerived().AlwaysRebuild() &&
13848 Cond.get() == E->getCond() &&
13849 LHS.get() == E->getLHS() &&
13850 RHS.get() == E->getRHS())
13853 return getDerived().RebuildConditionalOperator(
Cond.get(),
13854 E->getQuestionLoc(),
13860template<
typename Derived>
13865 return getDerived().
TransformExpr(E->getSubExprAsWritten());
13868template<
typename Derived>
13876 = getDerived().TransformExpr(E->getSubExprAsWritten());
13877 if (SubExpr.isInvalid())
13880 if (!getDerived().AlwaysRebuild() &&
13881 Type == E->getTypeInfoAsWritten() &&
13882 SubExpr.get() == E->getSubExpr())
13885 return getDerived().RebuildCStyleCastExpr(E->getLParenLoc(),
13891template<
typename Derived>
13899 ExprResult Init = getDerived().TransformExpr(E->getInitializer());
13900 if (
Init.isInvalid())
13903 if (!getDerived().AlwaysRebuild() &&
13905 Init.get() == E->getInitializer())
13912 return getDerived().RebuildCompoundLiteralExpr(
13913 E->getLParenLoc(), NewT,
13914 E->getInitializer()->getEndLoc(),
Init.get());
13917template<
typename Derived>
13921 if (
Base.isInvalid())
13924 if (!getDerived().AlwaysRebuild() &&
13925 Base.get() == E->getBase())
13931 return getDerived().RebuildExtVectorElementExpr(
13932 Base.get(), FakeOperatorLoc, E->isArrow(), E->getAccessorLoc(),
13936template<
typename Derived>
13942 bool InitChanged =
false;
13948 if (getDerived().TransformExprs(E->getInits(), E->getNumInits(),
false,
13949 Inits, &InitChanged))
13952 if (!getDerived().AlwaysRebuild() && !InitChanged) {
13959 return getDerived().RebuildInitList(E->getLBraceLoc(), Inits,
13960 E->getRBraceLoc());
13963template<
typename Derived>
13970 if (
Init.isInvalid())
13975 bool ExprChanged =
false;
13977 if (D.isFieldDesignator()) {
13978 if (D.getFieldDecl()) {
13980 getDerived().TransformDecl(D.getFieldLoc(), D.getFieldDecl()));
13981 if (Field != D.getFieldDecl())
13984 ExprChanged =
true;
13985 if (
Field->isAnonymousStructOrUnion())
13991 ExprChanged =
true;
13994 D.getFieldName(), D.getDotLoc(), D.getFieldLoc()));
13998 if (D.isArrayDesignator()) {
13999 ExprResult Index = getDerived().TransformExpr(E->getArrayIndex(D));
14000 if (Index.isInvalid())
14003 Desig.AddDesignator(
14006 ExprChanged = ExprChanged || Index.get() != E->getArrayIndex(D);
14007 ArrayExprs.push_back(Index.get());
14011 assert(D.isArrayRangeDesignator() &&
"New kind of designator?");
14013 = getDerived().TransformExpr(E->getArrayRangeStart(D));
14014 if (Start.isInvalid())
14017 ExprResult End = getDerived().TransformExpr(E->getArrayRangeEnd(D));
14018 if (End.isInvalid())
14022 Start.get(), End.get(), D.getLBracketLoc(), D.getEllipsisLoc()));
14024 ExprChanged = ExprChanged || Start.get() != E->getArrayRangeStart(D) ||
14025 End.get() != E->getArrayRangeEnd(D);
14027 ArrayExprs.push_back(Start.get());
14028 ArrayExprs.push_back(End.get());
14031 if (!getDerived().AlwaysRebuild() &&
14032 Init.get() == E->getInit() &&
14036 return getDerived().RebuildDesignatedInitExpr(Desig, ArrayExprs,
14037 E->getEqualOrColonLoc(),
14038 E->usesGNUSyntax(),
Init.get());
14043template<
typename Derived>
14047 llvm_unreachable(
"Unexpected DesignatedInitUpdateExpr in syntactic form of "
14052template<
typename Derived>
14056 llvm_unreachable(
"Unexpected NoInitExpr in syntactic form of initializer");
14060template<
typename Derived>
14063 llvm_unreachable(
"Unexpected ArrayInitLoopExpr outside of initializer");
14067template<
typename Derived>
14070 llvm_unreachable(
"Unexpected ArrayInitIndexExpr outside of initializer");
14074template<
typename Derived>
14082 QualType T = getDerived().TransformType(E->getType());
14086 if (!getDerived().AlwaysRebuild() &&
14090 return getDerived().RebuildImplicitValueInitExpr(
T);
14093template<
typename Derived>
14096 TypeSourceInfo *TInfo = getDerived().TransformType(E->getWrittenTypeInfo());
14100 ExprResult SubExpr = getDerived().TransformExpr(E->getSubExpr());
14101 if (SubExpr.isInvalid())
14104 if (!getDerived().AlwaysRebuild() &&
14105 TInfo == E->getWrittenTypeInfo() &&
14106 SubExpr.get() == E->getSubExpr())
14109 return getDerived().RebuildVAArgExpr(E->getBuiltinLoc(), SubExpr.get(),
14110 TInfo, E->getRParenLoc());
14113template<
typename Derived>
14116 bool ArgumentChanged =
false;
14118 if (TransformExprs(E->getExprs(), E->getNumExprs(),
true, Inits,
14122 return getDerived().RebuildParenListExpr(E->getLParenLoc(),
14124 E->getRParenLoc());
14132template<
typename Derived>
14135 Decl *LD = getDerived().TransformDecl(E->getLabel()->getLocation(),
14140 return getDerived().RebuildAddrLabelExpr(E->getAmpAmpLoc(), E->getLabelLoc(),
14144template<
typename Derived>
14149 = getDerived().TransformCompoundStmt(E->getSubStmt(),
true);
14150 if (SubStmt.isInvalid()) {
14155 unsigned OldDepth = E->getTemplateDepth();
14156 unsigned NewDepth = getDerived().TransformTemplateDepth(OldDepth);
14158 if (!getDerived().AlwaysRebuild() && OldDepth == NewDepth &&
14159 SubStmt.get() == E->getSubStmt()) {
14165 return getDerived().RebuildStmtExpr(E->getLParenLoc(), SubStmt.get(),
14166 E->getRParenLoc(), NewDepth);
14169template<
typename Derived>
14173 if (
Cond.isInvalid())
14176 ExprResult LHS = getDerived().TransformExpr(E->getLHS());
14177 if (LHS.isInvalid())
14180 ExprResult RHS = getDerived().TransformExpr(E->getRHS());
14181 if (RHS.isInvalid())
14184 if (!getDerived().AlwaysRebuild() &&
14185 Cond.get() == E->getCond() &&
14186 LHS.get() == E->getLHS() &&
14187 RHS.get() == E->getRHS())
14190 return getDerived().RebuildChooseExpr(E->getBuiltinLoc(),
14191 Cond.get(), LHS.get(), RHS.get(),
14192 E->getRParenLoc());
14195template<
typename Derived>
14201template<
typename Derived>
14204 switch (E->getOperator()) {
14208 case OO_Array_Delete:
14209 llvm_unreachable(
"new and delete operators cannot use CXXOperatorCallExpr");
14214 assert(E->getNumArgs() >= 1 &&
"Object call is missing arguments");
14227 if (FakeLParenLoc.isInvalid() && EndLoc.isValid())
14228 FakeLParenLoc = EndLoc;
14232 if (getDerived().TransformExprs(E->getArgs() + 1, E->getNumArgs() - 1,
true,
14236 if (E->getOperator() == OO_Subscript)
14237 return getDerived().RebuildCxxSubscriptExpr(
Object.get(), FakeLParenLoc,
14238 Args, E->getEndLoc());
14240 return getDerived().RebuildCallExpr(
Object.get(), FakeLParenLoc, Args,
14244#define OVERLOADED_OPERATOR(Name, Spelling, Token, Unary, Binary, MemberOnly) \
14248#define OVERLOADED_OPERATOR_MULTI(Name,Spelling,Unary,Binary,MemberOnly)
14249#include "clang/Basic/OperatorKinds.def"
14251 case OO_Conditional:
14252 llvm_unreachable(
"conditional operator is not actually overloadable");
14256 llvm_unreachable(
"not an overloaded operator?");
14260 if (E->getNumArgs() == 1 && E->getOperator() == OO_Amp)
14261 First = getDerived().TransformAddressOfOperand(E->getArg(0));
14263 First = getDerived().TransformExpr(E->getArg(0));
14264 if (
First.isInvalid())
14268 if (E->getNumArgs() == 2) {
14270 getDerived().TransformInitializer(E->getArg(1),
false);
14271 if (Second.isInvalid())
14277 getSema().CurFPFeatures =
14278 NewOverrides.applyOverrides(getSema().getLangOpts());
14279 getSema().FpPragmaStack.CurrentValue = NewOverrides;
14283 LookupResult R(SemaRef, ULE->getName(), ULE->getNameLoc(),
14285 if (getDerived().TransformOverloadExprDecls(ULE, ULE->requiresADL(), R))
14288 return getDerived().RebuildCXXOperatorCallExpr(
14289 E->getOperator(), E->getOperatorLoc(),
Callee->getBeginLoc(),
14290 ULE->requiresADL(), R.asUnresolvedSet(),
First.get(), Second.get());
14295 Callee = ICE->getSubExprAsWritten();
14297 ValueDecl *VD = cast_or_null<ValueDecl>(
14298 getDerived().TransformDecl(DR->getLocation(), DR));
14303 Functions.addDecl(VD);
14305 return getDerived().RebuildCXXOperatorCallExpr(
14306 E->getOperator(), E->getOperatorLoc(),
Callee->getBeginLoc(),
14307 false, Functions,
First.get(), Second.get());
14310template<
typename Derived>
14313 return getDerived().TransformCallExpr(E);
14316template <
typename Derived>
14319 getSema().CurContext != E->getParentContext();
14321 if (!getDerived().AlwaysRebuild() && !NeedRebuildFunc)
14324 return getDerived().RebuildSourceLocExpr(E->getIdentKind(), E->getType(),
14325 E->getBeginLoc(), E->getEndLoc(),
14326 getSema().CurContext);
14329template <
typename Derived>
14334template<
typename Derived>
14343 ExprResult EC = getDerived().TransformCallExpr(E->getConfig());
14344 if (EC.isInvalid())
14348 bool ArgChanged =
false;
14350 if (getDerived().TransformExprs(E->getArgs(), E->getNumArgs(),
true, Args,
14354 if (!getDerived().AlwaysRebuild() &&
14355 Callee.get() == E->getCallee() &&
14361 = ((
Expr *)
Callee.get())->getSourceRange().getBegin();
14362 return getDerived().RebuildCallExpr(
Callee.get(), FakeLParenLoc,
14364 E->getRParenLoc(), EC.get());
14367template<
typename Derived>
14383 return getDerived().RebuildCXXNamedCastExpr(
14390template<
typename Derived>
14399 if (Sub.isInvalid())
14402 return getDerived().RebuildBuiltinBitCastExpr(BCE->
getBeginLoc(), TSI,
14406template<
typename Derived>
14408TreeTransform<Derived>::TransformCXXStaticCastExpr(CXXStaticCastExpr *E) {
14409 return getDerived().TransformCXXNamedCastExpr(E);
14412template<
typename Derived>
14418template<
typename Derived>
14425template<
typename Derived>
14431template<
typename Derived>
14437template<
typename Derived>
14442 getDerived().TransformTypeWithDeducedTST(E->getTypeInfoAsWritten());
14447 = getDerived().TransformExpr(E->getSubExprAsWritten());
14448 if (SubExpr.isInvalid())
14451 if (!getDerived().AlwaysRebuild() &&
14452 Type == E->getTypeInfoAsWritten() &&
14453 SubExpr.get() == E->getSubExpr())
14456 return getDerived().RebuildCXXFunctionalCastExpr(
Type,
14460 E->isListInitialization());
14463template<
typename Derived>
14466 if (E->isTypeOperand()) {
14468 = getDerived().TransformType(E->getTypeOperandSourceInfo());
14472 if (!getDerived().AlwaysRebuild() &&
14473 TInfo == E->getTypeOperandSourceInfo())
14476 return getDerived().RebuildCXXTypeidExpr(E->getType(), E->getBeginLoc(),
14477 TInfo, E->getEndLoc());
14483 Expr *Op = E->getExprOperand();
14485 if (E->isGLValue())
14486 if (
auto *RD = Op->getType()->getAsCXXRecordDecl();
14487 RD && RD->isPolymorphic())
14493 ExprResult SubExpr = getDerived().TransformExpr(Op);
14494 if (SubExpr.isInvalid())
14497 if (!getDerived().AlwaysRebuild() &&
14498 SubExpr.get() == E->getExprOperand())
14501 return getDerived().RebuildCXXTypeidExpr(E->getType(), E->getBeginLoc(),
14502 SubExpr.get(), E->getEndLoc());
14505template<
typename Derived>
14508 if (E->isTypeOperand()) {
14510 = getDerived().TransformType(E->getTypeOperandSourceInfo());
14514 if (!getDerived().AlwaysRebuild() &&
14515 TInfo == E->getTypeOperandSourceInfo())
14518 return getDerived().RebuildCXXUuidofExpr(E->getType(), E->getBeginLoc(),
14519 TInfo, E->getEndLoc());
14525 ExprResult SubExpr = getDerived().TransformExpr(E->getExprOperand());
14526 if (SubExpr.isInvalid())
14529 if (!getDerived().AlwaysRebuild() &&
14530 SubExpr.get() == E->getExprOperand())
14533 return getDerived().RebuildCXXUuidofExpr(E->getType(), E->getBeginLoc(),
14534 SubExpr.get(), E->getEndLoc());
14537template<
typename Derived>
14543template<
typename Derived>
14550template<
typename Derived>
14566 auto &S = getSema();
14567 if (E->isCapturedByCopyInLambdaWithExplicitObjectParameter())
14568 return S.getCurrentThisType();
14569 if (S.getCurLambda())
14570 return getDerived().TransformType(E->getType());
14571 return S.getCurrentThisType();
14574 if (!getDerived().AlwaysRebuild() &&
T == E->getType() &&
14575 !E->isCapturedByCopyInLambdaWithExplicitObjectParameter()) {
14578 getSema().MarkThisReferenced(E);
14582 return getDerived().RebuildCXXThisExpr(E->getBeginLoc(),
T, E->isImplicit());
14585template<
typename Derived>
14588 ExprResult SubExpr = getDerived().TransformExpr(E->getSubExpr());
14589 if (SubExpr.isInvalid())
14592 getSema().DiagnoseExceptionUse(E->getThrowLoc(),
false);
14594 if (!getDerived().AlwaysRebuild() &&
14595 SubExpr.get() == E->getSubExpr())
14598 return getDerived().RebuildCXXThrowExpr(E->getThrowLoc(), SubExpr.get(),
14599 E->isThrownVariableInScope());
14602template<
typename Derived>
14606 getDerived().TransformDecl(E->getBeginLoc(), E->getParam()));
14611 if (E->hasRewrittenInit()) {
14612 InitRes = getDerived().TransformExpr(E->getRewrittenExpr());
14613 if (InitRes.isInvalid())
14617 if (!getDerived().AlwaysRebuild() && Param == E->getParam() &&
14618 E->getUsedContext() == SemaRef.
CurContext &&
14619 InitRes.get() == E->getRewrittenExpr())
14622 return getDerived().RebuildCXXDefaultArgExpr(E->getUsedLocation(), Param,
14626template<
typename Derived>
14630 getDerived().TransformDecl(E->getBeginLoc(), E->getField()));
14634 if (!getDerived().AlwaysRebuild() && Field == E->getField() &&
14638 return getDerived().RebuildCXXDefaultInitExpr(E->getExprLoc(), Field);
14641template<
typename Derived>
14645 TypeSourceInfo *
T = getDerived().TransformType(E->getTypeSourceInfo());
14649 if (!getDerived().AlwaysRebuild() &&
14650 T == E->getTypeSourceInfo())
14653 return getDerived().RebuildCXXScalarValueInitExpr(
T,
14654 T->getTypeLoc().getEndLoc(),
14655 E->getRParenLoc());
14658template<
typename Derived>
14663 getDerived().TransformTypeWithDeducedTST(E->getAllocatedTypeSourceInfo());
14664 if (!AllocTypeInfo)
14668 std::optional<Expr *> ArraySize;
14669 if (E->isArray()) {
14671 if (std::optional<Expr *> OldArraySize = E->getArraySize()) {
14672 NewArraySize = getDerived().TransformExpr(*OldArraySize);
14673 if (NewArraySize.isInvalid())
14676 ArraySize = NewArraySize.get();
14680 bool ArgumentChanged =
false;
14682 if (getDerived().TransformExprs(E->getPlacementArgs(),
14683 E->getNumPlacementArgs(),
true,
14684 PlacementArgs, &ArgumentChanged))
14688 Expr *OldInit = E->getInitializer();
14691 NewInit = getDerived().TransformInitializer(OldInit,
true);
14692 if (NewInit.isInvalid())
14697 if (E->getOperatorNew()) {
14698 OperatorNew = cast_or_null<FunctionDecl>(
14699 getDerived().TransformDecl(E->getBeginLoc(), E->getOperatorNew()));
14705 if (E->getOperatorDelete()) {
14706 OperatorDelete = cast_or_null<FunctionDecl>(
14707 getDerived().TransformDecl(E->getBeginLoc(), E->getOperatorDelete()));
14708 if (!OperatorDelete)
14712 if (!getDerived().AlwaysRebuild() &&
14713 AllocTypeInfo == E->getAllocatedTypeSourceInfo() &&
14714 ArraySize == E->getArraySize() &&
14715 NewInit.get() == OldInit &&
14716 OperatorNew == E->getOperatorNew() &&
14717 OperatorDelete == E->getOperatorDelete() &&
14718 !ArgumentChanged) {
14723 if (OperatorDelete)
14726 if (E->isArray() && !E->getAllocatedType()->isDependentType()) {
14738 QualType AllocType = AllocTypeInfo->getType();
14749 = dyn_cast<ConstantArrayType>(ArrayT)) {
14753 AllocType = ConsArrayT->getElementType();
14755 = dyn_cast<DependentSizedArrayType>(ArrayT)) {
14756 if (DepArrayT->getSizeExpr()) {
14757 ArraySize = DepArrayT->getSizeExpr();
14758 AllocType = DepArrayT->getElementType();
14763 return getDerived().RebuildCXXNewExpr(
14764 E->getBeginLoc(), E->isGlobalNew(),
14765 E->getBeginLoc(), PlacementArgs,
14766 E->getBeginLoc(), E->getTypeIdParens(), AllocType,
14767 AllocTypeInfo, ArraySize, E->getDirectInitRange(), NewInit.get());
14770template<
typename Derived>
14779 if (E->getOperatorDelete()) {
14780 OperatorDelete = cast_or_null<FunctionDecl>(
14781 getDerived().TransformDecl(E->getBeginLoc(), E->getOperatorDelete()));
14782 if (!OperatorDelete)
14786 if (!getDerived().AlwaysRebuild() &&
14787 Operand.get() == E->getArgument() &&
14788 OperatorDelete == E->getOperatorDelete()) {
14791 if (OperatorDelete)
14794 if (!E->getArgument()->isTypeDependent()) {
14796 E->getDestroyedType());
14797 if (
auto *
Record = Destroyed->getAsCXXRecordDecl())
14805 return getDerived().RebuildCXXDeleteExpr(
14806 E->getBeginLoc(), E->isGlobalDelete(), E->isArrayForm(),
Operand.get());
14809template<
typename Derived>
14814 if (
Base.isInvalid())
14818 bool MayBePseudoDestructor =
false;
14820 E->getOperatorLoc(),
14821 E->isArrow()? tok::arrow : tok::period,
14823 MayBePseudoDestructor);
14824 if (
Base.isInvalid())
14827 QualType ObjectType = ObjectTypePtr.get();
14829 if (QualifierLoc) {
14831 = getDerived().TransformNestedNameSpecifierLoc(QualifierLoc, ObjectType);
14836 SS.
Adopt(QualifierLoc);
14839 if (E->getDestroyedTypeInfo()) {
14840 TypeSourceInfo *DestroyedTypeInfo = getDerived().TransformTypeInObjectScope(
14841 E->getDestroyedTypeInfo(), ObjectType,
14843 if (!DestroyedTypeInfo)
14845 Destroyed = DestroyedTypeInfo;
14846 }
else if (!ObjectType.isNull() && ObjectType->isDependentType()) {
14850 E->getDestroyedTypeLoc());
14854 *E->getDestroyedTypeIdentifier(), E->getDestroyedTypeLoc(),
14855 nullptr, SS, ObjectTypePtr,
false);
14861 E->getDestroyedTypeLoc());
14865 if (E->getScopeTypeInfo()) {
14866 ScopeTypeInfo = getDerived().TransformTypeInObjectScope(
14867 E->getScopeTypeInfo(), ObjectType,
nullptr);
14868 if (!ScopeTypeInfo)
14872 return getDerived().RebuildCXXPseudoDestructorExpr(
Base.get(),
14873 E->getOperatorLoc(),
14877 E->getColonColonLoc(),
14882template <
typename Derived>
14887 bool AllEmptyPacks =
true;
14888 for (
auto *OldD : Old->
decls()) {
14904 if (
auto *UPD = dyn_cast<UsingPackDecl>(InstD))
14905 Decls = UPD->expansions();
14908 for (
auto *D : Decls) {
14909 if (
auto *UD = dyn_cast<UsingDecl>(D)) {
14910 for (
auto *SD : UD->shadows())
14917 AllEmptyPacks &= Decls.empty();
14926 if (AllEmptyPacks && !RequiresADL) {
14938 getSema().FilterAcceptableTemplateNames(R,
14945 diag::err_template_kw_refers_to_non_template)
14949 diag::note_template_kw_refers_to_non_template)
14958template <
typename Derived>
14964template <
typename Derived>
14967 bool IsAddressOfOperand) {
14972 if (TransformOverloadExprDecls(Old, Old->
requiresADL(), R))
14979 = getDerived().TransformNestedNameSpecifierLoc(Old->
getQualifierLoc());
14983 SS.
Adopt(QualifierLoc);
14987 CXXRecordDecl *NamingClass
14988 = cast_or_null<CXXRecordDecl>(getDerived().TransformDecl(
14991 if (!NamingClass) {
14996 R.setNamingClass(NamingClass);
15017 SS, TemplateKWLoc, R,
15024 return getDerived().RebuildDeclarationNameExpr(SS, R, Old->
requiresADL());
15027 return getDerived().RebuildTemplateIdExpr(SS, TemplateKWLoc, R,
15031template<
typename Derived>
15034 bool ArgChanged =
false;
15036 for (
unsigned I = 0, N = E->getNumArgs(); I != N; ++I) {
15038 TypeLoc FromTL = From->getTypeLoc();
15041 TLB.
reserve(FromTL.getFullDataSize());
15042 QualType To = getDerived().TransformType(TLB, FromTL);
15046 if (To == From->getType())
15047 Args.push_back(From);
15049 Args.push_back(TLB.getTypeSourceInfo(SemaRef.
Context, To));
15059 TypeLoc PatternTL = ExpansionTL.getPatternLoc();
15065 bool Expand =
true;
15066 bool RetainExpansion =
false;
15068 ExpansionTL.getTypePtr()->getNumExpansions();
15070 if (getDerived().TryExpandParameterPacks(
15071 ExpansionTL.getEllipsisLoc(), PatternTL.getSourceRange(),
15072 Unexpanded,
true, Expand,
15073 RetainExpansion, NumExpansions))
15083 TLB.
reserve(From->getTypeLoc().getFullDataSize());
15085 QualType To = getDerived().TransformType(TLB, PatternTL);
15089 To = getDerived().RebuildPackExpansionType(To,
15090 PatternTL.getSourceRange(),
15091 ExpansionTL.getEllipsisLoc(),
15099 Args.push_back(TLB.getTypeSourceInfo(SemaRef.
Context, To));
15105 for (
unsigned I = 0; I != *NumExpansions; ++I) {
15108 TLB.
reserve(PatternTL.getFullDataSize());
15109 QualType To = getDerived().TransformType(TLB, PatternTL);
15113 if (To->containsUnexpandedParameterPack()) {
15114 To = getDerived().RebuildPackExpansionType(To,
15115 PatternTL.getSourceRange(),
15116 ExpansionTL.getEllipsisLoc(),
15126 Args.push_back(TLB.getTypeSourceInfo(SemaRef.
Context, To));
15129 if (!RetainExpansion)
15134 ForgetPartiallySubstitutedPackRAII Forget(getDerived());
15137 TLB.
reserve(From->getTypeLoc().getFullDataSize());
15139 QualType To = getDerived().TransformType(TLB, PatternTL);
15143 To = getDerived().RebuildPackExpansionType(To,
15144 PatternTL.getSourceRange(),
15145 ExpansionTL.getEllipsisLoc(),
15153 Args.push_back(TLB.getTypeSourceInfo(SemaRef.
Context, To));
15156 if (!getDerived().AlwaysRebuild() && !ArgChanged)
15159 return getDerived().RebuildTypeTrait(E->getTrait(), E->getBeginLoc(), Args,
15163template<
typename Derived>
15169 if (getDerived().TransformTemplateArguments(Old->getTemplateArgs(),
15170 Old->NumTemplateArgs, TransArgs))
15173 return getDerived().RebuildConceptSpecializationExpr(
15174 E->getNestedNameSpecifierLoc(), E->getTemplateKWLoc(),
15175 E->getConceptNameInfo(), E->getFoundDecl(), E->getNamedConcept(),
15179template<
typename Derived>
15193 getSema().Context, getSema().CurContext,
15194 E->getBody()->getBeginLoc());
15198 ExprResult TypeParamResult = getDerived().TransformRequiresTypeParams(
15199 E->getRequiresKWLoc(), E->getRBraceLoc(), E, Body,
15200 E->getLocalParameters(), TransParamTypes, TransParams, ExtParamInfos);
15204 Param->setDeclContext(Body);
15210 if (!TypeParamResult.isUnset())
15211 return TypeParamResult;
15214 if (getDerived().TransformRequiresExprRequirements(E->getRequirements(),
15219 if (
auto *ER = dyn_cast<concepts::ExprRequirement>(Req)) {
15220 if (ER->getReturnTypeRequirement().isTypeConstraint()) {
15221 ER->getReturnTypeRequirement()
15222 .getTypeConstraintTemplateParameterList()->getParam(0)
15223 ->setDeclContext(Body);
15228 return getDerived().RebuildRequiresExpr(
15229 E->getRequiresKWLoc(), Body, E->getLParenLoc(), TransParams,
15230 E->getRParenLoc(), TransReqs, E->getRBraceLoc());
15233template<
typename Derived>
15239 if (
auto *TypeReq = dyn_cast<concepts::TypeRequirement>(Req))
15240 TransReq =
getDerived().TransformTypeRequirement(TypeReq);
15241 else if (
auto *ExprReq = dyn_cast<concepts::ExprRequirement>(Req))
15242 TransReq =
getDerived().TransformExprRequirement(ExprReq);
15244 TransReq =
getDerived().TransformNestedRequirement(
15248 Transformed.push_back(TransReq);
15253template<
typename Derived>
15266 return getDerived().RebuildTypeRequirement(TransType);
15269template<
typename Derived>
15272 llvm::PointerUnion<Expr *, concepts::Requirement::SubstitutionDiagnostic *> TransExpr;
15278 TransExprRes =
SemaRef.CheckPlaceholderExpr(TransExprRes.
get());
15281 TransExpr = TransExprRes.
get();
15284 std::optional<concepts::ExprRequirement::ReturnTypeRequirement> TransRetReq;
15286 if (RetReq.isEmpty())
15287 TransRetReq.emplace();
15288 else if (RetReq.isSubstitutionFailure())
15289 TransRetReq.emplace(RetReq.getSubstitutionDiagnostic());
15290 else if (RetReq.isTypeConstraint()) {
15292 RetReq.getTypeConstraintTemplateParameterList();
15294 getDerived().TransformTemplateParameterList(OrigTPL);
15297 TransRetReq.emplace(TPL);
15299 assert(TransRetReq &&
"All code paths leading here must set TransRetReq");
15300 if (
Expr *E = dyn_cast<Expr *>(TransExpr))
15303 std::move(*TransRetReq));
15309template<
typename Derived>
15315 return getDerived().RebuildNestedRequirement(
15323 return getDerived().RebuildNestedRequirement(TransConstraint.
get());
15326template<
typename Derived>
15333 if (!getDerived().AlwaysRebuild() &&
15350template<
typename Derived>
15357 SubExpr = getDerived().TransformExpr(E->getQueriedExpression());
15358 if (SubExpr.isInvalid())
15361 if (!getDerived().AlwaysRebuild() && SubExpr.get() == E->getQueriedExpression())
15365 return getDerived().RebuildExpressionTrait(E->getTrait(), E->getBeginLoc(),
15366 SubExpr.get(), E->getEndLoc());
15369template <
typename Derived>
15374 DRE, AddrTaken, RecoveryTSI);
15387template <
typename Derived>
15394template <
typename Derived>
15410 getDerived().TransformDeclarationNameInfo(E->
getNameInfo());
15415 if (!getDerived().AlwaysRebuild() && QualifierLoc == E->
getQualifierLoc() &&
15421 return getDerived().RebuildDependentScopeDeclRefExpr(
15422 QualifierLoc, TemplateKWLoc, NameInfo,
nullptr,
15423 IsAddressOfOperand, RecoveryTSI);
15427 if (getDerived().TransformTemplateArguments(
15431 return getDerived().RebuildDependentScopeDeclRefExpr(
15432 QualifierLoc, TemplateKWLoc, NameInfo, &TransArgs, IsAddressOfOperand,
15436template<
typename Derived>
15442 if (getDerived().AllowSkippingCXXConstructExpr() &&
15443 ((E->getNumArgs() == 1 ||
15444 (E->getNumArgs() > 1 && getDerived().DropCallArgument(E->getArg(1)))) &&
15445 (!getDerived().DropCallArgument(E->getArg(0))) &&
15446 !E->isListInitialization()))
15452 QualType T = getDerived().TransformType(E->getType());
15457 getDerived().TransformDecl(E->getBeginLoc(), E->getConstructor()));
15461 bool ArgumentChanged =
false;
15466 E->isListInitialization());
15467 if (getDerived().TransformExprs(E->getArgs(), E->getNumArgs(),
true, Args,
15472 if (!getDerived().AlwaysRebuild() &&
15473 T == E->getType() &&
15475 !ArgumentChanged) {
15482 return getDerived().RebuildCXXConstructExpr(
15483 T, E->getBeginLoc(),
Constructor, E->isElidable(), Args,
15484 E->hadMultipleCandidates(), E->isListInitialization(),
15485 E->isStdInitListInitialization(), E->requiresZeroInitialization(),
15486 E->getConstructionKind(), E->getParenOrBraceRange());
15489template<
typename Derived>
15492 QualType T = getDerived().TransformType(E->getType());
15497 getDerived().TransformDecl(E->getBeginLoc(), E->getConstructor()));
15501 if (!getDerived().AlwaysRebuild() &&
15502 T == E->getType() &&
15510 return getDerived().RebuildCXXInheritedCtorInitExpr(
15512 E->constructsVBase(), E->inheritedFromVBase());
15519template<
typename Derived>
15522 if (
auto *Dtor = E->getTemporary()->getDestructor())
15525 return getDerived().TransformExpr(E->getSubExpr());
15533template<
typename Derived>
15539template<
typename Derived>
15544 getDerived().TransformTypeWithDeducedTST(E->getTypeSourceInfo());
15549 getDerived().TransformDecl(E->getBeginLoc(), E->getConstructor()));
15553 bool ArgumentChanged =
false;
15555 Args.reserve(E->getNumArgs());
15559 E->isListInitialization());
15560 if (TransformExprs(E->getArgs(), E->getNumArgs(),
true, Args,
15564 if (E->isListInitialization() && !E->isStdInitListInitialization()) {
15565 ExprResult Res = RebuildInitList(E->getBeginLoc(), Args, E->getEndLoc());
15566 if (Res.isInvalid())
15568 Args = {Res.get()};
15572 if (!getDerived().AlwaysRebuild() &&
15573 T == E->getTypeSourceInfo() &&
15575 !ArgumentChanged) {
15582 return getDerived().RebuildCXXTemporaryObjectExpr(
15583 T, LParenLoc, Args, E->getEndLoc(), E->isListInitialization());
15586template<
typename Derived>
15591 typedef std::pair<ExprResult, QualType> InitCaptureInfoTy;
15592 struct TransformedInitCapture {
15594 SourceLocation EllipsisLoc;
15596 SmallVector<InitCaptureInfoTy, 4> Expansions;
15599 InitCaptures.resize(E->explicit_capture_end() - E->explicit_capture_begin());
15601 CEnd = E->capture_end();
15603 if (!E->isInitCapture(
C))
15606 TransformedInitCapture &
Result = InitCaptures[
C - E->capture_begin()];
15611 ExprResult NewExprInitResult = getDerived().TransformInitializer(
15614 if (NewExprInitResult.isInvalid()) {
15618 Expr *NewExprInit = NewExprInitResult.get();
15621 getSema().buildLambdaInitCaptureInitialization(
15622 C->getLocation(),
C->getCaptureKind() ==
LCK_ByRef,
15623 EllipsisLoc, NumExpansions, OldVD->getIdentifier(),
15627 Result.Expansions.push_back(
15628 InitCaptureInfoTy(NewExprInit, NewInitCaptureType));
15632 if (OldVD->isParameterPack()) {
15641 bool Expand =
true;
15642 bool RetainExpansion =
false;
15644 ExpansionTL.getTypePtr()->getNumExpansions();
15646 if (getDerived().TryExpandParameterPacks(
15647 ExpansionTL.getEllipsisLoc(), OldVD->getInit()->getSourceRange(),
15648 Unexpanded,
true, Expand,
15649 RetainExpansion, NumExpansions))
15651 assert(!RetainExpansion &&
"Should not need to retain expansion after a "
15652 "capture since it cannot be extended");
15654 for (
unsigned I = 0; I != *NumExpansions; ++I) {
15659 SubstInitCapture(ExpansionTL.getEllipsisLoc(), NumExpansions);
15660 Result.EllipsisLoc = ExpansionTL.getEllipsisLoc();
15697 while (DC->isRequiresExprBody())
15699 if ((getSema().isUnevaluatedContext() ||
15700 getSema().isConstantEvaluatedContext()) &&
15701 !(dyn_cast_or_null<CXXRecordDecl>(DC->getParent()) &&
15703 (DC->isFileContext() || !DC->getParent()->isDependentContext()))
15708 E->getIntroducerRange(),
nullptr, DependencyKind,
15709 E->getCaptureDefault());
15710 getDerived().transformedLocalDecl(OldClass, {
Class});
15713 getSema().CreateLambdaCallOperator(E->getIntroducerRange(),
Class);
15716 getSema().buildLambdaScope(LSI, NewCallOperator, E->getIntroducerRange(),
15717 E->getCaptureDefault(), E->getCaptureDefaultLoc(),
15718 E->hasExplicitParameters(), E->isMutable());
15728 CEnd = E->capture_end();
15732 if (
C->isImplicit())
15736 if (
C->capturesThis()) {
15744 dyn_cast_if_present<CXXRecordDecl>(
15745 getSema().getFunctionLevelDeclContext()),
15747 getSema().CheckCXXThisCapture(
C->getLocation(),
C->isExplicit(),
15754 if (
C->capturesVLAType())
15758 if (E->isInitCapture(
C)) {
15759 TransformedInitCapture &NewC = InitCaptures[
C - E->capture_begin()];
15764 for (InitCaptureInfoTy &Info : NewC.Expansions) {
15766 QualType InitQualType = Info.second;
15767 if (
Init.isInvalid() || InitQualType.isNull()) {
15771 VarDecl *NewVD = getSema().createLambdaInitCaptureVarDecl(
15772 OldVD->getLocation(), InitQualType, NewC.EllipsisLoc,
15773 OldVD->getIdentifier(), OldVD->getInitStyle(),
Init.get(),
15774 getSema().CurContext);
15779 NewVDs.push_back(NewVD);
15780 getSema().addInitCapture(LSI, NewVD,
C->getCaptureKind() ==
LCK_ByRef);
15785 if (NewC.EllipsisLoc.isInvalid())
15786 LSI->ContainsUnexpandedParameterPack |=
15787 Init.get()->containsUnexpandedParameterPack();
15793 getDerived().transformedLocalDecl(OldVD, NewVDs);
15797 assert(
C->capturesVariable() &&
"unexpected kind of lambda capture");
15805 if (
C->isPackExpansion()) {
15807 bool ShouldExpand =
false;
15808 bool RetainExpansion =
false;
15810 if (getDerived().TryExpandParameterPacks(
15811 C->getEllipsisLoc(),
C->getLocation(), Unexpanded,
15812 true, ShouldExpand,
15813 RetainExpansion, NumExpansions)) {
15818 if (ShouldExpand) {
15823 for (
unsigned I = 0; I != *NumExpansions; ++I) {
15825 ValueDecl *CapturedVar = cast_if_present<ValueDecl>(
15826 getDerived().TransformDecl(
C->getLocation(), Pack));
15827 if (!CapturedVar) {
15833 getSema().tryCaptureVariable(CapturedVar,
C->getLocation(), Kind);
15841 EllipsisLoc =
C->getEllipsisLoc();
15845 auto *CapturedVar = cast_or_null<ValueDecl>(
15846 getDerived().TransformDecl(
C->getLocation(),
C->getCapturedVar()));
15847 if (!CapturedVar || CapturedVar->isInvalidDecl()) {
15854 if (
auto *VD = dyn_cast<VarDecl>(CapturedVar); VD && !
C->isPackExpansion())
15855 LSI->ContainsUnexpandedParameterPack |= VD->isParameterPack();
15858 getSema().tryCaptureVariable(CapturedVar,
C->getLocation(), Kind,
15861 getSema().finishLambdaExplicitCaptures(LSI);
15865 auto TPL = getDerived().TransformTemplateParameterList(
15866 E->getTemplateParameterList());
15867 LSI->GLTemplateParameterList = TPL;
15869 getSema().AddTemplateParametersToLambdaCallOperator(NewCallOperator,
Class,
15871 LSI->ContainsUnexpandedParameterPack |=
15872 TPL->containsUnexpandedParameterPack();
15877 E->getCallOperator()->getTypeSourceInfo()->getTypeLoc();
15879 getDerived().TransformType(NewCallOpTLBuilder, OldCallOpTypeLoc);
15880 if (NewCallOpType.isNull())
15882 LSI->ContainsUnexpandedParameterPack |=
15883 NewCallOpType->containsUnexpandedParameterPack();
15885 NewCallOpTLBuilder.getTypeSourceInfo(getSema().Context, NewCallOpType);
15890 assert(FPTL &&
"Not a FunctionProtoType?");
15893 if (!TRC.ArgPackSubstIndex)
15896 getSema().CompleteLambdaCallOperator(
15897 NewCallOperator, E->getCallOperator()->getLocation(),
15898 E->getCallOperator()->getInnerLocStart(), TRC, NewCallOpTSI,
15899 E->getCallOperator()->getConstexprKind(),
15900 E->getCallOperator()->getStorageClass(), FPTL.getParams(),
15901 E->hasExplicitResultType());
15903 getDerived().transformAttrs(E->getCallOperator(), NewCallOperator);
15904 getDerived().transformedLocalDecl(E->getCallOperator(), {NewCallOperator});
15910 std::optional<CXXRecordDecl::LambdaNumbering> Numbering;
15911 if (getDerived().ReplacingOriginal()) {
15912 Numbering = OldClass->getLambdaNumbering();
15915 getSema().handleLambdaNumbering(
Class, NewCallOperator, Numbering);
15920 getSema().PushExpressionEvaluationContextForFunction(
15922 E->getCallOperator());
15929 C.PointOfInstantiation = E->getBody()->getBeginLoc();
15930 getSema().pushCodeSynthesisContext(
C);
15934 : getDerived().TransformLambdaBody(E, E->getBody());
15936 getSema().popCodeSynthesisContext();
15940 FuncScopeCleanup.disable();
15942 if (Body.isInvalid()) {
15943 SavedContext.pop();
15944 getSema().ActOnLambdaError(E->getBeginLoc(),
nullptr,
15949 getSema().ActOnFinishFunctionBody(NewCallOperator, Body.get(),
15952 SavedContext.pop();
15987 DependencyKind = getDerived().ComputeLambdaDependency(LSI);
15988 Class->setLambdaDependencyKind(DependencyKind);
15990 return getDerived().RebuildLambdaExpr(E->getBeginLoc(),
15991 Body.get()->getEndLoc(), LSI);
15994template<
typename Derived>
16000template<
typename Derived>
16009 if (!
C->isImplicit())
16013 if (
C->capturesThis()) {
16014 getSema().CheckCXXThisCapture(
C->getLocation(),
C->isExplicit(),
16021 if (
C->capturesVLAType())
16024 assert(
C->capturesVariable() &&
"unexpected kind of lambda capture");
16028 VarDecl *CapturedVar = cast_or_null<VarDecl>(
16034 getSema().tryCaptureVariable(CapturedVar,
C->getLocation());
16040template<
typename Derived>
16049 bool ArgumentChanged =
false;
16061 if (!getDerived().AlwaysRebuild() &&
16067 return getDerived().RebuildCXXUnresolvedConstructExpr(
16071template<
typename Derived>
16080 if (!E->isImplicitAccess()) {
16081 OldBase = E->getBase();
16082 Base = getDerived().TransformExpr(OldBase);
16083 if (
Base.isInvalid())
16088 bool MayBePseudoDestructor =
false;
16090 E->getOperatorLoc(),
16091 E->isArrow()? tok::arrow : tok::period,
16093 MayBePseudoDestructor);
16094 if (
Base.isInvalid())
16097 ObjectType = ObjectTy.get();
16098 BaseType = ((
Expr*)
Base.get())->getType();
16101 BaseType = getDerived().TransformType(E->getBaseType());
16108 = getDerived().TransformFirstQualifierInScope(
16109 E->getFirstQualifierFoundInScope(),
16110 E->getQualifierLoc().getBeginLoc());
16113 if (E->getQualifier()) {
16115 = getDerived().TransformNestedNameSpecifierLoc(E->getQualifierLoc(),
16117 FirstQualifierInScope);
16129 = getDerived().TransformDeclarationNameInfo(E->getMemberNameInfo());
16130 if (!NameInfo.getName())
16133 if (!E->hasExplicitTemplateArgs()) {
16136 if (!getDerived().AlwaysRebuild() &&
16137 Base.get() == OldBase &&
16138 BaseType == E->getBaseType() &&
16139 QualifierLoc == E->getQualifierLoc() &&
16140 NameInfo.getName() == E->getMember() &&
16141 FirstQualifierInScope == E->getFirstQualifierFoundInScope())
16144 return getDerived().RebuildCXXDependentScopeMemberExpr(
Base.get(),
16147 E->getOperatorLoc(),
16150 FirstQualifierInScope,
16156 if (getDerived().TransformTemplateArguments(E->getTemplateArgs(),
16157 E->getNumTemplateArgs(),
16161 return getDerived().RebuildCXXDependentScopeMemberExpr(
Base.get(),
16164 E->getOperatorLoc(),
16167 FirstQualifierInScope,
16172template <
typename Derived>
16178 if (!Old->isImplicitAccess()) {
16179 Base = getDerived().TransformExpr(Old->getBase());
16180 if (
Base.isInvalid())
16183 getSema().PerformMemberExprBaseConversion(
Base.get(), Old->isArrow());
16184 if (
Base.isInvalid())
16186 BaseType =
Base.get()->getType();
16188 BaseType = getDerived().TransformType(Old->getBaseType());
16192 if (Old->getQualifierLoc()) {
16194 getDerived().TransformNestedNameSpecifierLoc(Old->getQualifierLoc());
16204 if (TransformOverloadExprDecls(Old,
false, R))
16208 if (Old->getNamingClass()) {
16210 getDerived().TransformDecl(Old->getMemberLoc(), Old->getNamingClass()));
16214 R.setNamingClass(NamingClass);
16218 if (Old->hasExplicitTemplateArgs()) {
16219 TransArgs.setLAngleLoc(Old->getLAngleLoc());
16220 TransArgs.setRAngleLoc(Old->getRAngleLoc());
16221 if (getDerived().TransformTemplateArguments(
16222 Old->getTemplateArgs(), Old->getNumTemplateArgs(), TransArgs))
16230 NamedDecl *FirstQualifierInScope =
nullptr;
16232 return getDerived().RebuildUnresolvedMemberExpr(
16233 Base.get(), BaseType, Old->getOperatorLoc(), Old->isArrow(), QualifierLoc,
16234 TemplateKWLoc, FirstQualifierInScope, R,
16235 (Old->hasExplicitTemplateArgs() ? &TransArgs :
nullptr));
16238template<
typename Derived>
16243 ExprResult SubExpr = getDerived().TransformExpr(E->getOperand());
16244 if (SubExpr.isInvalid())
16247 if (!getDerived().AlwaysRebuild() && SubExpr.get() == E->getOperand())
16250 return getDerived().RebuildCXXNoexceptExpr(E->getSourceRange(),SubExpr.get());
16253template<
typename Derived>
16256 ExprResult Pattern = getDerived().TransformExpr(E->getPattern());
16257 if (Pattern.isInvalid())
16260 if (!getDerived().AlwaysRebuild() && Pattern.get() == E->getPattern())
16263 return getDerived().RebuildPackExpansion(Pattern.get(), E->getEllipsisLoc(),
16264 E->getNumExpansions());
16267template <
typename Derived>
16272 if (!Arg.isPackExpansion()) {
16284 getSema().getTemplateArgumentPackExpansionPattern(ArgLoc, Ellipsis,
16285 OrigNumExpansions);
16297 if (!NumExpansions) {
16309template<
typename Derived>
16328 bool ShouldExpand =
false;
16329 bool RetainExpansion =
false;
16330 UnsignedOrNone NumExpansions = std::nullopt;
16331 if (getDerived().TryExpandParameterPacks(
16333 true, ShouldExpand,
16334 RetainExpansion, NumExpansions))
16339 if (ShouldExpand) {
16341 if (
auto *TTPD = dyn_cast<TemplateTypeParmDecl>(Pack)) {
16342 ArgStorage = getSema().Context.getPackExpansionType(
16343 getSema().Context.getTypeDeclType(TTPD), std::nullopt);
16344 }
else if (
auto *TTPD = dyn_cast<TemplateTemplateParmDecl>(Pack)) {
16348 ExprResult DRE = getSema().BuildDeclRefExpr(
16349 VD, VD->getType().getNonLValueExprType(getSema().Context),
16352 if (DRE.isInvalid())
16355 new (getSema().Context)
16359 PackArgs = ArgStorage;
16364 if (!PackArgs.size()) {
16365 auto *Pack = cast_or_null<NamedDecl>(
16369 return getDerived().RebuildSizeOfPackExpr(
16376 getDerived().ComputeSizeOfPackExprWithoutSubstitution(PackArgs);
16388 TemporaryBase Rebase(*
this, E->
getPackLoc(), getBaseEntity());
16391 if (TransformTemplateArguments(PackLocIterator(*
this, PackArgs.begin()),
16392 PackLocIterator(*
this, PackArgs.end()),
16393 TransformedPackArgs,
true))
16400 bool PartialSubstitution =
false;
16401 for (
auto &Loc : TransformedPackArgs.arguments()) {
16402 Args.push_back(Loc.getArgument());
16403 if (Loc.getArgument().isPackExpansion())
16404 PartialSubstitution =
true;
16407 if (PartialSubstitution)
16408 return getDerived().RebuildSizeOfPackExpr(
16410 std::nullopt, Args);
16412 return getDerived().RebuildSizeOfPackExpr(
16414 static_cast<unsigned>(Args.size()),
16418template <
typename Derived>
16421 if (!E->isValueDependent())
16429 IndexExpr = getDerived().TransformExpr(E->getIndexExpr());
16430 if (IndexExpr.isInvalid())
16435 bool FullySubstituted =
true;
16436 if (!E->expandsToEmptyPack() && E->getExpressions().empty()) {
16437 Expr *Pattern = E->getPackIdExpression();
16439 getSema().collectUnexpandedParameterPacks(E->getPackIdExpression(),
16441 assert(!Unexpanded.empty() &&
"Pack expansion without parameter packs?");
16445 bool ShouldExpand =
true;
16446 bool RetainExpansion =
false;
16448 NumExpansions = std::nullopt;
16449 if (getDerived().TryExpandParameterPacks(
16450 E->getEllipsisLoc(), Pattern->getSourceRange(), Unexpanded,
16451 true, ShouldExpand,
16452 RetainExpansion, NumExpansions))
16454 if (!ShouldExpand) {
16456 ExprResult Pack = getDerived().TransformExpr(Pattern);
16457 if (Pack.isInvalid())
16459 return getDerived().RebuildPackIndexingExpr(
16460 E->getEllipsisLoc(), E->getRSquareLoc(), Pack.get(), IndexExpr.get(),
16463 for (
unsigned I = 0; I != *NumExpansions; ++I) {
16466 if (
Out.isInvalid())
16468 if (
Out.get()->containsUnexpandedParameterPack()) {
16469 Out = getDerived().RebuildPackExpansion(
Out.get(), E->getEllipsisLoc(),
16470 OrigNumExpansions);
16471 if (
Out.isInvalid())
16473 FullySubstituted =
false;
16475 ExpandedExprs.push_back(
Out.get());
16479 if (RetainExpansion) {
16480 ForgetPartiallySubstitutedPackRAII Forget(getDerived());
16483 if (
Out.isInvalid())
16486 Out = getDerived().RebuildPackExpansion(
Out.get(), E->getEllipsisLoc(),
16487 OrigNumExpansions);
16488 if (
Out.isInvalid())
16490 FullySubstituted =
false;
16491 ExpandedExprs.push_back(
Out.get());
16493 }
else if (!E->expandsToEmptyPack()) {
16494 if (getDerived().TransformExprs(E->getExpressions().data(),
16495 E->getExpressions().size(),
false,
16500 return getDerived().RebuildPackIndexingExpr(
16501 E->getEllipsisLoc(), E->getRSquareLoc(), E->getPackIdExpression(),
16502 IndexExpr.get(), ExpandedExprs, FullySubstituted);
16505template <
typename Derived>
16508 if (!getSema().ArgPackSubstIndex)
16514 return getDerived().RebuildSubstNonTypeTemplateParmExpr(
16515 E->getAssociatedDecl(), E->getParameterPack(),
16516 E->getParameterPackLocation(), Arg, SemaRef.
getPackIndex(Pack),
16520template <
typename Derived>
16524 ExprResult Replacement = getDerived().TransformExpr(OrigReplacement);
16525 if (Replacement.isInvalid())
16528 Decl *AssociatedDecl =
16529 getDerived().TransformDecl(E->getNameLoc(), E->getAssociatedDecl());
16530 if (!AssociatedDecl)
16533 if (Replacement.get() == OrigReplacement &&
16534 AssociatedDecl == E->getAssociatedDecl())
16537 auto getParamAndType = [E](
Decl *AssociatedDecl)
16538 -> std::tuple<NonTypeTemplateParmDecl *, QualType> {
16539 auto [PDecl, Arg] =
16543 return {Param, Param->getType()};
16545 Arg = Arg.getPackAsArray()[*PackIndex];
16546 return {Param, Arg.getNonTypeTemplateArgumentType()};
16552 if (
auto [Param, ParamType] = getParamAndType(AssociatedDecl);
16554 ParamType, std::get<1>(getParamAndType(E->getAssociatedDecl()))) ||
16555 Replacement.get() != OrigReplacement) {
16562 Param, ParamType, Replacement.get(), SugaredConverted,
16563 CanonicalConverted,
16565 if (Replacement.isInvalid())
16569 Replacement = E->getReplacement();
16572 return getDerived().RebuildSubstNonTypeTemplateParmExpr(
16573 AssociatedDecl, E->getParameter(), E->getNameLoc(),
16575 E->getPackIndex(), E->getFinal());
16578template<
typename Derived>
16585template<
typename Derived>
16592template<
typename Derived>
16596 if (
Expr *OldCallee = E->getCallee()) {
16597 ExprResult CalleeResult = getDerived().TransformExpr(OldCallee);
16598 if (CalleeResult.isInvalid())
16603 Expr *Pattern = E->getPattern();
16606 getSema().collectUnexpandedParameterPacks(Pattern, Unexpanded);
16607 assert(!Unexpanded.empty() &&
"Pack expansion without parameter packs?");
16611 bool Expand =
true;
16612 bool RetainExpansion =
false;
16614 NumExpansions = OrigNumExpansions;
16615 if (getDerived().TryExpandParameterPacks(
16616 E->getEllipsisLoc(), Pattern->getSourceRange(), Unexpanded,
16617 true, Expand, RetainExpansion,
16627 E->getLHS() ? getDerived().TransformExpr(E->getLHS()) :
ExprResult();
16628 if (LHS.isInvalid())
16632 E->getRHS() ? getDerived().TransformExpr(E->getRHS()) :
ExprResult();
16633 if (RHS.isInvalid())
16636 if (!getDerived().AlwaysRebuild() &&
16637 LHS.get() == E->getLHS() && RHS.get() == E->getRHS())
16640 return getDerived().RebuildCXXFoldExpr(
16641 Callee, E->getBeginLoc(), LHS.get(), E->getOperator(),
16642 E->getEllipsisLoc(), RHS.get(), E->getEndLoc(), NumExpansions);
16648 if (NumExpansions && SemaRef.
getLangOpts().BracketDepth < *NumExpansions) {
16649 SemaRef.
Diag(E->getEllipsisLoc(),
16650 clang::diag::err_fold_expression_limit_exceeded)
16651 << *NumExpansions << SemaRef.
getLangOpts().BracketDepth
16652 << E->getSourceRange();
16653 SemaRef.
Diag(E->getEllipsisLoc(), diag::note_bracket_depth);
16662 bool LeftFold = E->isLeftFold();
16666 if (!LeftFold && RetainExpansion) {
16667 ForgetPartiallySubstitutedPackRAII Forget(getDerived());
16670 if (
Out.isInvalid())
16673 Result = getDerived().RebuildCXXFoldExpr(
16674 Callee, E->getBeginLoc(),
Out.get(), E->getOperator(),
16675 E->getEllipsisLoc(),
Result.get(), E->getEndLoc(), OrigNumExpansions);
16680 bool WarnedOnComparison =
false;
16681 for (
unsigned I = 0; I != *NumExpansions; ++I) {
16683 getSema(), LeftFold ? I : *NumExpansions - I - 1);
16685 if (
Out.isInvalid())
16688 if (
Out.get()->containsUnexpandedParameterPack()) {
16690 Result = getDerived().RebuildCXXFoldExpr(
16691 Callee, E->getBeginLoc(), LeftFold ?
Result.get() :
Out.get(),
16692 E->getOperator(), E->getEllipsisLoc(),
16693 LeftFold ?
Out.get() :
Result.get(), E->getEndLoc(),
16694 OrigNumExpansions);
16695 }
else if (
Result.isUsable()) {
16702 Result = getDerived().RebuildCXXOperatorCallExpr(
16704 E->getEllipsisLoc(),
Callee->getBeginLoc(),
Callee->requiresADL(),
16705 Functions, LHS, RHS);
16707 Result = getDerived().RebuildBinaryOperator(E->getEllipsisLoc(),
16708 E->getOperator(), LHS, RHS,
16710 if (!WarnedOnComparison &&
Result.isUsable()) {
16711 if (
auto *BO = dyn_cast<BinaryOperator>(
Result.get());
16712 BO && BO->isComparisonOp()) {
16713 WarnedOnComparison =
true;
16714 SemaRef.
Diag(BO->getBeginLoc(),
16715 diag::warn_comparison_in_fold_expression)
16716 << BO->getOpcodeStr();
16729 if (LeftFold && RetainExpansion) {
16730 ForgetPartiallySubstitutedPackRAII Forget(getDerived());
16733 if (
Out.isInvalid())
16736 Result = getDerived().RebuildCXXFoldExpr(
16737 Callee, E->getBeginLoc(),
Result.get(), E->getOperator(),
16738 E->getEllipsisLoc(),
Out.get(), E->getEndLoc(), OrigNumExpansions);
16744 PE->setIsProducedByFoldExpansion();
16749 return getDerived().RebuildEmptyCXXFoldExpr(E->getEllipsisLoc(),
16754template <
typename Derived>
16760 QualType T = getDerived().TransformType(E->getType());
16762 bool ArgChanged =
false;
16764 if (getDerived().TransformExprs(InitExprs.data(), InitExprs.size(),
true,
16765 TransformedInits, &ArgChanged))
16768 if (!getDerived().AlwaysRebuild() && !ArgChanged &&
T == E->getType())
16771 return getDerived().RebuildCXXParenListInitExpr(
16772 TransformedInits,
T, E->getUserSpecifiedInitExprs().size(),
16773 E->getInitLoc(), E->getBeginLoc(), E->getEndLoc());
16776template<
typename Derived>
16783template<
typename Derived>
16789template<
typename Derived>
16795template<
typename Derived>
16798 ExprResult SubExpr = getDerived().TransformExpr(E->getSubExpr());
16799 if (SubExpr.isInvalid())
16802 if (!getDerived().AlwaysRebuild() &&
16803 SubExpr.get() == E->getSubExpr())
16806 return getDerived().RebuildObjCBoxedExpr(E->getSourceRange(), SubExpr.get());
16809template<
typename Derived>
16814 bool ArgChanged =
false;
16815 if (getDerived().TransformExprs(E->getElements(), E->getNumElements(),
16816 false, Elements, &ArgChanged))
16819 if (!getDerived().AlwaysRebuild() && !ArgChanged)
16822 return getDerived().RebuildObjCArrayLiteral(E->getSourceRange(),
16827template<
typename Derived>
16833 bool ArgChanged =
false;
16834 for (
unsigned I = 0, N = E->getNumElements(); I != N; ++I) {
16837 if (OrigElement.isPackExpansion()) {
16840 getSema().collectUnexpandedParameterPacks(OrigElement.Key, Unexpanded);
16841 getSema().collectUnexpandedParameterPacks(OrigElement.Value, Unexpanded);
16842 assert(!Unexpanded.empty() &&
"Pack expansion without parameter packs?");
16846 bool Expand =
true;
16847 bool RetainExpansion =
false;
16850 SourceRange PatternRange(OrigElement.Key->getBeginLoc(),
16851 OrigElement.Value->getEndLoc());
16852 if (getDerived().TryExpandParameterPacks(
16853 OrigElement.EllipsisLoc, PatternRange, Unexpanded,
16854 true, Expand, RetainExpansion,
16863 ExprResult Key = getDerived().TransformExpr(OrigElement.Key);
16864 if (Key.isInvalid())
16867 if (Key.get() != OrigElement.Key)
16871 if (
Value.isInvalid())
16878 Key.get(),
Value.get(), OrigElement.EllipsisLoc, NumExpansions
16880 Elements.push_back(Expansion);
16890 for (
unsigned I = 0; I != *NumExpansions; ++I) {
16892 ExprResult Key = getDerived().TransformExpr(OrigElement.Key);
16893 if (Key.isInvalid())
16897 if (
Value.isInvalid())
16907 if (Key.get()->containsUnexpandedParameterPack() ||
16908 Value.get()->containsUnexpandedParameterPack())
16909 Element.EllipsisLoc = OrigElement.EllipsisLoc;
16911 Elements.push_back(Element);
16921 ExprResult Key = getDerived().TransformExpr(OrigElement.Key);
16922 if (Key.isInvalid())
16925 if (Key.get() != OrigElement.Key)
16930 = getDerived().TransformExpr(OrigElement.Value);
16931 if (
Value.isInvalid())
16939 Elements.push_back(Element);
16942 if (!getDerived().AlwaysRebuild() && !ArgChanged)
16945 return getDerived().RebuildObjCDictionaryLiteral(E->getSourceRange(),
16949template<
typename Derived>
16953 = getDerived().TransformType(E->getEncodedTypeSourceInfo());
16954 if (!EncodedTypeInfo)
16957 if (!getDerived().AlwaysRebuild() &&
16958 EncodedTypeInfo == E->getEncodedTypeSourceInfo())
16961 return getDerived().RebuildObjCEncodeExpr(E->getAtLoc(),
16963 E->getRParenLoc());
16966template<
typename Derived>
16976template<
typename Derived>
16980 = getDerived().TransformType(E->getTypeInfoAsWritten());
16988 if (!getDerived().AlwaysRebuild() &&
16989 TSInfo == E->getTypeInfoAsWritten() &&
16990 Result.get() == E->getSubExpr())
16994 E->getLParenLoc(), E->getBridgeKind(), E->getBridgeKeywordLoc(), TSInfo,
16998template <
typename Derived>
17004template<
typename Derived>
17008 bool ArgChanged =
false;
17010 Args.reserve(E->getNumArgs());
17011 if (getDerived().TransformExprs(E->getArgs(), E->getNumArgs(),
false, Args,
17018 = getDerived().TransformType(E->getClassReceiverTypeInfo());
17019 if (!ReceiverTypeInfo)
17023 if (!getDerived().AlwaysRebuild() &&
17024 ReceiverTypeInfo == E->getClassReceiverTypeInfo() && !ArgChanged)
17029 E->getSelectorLocs(SelLocs);
17030 return getDerived().RebuildObjCMessageExpr(ReceiverTypeInfo,
17033 E->getMethodDecl(),
17040 if (!E->getMethodDecl())
17045 E->getSelectorLocs(SelLocs);
17046 return getDerived().RebuildObjCMessageExpr(E->getSuperLoc(),
17049 E->getReceiverType(),
17050 E->getMethodDecl(),
17058 "Only class and instance messages may be instantiated");
17060 = getDerived().TransformExpr(E->getInstanceReceiver());
17061 if (Receiver.isInvalid())
17065 if (!getDerived().AlwaysRebuild() &&
17066 Receiver.get() == E->getInstanceReceiver() && !ArgChanged)
17071 E->getSelectorLocs(SelLocs);
17072 return getDerived().RebuildObjCMessageExpr(Receiver.get(),
17075 E->getMethodDecl(),
17081template<
typename Derived>
17087template<
typename Derived>
17093template<
typename Derived>
17098 if (
Base.isInvalid())
17104 if (!getDerived().AlwaysRebuild() &&
17105 Base.get() == E->getBase())
17108 return getDerived().RebuildObjCIvarRefExpr(
Base.get(), E->getDecl(),
17110 E->isArrow(), E->isFreeIvar());
17113template<
typename Derived>
17118 if (!E->isObjectReceiver())
17123 if (
Base.isInvalid())
17129 if (!getDerived().AlwaysRebuild() &&
17130 Base.get() == E->getBase())
17133 if (E->isExplicitProperty())
17134 return getDerived().RebuildObjCPropertyRefExpr(
Base.get(),
17135 E->getExplicitProperty(),
17138 return getDerived().RebuildObjCPropertyRefExpr(
Base.get(),
17140 E->getImplicitPropertyGetter(),
17141 E->getImplicitPropertySetter(),
17145template<
typename Derived>
17150 if (
Base.isInvalid())
17154 ExprResult Key = getDerived().TransformExpr(E->getKeyExpr());
17155 if (Key.isInvalid())
17159 if (!getDerived().AlwaysRebuild() &&
17160 Key.get() == E->getKeyExpr() &&
Base.get() == E->getBaseExpr())
17163 return getDerived().RebuildObjCSubscriptRefExpr(E->getRBracket(),
17164 Base.get(), Key.get(),
17165 E->getAtIndexMethodDecl(),
17166 E->setAtIndexMethodDecl());
17169template<
typename Derived>
17174 if (
Base.isInvalid())
17178 if (!getDerived().AlwaysRebuild() &&
17179 Base.get() == E->getBase())
17182 return getDerived().RebuildObjCIsaExpr(
Base.get(), E->getIsaMemberLoc(),
17187template<
typename Derived>
17190 bool ArgumentChanged =
false;
17192 SubExprs.reserve(E->getNumSubExprs());
17193 if (getDerived().TransformExprs(E->getSubExprs(), E->getNumSubExprs(),
false,
17194 SubExprs, &ArgumentChanged))
17197 if (!getDerived().AlwaysRebuild() &&
17201 return getDerived().RebuildShuffleVectorExpr(E->getBuiltinLoc(),
17203 E->getRParenLoc());
17206template<
typename Derived>
17209 ExprResult SrcExpr = getDerived().TransformExpr(E->getSrcExpr());
17210 if (SrcExpr.isInvalid())
17217 if (!getDerived().AlwaysRebuild() &&
17218 Type == E->getTypeSourceInfo() &&
17219 SrcExpr.get() == E->getSrcExpr())
17222 return getDerived().RebuildConvertVectorExpr(E->getBuiltinLoc(),
17223 SrcExpr.get(),
Type,
17224 E->getRParenLoc());
17227template<
typename Derived>
17230 BlockDecl *oldBlock = E->getBlockDecl();
17236 blockScope->TheDecl->setBlockMissingReturnType(
17237 oldBlock->blockMissingReturnType());
17246 if (getDerived().TransformFunctionTypeParams(
17247 E->getCaretLocation(), oldBlock->parameters(),
nullptr,
17248 exprFunctionType->getExtParameterInfosOrNull(), paramTypes, ¶ms,
17250 getSema().ActOnBlockError(E->getCaretLocation(),
nullptr);
17255 getDerived().TransformType(exprFunctionType->getReturnType());
17257 auto epi = exprFunctionType->getExtProtoInfo();
17258 epi.ExtParameterInfos = extParamInfos.getPointerOrNull(paramTypes.size());
17261 getDerived().RebuildFunctionProtoType(exprResultType, paramTypes, epi);
17265 if (!params.empty())
17266 blockScope->TheDecl->setParams(params);
17268 if (!oldBlock->blockMissingReturnType()) {
17269 blockScope->HasImplicitReturnType =
false;
17270 blockScope->ReturnType = exprResultType;
17274 StmtResult body = getDerived().TransformStmt(E->getBody());
17275 if (body.isInvalid()) {
17276 getSema().ActOnBlockError(E->getCaretLocation(),
nullptr);
17284 for (
const auto &I : oldBlock->captures()) {
17285 VarDecl *oldCapture = I.getVariable();
17288 if (oldCapture->isParameterPack())
17292 cast<VarDecl>(getDerived().TransformDecl(E->getCaretLocation(),
17294 assert(blockScope->CaptureMap.count(newCapture));
17300 assert((!blockScope->isCXXThisCaptured() || oldBlock->capturesCXXThis()) &&
17301 "this pointer isn't captured in the old block");
17309template<
typename Derived>
17312 ExprResult SrcExpr = getDerived().TransformExpr(E->getSrcExpr());
17313 if (SrcExpr.isInvalid())
17316 QualType Type = getDerived().TransformType(E->getType());
17319 E->getRParenLoc());
17322template<
typename Derived>
17325 bool ArgumentChanged =
false;
17327 SubExprs.reserve(E->getNumSubExprs());
17328 if (getDerived().TransformExprs(E->getSubExprs(), E->getNumSubExprs(),
false,
17329 SubExprs, &ArgumentChanged))
17332 if (!getDerived().AlwaysRebuild() &&
17336 return getDerived().RebuildAtomicExpr(E->getBuiltinLoc(), SubExprs,
17337 E->getOp(), E->getRParenLoc());
17344template<
typename Derived>
17347 return SemaRef.BuildPointerType(PointeeType,
Star,
17351template<
typename Derived>
17354 return SemaRef.BuildBlockPointerType(PointeeType,
Star,
17358template<
typename Derived>
17361 bool WrittenAsLValue,
17363 return SemaRef.BuildReferenceType(ReferentType, WrittenAsLValue,
17367template <
typename Derived>
17371 return SemaRef.BuildMemberPointerType(PointeeType, SS, Cls, Sigil,
17375template<
typename Derived>
17382 return SemaRef.ObjC().BuildObjCTypeParamType(
17383 Decl, ProtocolLAngleLoc, Protocols, ProtocolLocs, ProtocolRAngleLoc,
17387template<
typename Derived>
17398 return SemaRef.ObjC().BuildObjCObjectType(
17399 BaseType, Loc, TypeArgsLAngleLoc, TypeArgs, TypeArgsRAngleLoc,
17400 ProtocolLAngleLoc, Protocols, ProtocolLocs, ProtocolRAngleLoc,
17405template<
typename Derived>
17409 return SemaRef.Context.getObjCObjectPointerType(PointeeType);
17412template <
typename Derived>
17415 Expr *SizeExpr,
unsigned IndexTypeQuals,
SourceRange BracketsRange) {
17416 if (SizeExpr || !Size)
17417 return SemaRef.BuildArrayType(ElementType, SizeMod, SizeExpr,
17418 IndexTypeQuals, BracketsRange,
17422 SemaRef.Context.UnsignedCharTy,
SemaRef.Context.UnsignedShortTy,
17424 SemaRef.Context.UnsignedLongLongTy,
SemaRef.Context.UnsignedInt128Ty
17427 for (
const auto &
T : Types)
17428 if (Size->getBitWidth() ==
SemaRef.Context.getIntWidth(
T)) {
17438 return SemaRef.BuildArrayType(ElementType, SizeMod, ArraySize,
17439 IndexTypeQuals, BracketsRange,
17443template <
typename Derived>
17446 Expr *SizeExpr,
unsigned IndexTypeQuals,
SourceRange BracketsRange) {
17447 return getDerived().RebuildArrayType(ElementType, SizeMod, &Size, SizeExpr,
17448 IndexTypeQuals, BracketsRange);
17451template <
typename Derived>
17455 return getDerived().RebuildArrayType(ElementType, SizeMod,
nullptr,
nullptr,
17456 IndexTypeQuals, BracketsRange);
17459template <
typename Derived>
17462 unsigned IndexTypeQuals,
SourceRange BracketsRange) {
17463 return getDerived().RebuildArrayType(ElementType, SizeMod,
nullptr,
17465 IndexTypeQuals, BracketsRange);
17468template <
typename Derived>
17471 unsigned IndexTypeQuals,
SourceRange BracketsRange) {
17472 return getDerived().RebuildArrayType(ElementType, SizeMod,
nullptr,
17474 IndexTypeQuals, BracketsRange);
17477template <
typename Derived>
17480 return SemaRef.BuildAddressSpaceAttr(PointeeType, AddrSpaceExpr,
17484template <
typename Derived>
17486 unsigned NumElements,
17489 return SemaRef.Context.getVectorType(ElementType, NumElements, VecKind);
17492template <
typename Derived>
17496 return SemaRef.BuildVectorType(ElementType, SizeExpr, AttributeLoc);
17499template<
typename Derived>
17501 unsigned NumElements,
17503 llvm::APInt numElements(
SemaRef.Context.getIntWidth(
SemaRef.Context.IntTy),
17504 NumElements,
true);
17508 return SemaRef.BuildExtVectorType(ElementType, VectorSize, AttributeLoc);
17511template<
typename Derived>
17516 return SemaRef.BuildExtVectorType(ElementType, SizeExpr, AttributeLoc);
17519template <
typename Derived>
17521 QualType ElementType,
unsigned NumRows,
unsigned NumColumns) {
17522 return SemaRef.Context.getConstantMatrixType(ElementType, NumRows,
17526template <
typename Derived>
17530 return SemaRef.BuildMatrixType(ElementType, RowExpr, ColumnExpr,
17534template <
typename Derived>
17538 return SemaRef.BuildFunctionType(
T, ParamTypes,
17544template<
typename Derived>
17546 return SemaRef.Context.getFunctionNoProtoType(
T);
17549template <
typename Derived>
17553 assert(D &&
"no decl found");
17557 if (
auto *UPD = dyn_cast<UsingPackDecl>(D)) {
17561 if (UPD->expansions().empty()) {
17562 getSema().Diag(NameLoc, diag::err_using_pack_expansion_empty)
17563 << UPD->isCXXClassMember() << UPD;
17572 for (
auto *E : UPD->expansions()) {
17579 else if (
T.isNull())
17582 assert(
getSema().Context.hasSameType(ThisT,
T) &&
17583 "mismatched resolved types in using pack expansion");
17585 return T.isNull() ? FallbackT :
T;
17587 if (
auto *Using = dyn_cast<UsingDecl>(D)) {
17588 assert(Using->hasTypename() &&
17589 "UnresolvedUsingTypenameDecl transformed to non-typename using");
17592 assert(++Using->shadow_begin() == Using->shadow_end());
17597 return SemaRef.Context.getUsingType(
Keyword, Qualifier, Shadow);
17600 "UnresolvedUsingTypenameDecl transformed to non-using decl");
17601 return SemaRef.Context.getUnresolvedUsingType(
17605template <
typename Derived>
17608 return SemaRef.BuildTypeofExprType(E, Kind);
17611template<
typename Derived>
17614 return SemaRef.Context.getTypeOfType(Underlying, Kind);
17617template <
typename Derived>
17619 return SemaRef.BuildDecltypeType(E);
17622template <
typename Derived>
17627 return SemaRef.BuildPackIndexingType(Pattern, IndexExpr, Loc, EllipsisLoc,
17628 FullySubstituted, Expansions);
17631template<
typename Derived>
17633 UnaryTransformType::UTTKind UKind,
17635 return SemaRef.BuildUnaryTransformType(BaseType, UKind, Loc);
17638template <
typename Derived>
17642 return SemaRef.CheckTemplateIdType(
17647template<
typename Derived>
17650 return SemaRef.BuildAtomicType(ValueType, KWLoc);
17653template<
typename Derived>
17657 return isReadPipe ?
SemaRef.BuildReadPipeType(ValueType, KWLoc)
17658 :
SemaRef.BuildWritePipeType(ValueType, KWLoc);
17661template <
typename Derived>
17665 llvm::APInt NumBitsAP(
SemaRef.Context.getIntWidth(
SemaRef.Context.IntTy),
17669 return SemaRef.BuildBitIntType(IsUnsigned, Bits, Loc);
17672template <
typename Derived>
17675 return SemaRef.BuildBitIntType(IsUnsigned, NumBitsExpr, Loc);
17678template <
typename Derived>
17686template <
typename Derived>
17693 getSema().ActOnTemplateName(
nullptr, SS, TemplateKWLoc,
17696 AllowInjectedClassName);
17700template<
typename Derived>
17707 bool AllowInjectedClassName) {
17710 SourceLocation SymbolLocations[3] = { NameLoc, NameLoc, NameLoc };
17715 false,
Template, AllowInjectedClassName);
17719template <
typename Derived>
17724 bool isPostIncDec = Second && (Op == OO_PlusPlus || Op == OO_MinusMinus);
17729 return SemaRef.PseudoObject().checkAssignment(
nullptr, OpLoc,
17730 Opc,
First, Second);
17745 if (Op == OO_Subscript) {
17746 if (!
First->getType()->isOverloadableType() &&
17748 return getSema().CreateBuiltinArraySubscriptExpr(
First, CalleeLoc, Second,
17750 }
else if (Op == OO_Arrow) {
17753 if (
First->getType()->isDependentType())
17756 return SemaRef.BuildOverloadedArrowExpr(
nullptr,
First, OpLoc);
17757 }
else if (Second ==
nullptr || isPostIncDec) {
17758 if (!
First->getType()->isOverloadableType() ||
17759 (Op == OO_Amp &&
getSema().isQualifiedMemberAccess(
First))) {
17766 return getSema().CreateBuiltinUnaryOp(OpLoc, Opc,
First);
17770 !
First->getType()->isOverloadableType() &&
17776 =
SemaRef.CreateBuiltinBinOp(OpLoc, Opc,
First, Second);
17785 if (!Second || isPostIncDec) {
17788 return SemaRef.CreateOverloadedUnaryOp(OpLoc, Opc, Functions,
First,
17795 First, Second, RequiresADL);
17802template<
typename Derived>
17812 QualType CanonicalBaseType =
Base->getType().getCanonicalType();
17818 ->getAsCanonical<RecordType>())) {
17820 return SemaRef.BuildPseudoDestructorExpr(
17821 Base, OperatorLoc, isArrow ? tok::arrow : tok::period, SS, ScopeType,
17822 CCLoc, TildeLoc, Destroyed);
17834 if (!
isa<TagType>(ScopeType->getType().getCanonicalType())) {
17835 getSema().Diag(ScopeType->getTypeLoc().getBeginLoc(),
17836 diag::err_expected_class_or_namespace)
17837 << ScopeType->getType() <<
getSema().getLangOpts().CPlusPlus;
17841 SS.
Make(
SemaRef.Context, ScopeType->getTypeLoc(), CCLoc);
17845 return getSema().BuildMemberReferenceExpr(
17846 Base,
Base->getType(), OperatorLoc, isArrow, SS, TemplateKWLoc,
17852template<
typename Derived>
17860 for (
unsigned I = 0; I < NumParams; ++I) {
17861 if (I != ContextParamPos) {
17867 Params.push_back(std::make_pair(StringRef(), QualType()));
17870 getSema().ActOnCapturedRegionStart(Loc,
nullptr,
17878 if (Body.isInvalid()) {
17879 getSema().ActOnCapturedRegionError();
17883 return getSema().ActOnCapturedRegionEnd(Body.get());
17886template <
typename Derived>
17892 llvm_unreachable(
"SYCL kernel call statement cannot appear in dependent "
17896template <
typename Derived>
static Decl::Kind getKind(const Decl *D)
Defines the C++ template declaration subclasses.
Defines the clang::Expr interface and subclasses for C++ expressions.
Defines Expressions and AST nodes for C++2a concepts.
llvm::MachO::Record Record
This file defines OpenMP AST classes for clauses.
Defines some OpenMP-specific enums and functions.
This file declares semantic analysis for Objective-C.
This file declares semantic analysis for OpenACC constructs and clauses.
This file declares semantic analysis for OpenMP constructs and clauses.
This file declares semantic analysis for expressions involving.
This file declares semantic analysis for SYCL constructs.
static bool PreparePackForExpansion(Sema &S, const CXXBaseSpecifier &Base, const MultiLevelTemplateArgumentList &TemplateArgs, TypeSourceInfo *&Out, UnexpandedInfo &Info)
Defines the Objective-C statement AST node classes.
This file defines OpenACC AST classes for statement-level contructs.
This file defines OpenMP AST classes for executable directives and clauses.
This file defines SYCL AST classes used to represent calls to SYCL kernels.
static QualType getPointeeType(const MemRegion *R)
QualType getAttributedType(attr::Kind attrKind, QualType modifiedType, QualType equivalentType, const Attr *attr=nullptr) const
QualType getArrayParameterType(QualType Ty) const
Return the uniqued reference to a specified array parameter type from the original array type.
QualType getSubstTemplateTypeParmType(QualType Replacement, Decl *AssociatedDecl, unsigned Index, UnsignedOrNone PackIndex, bool Final) const
Retrieve a substitution-result type.
QualType getDecayedType(QualType T) const
Return the uniqued reference to the decayed version of the given type.
QualType getBaseElementType(const ArrayType *VAT) const
Return the innermost element type of an array type.
TypeSourceInfo * getTrivialTypeSourceInfo(QualType T, SourceLocation Loc=SourceLocation()) const
Allocate a TypeSourceInfo where all locations have been initialized to a given location,...
CanQualType PseudoObjectTy
QualType getObjCObjectPointerType(QualType OIT) const
Return a ObjCObjectPointerType type for the given ObjCObjectType.
const ArrayType * getAsArrayType(QualType T) const
Type Query functions.
QualType getPackExpansionType(QualType Pattern, UnsignedOrNone NumExpansions, bool ExpectPackInType=true) const
Form a pack expansion type with the given pattern.
static bool hasSameType(QualType T1, QualType T2)
Determine whether the given types T1 and T2 are equivalent.
QualType getSizeType() const
Return the unique type for "size_t" (C99 7.17), defined in <stddef.h>.
TemplateName getSubstTemplateTemplateParmPack(const TemplateArgument &ArgPack, Decl *AssociatedDecl, unsigned Index, bool Final) const
QualType getHLSLAttributedResourceType(QualType Wrapped, QualType Contained, const HLSLAttributedResourceType::Attributes &Attrs)
AddrLabelExpr - The GNU address of label extension, representing &&label.
Represents the index of the current element of an array being initialized by an ArrayInitLoopExpr.
Represents a loop initializing the elements of an array.
Wrapper for source info for array parameter types.
This class represents BOTH the OpenMP Array Section and OpenACC 'subarray', with a boolean differenti...
ArraySubscriptExpr - [C99 6.5.2.1] Array Subscripting.
Wrapper for source info for arrays.
void setLBracketLoc(SourceLocation Loc)
An Embarcadero array type trait, as used in the implementation of __array_rank and __array_extent.
SourceLocation getEndLoc() const LLVM_READONLY
ArrayTypeTrait getTrait() const
Expr * getDimensionExpression() const
TypeSourceInfo * getQueriedTypeSourceInfo() const
SourceLocation getBeginLoc() const LLVM_READONLY
Represents an array type, per C99 6.7.5.2 - Array Declarators.
AsTypeExpr - Clang builtin function __builtin_astype [OpenCL 6.2.4.2] This AST node provides support ...
AtomicExpr - Variadic atomic builtins: __atomic_exchange, __atomic_fetch_*, __atomic_load,...
void setKWLoc(SourceLocation Loc)
Attr - This represents one attribute.
attr::Kind getKind() const
Represents an attribute applied to a statement.
SourceLocation getAttrLoc() const
ArrayRef< const Attr * > getAttrs() const
Type source information for an attributed type.
void setAttr(const Attr *A)
Type source information for an btf_tag attributed type.
BinaryConditionalOperator - The GNU extension to the conditional operator which allows the middle ope...
A builtin binary operation expression such as "x + y" or "x <= y".
static OverloadedOperatorKind getOverloadedOperator(Opcode Opc)
Retrieve the overloaded operator kind that corresponds to the given binary opcode.
static bool isAssignmentOp(Opcode Opc)
static Opcode getOverloadedOpcode(OverloadedOperatorKind OO)
Retrieve the binary opcode that corresponds to the given overloaded operator.
A fixed int type of a specified bitwidth.
Represents a block literal declaration, which is like an unnamed FunctionDecl.
void setIsVariadic(bool value)
BlockExpr - Adaptor class for mixing a BlockDecl with expressions.
Wrapper for source info for block pointers.
BreakStmt - This represents a break.
Represents a C++2a __builtin_bit_cast(T, v) expression.
SourceLocation getEndLoc() const LLVM_READONLY
SourceLocation getBeginLoc() const LLVM_READONLY
CStyleCastExpr - An explicit cast in C (C99 6.5.4) or a C-style cast in C++ (C++ [expr....
Represents a call to a CUDA kernel function.
A C++ addrspace_cast expression (currently only enabled for OpenCL).
Represents binding an expression to a temporary.
A boolean literal, per ([C++ lex.bool] Boolean literals).
CXXCatchStmt - This represents a C++ catch block.
A C++ const_cast expression (C++ [expr.const.cast]).
Represents a call to a C++ constructor.
SourceRange getParenOrBraceRange() const
Expr * getArg(unsigned Arg)
Return the specified argument.
bool isStdInitListInitialization() const
Whether this constructor call was written as list-initialization, but was interpreted as forming a st...
SourceLocation getEndLoc() const LLVM_READONLY
SourceLocation getBeginLoc() const LLVM_READONLY
bool isListInitialization() const
Whether this constructor call was written as list-initialization.
unsigned getNumArgs() const
Return the number of arguments to the constructor call.
Represents a C++ constructor within a class.
A default argument (C++ [dcl.fct.default]).
static CXXDefaultArgExpr * Create(const ASTContext &C, SourceLocation Loc, ParmVarDecl *Param, Expr *RewrittenExpr, DeclContext *UsedContext)
A use of a default initializer in a constructor or in aggregate initialization.
Represents a delete expression for memory deallocation and destructor calls, e.g.
Represents a C++ member access expression where the actual member referenced could not be resolved be...
Represents a C++ destructor within a class.
A C++ dynamic_cast expression (C++ [expr.dynamic.cast]).
Represents a folding of a pack over an operator.
CXXForRangeStmt - This represents C++0x [stmt.ranged]'s ranged for statement, represented as 'for (ra...
Represents an explicit C++ type conversion that uses "functional" notation (C++ [expr....
Represents a call to an inherited base class constructor from an inheriting constructor.
Represents a call to a member function that may be written either with member call syntax (e....
Represents a static or instance method of a struct/union/class.
Abstract class common to all of the C++ "named"/"keyword" casts.
SourceLocation getOperatorLoc() const
Retrieve the location of the cast operator keyword, e.g., static_cast.
SourceRange getAngleBrackets() const LLVM_READONLY
SourceLocation getRParenLoc() const
Retrieve the location of the closing parenthesis.
Represents a new-expression for memory allocation and constructor calls, e.g: "new CXXNewExpr(foo)".
Represents a C++11 noexcept expression (C++ [expr.unary.noexcept]).
The null pointer literal (C++11 [lex.nullptr])
A call to an overloaded operator written using operator syntax.
Represents a list-initialization with parenthesis.
Represents a C++ pseudo-destructor (C++ [expr.pseudo]).
Represents a C++ struct/union/class.
unsigned getLambdaDependencyKind() const
A C++ reinterpret_cast expression (C++ [expr.reinterpret.cast]).
A rewritten comparison expression that was originally written using operator syntax.
An expression "T()" which creates an rvalue of a non-class type T.
Represents a C++ nested-name-specifier or a global scope specifier.
void Make(ASTContext &Context, TypeLoc TL, SourceLocation ColonColonLoc)
Make a nested-name-specifier of the form 'type::'.
char * location_data() const
Retrieve the data associated with the source-location information.
SourceRange getRange() const
void MakeGlobal(ASTContext &Context, SourceLocation ColonColonLoc)
Turn this (empty) nested-name-specifier into the global nested-name-specifier '::'.
NestedNameSpecifier getScopeRep() const
Retrieve the representation of the nested-name-specifier.
NestedNameSpecifierLoc getWithLocInContext(ASTContext &Context) const
Retrieve a nested-name-specifier with location information, copied into the given AST context.
unsigned location_size() const
Retrieve the size of the data associated with source-location information.
void Extend(ASTContext &Context, NamespaceBaseDecl *Namespace, SourceLocation NamespaceLoc, SourceLocation ColonColonLoc)
Extend the current nested-name-specifier by another nested-name-specifier component of the form 'name...
void MakeMicrosoftSuper(ASTContext &Context, CXXRecordDecl *RD, SourceLocation SuperLoc, SourceLocation ColonColonLoc)
Turns this (empty) nested-name-specifier into '__super' nested-name-specifier.
bool isEmpty() const
No scope specifier.
void Adopt(NestedNameSpecifierLoc Other)
Adopt an existing nested-name-specifier (with source-range information).
Implicit construction of a std::initializer_list<T> object from an array temporary within list-initia...
Represents a C++ functional cast expression that builds a temporary object.
Represents the this expression in C++.
A C++ throw-expression (C++ [except.throw]).
CXXTryStmt - A C++ try block, including all handlers.
A C++ typeid expression (C++ [expr.typeid]), which gets the type_info that corresponds to the supplie...
Describes an explicit type conversion that uses functional notion but could not be resolved because o...
SourceLocation getLParenLoc() const
Retrieve the location of the left parentheses ('(') that precedes the argument list.
bool isListInitialization() const
Determine whether this expression models list-initialization.
TypeSourceInfo * getTypeSourceInfo() const
Retrieve the type source information for the type being constructed.
SourceLocation getRParenLoc() const
Retrieve the location of the right parentheses (')') that follows the argument list.
unsigned getNumArgs() const
Retrieve the number of arguments.
A Microsoft C++ __uuidof expression, which gets the _GUID that corresponds to the supplied type or ex...
CallExpr - Represents a function call (C99 6.5.2.2, C++ [expr.call]).
static CallExpr * Create(const ASTContext &Ctx, Expr *Fn, ArrayRef< Expr * > Args, QualType Ty, ExprValueKind VK, SourceLocation RParenLoc, FPOptionsOverride FPFeatures, unsigned MinNumArgs=0, ADLCallKind UsesADL=NotADL)
Create a call expression.
Represents the body of a CapturedStmt, and serves as its DeclContext.
unsigned getNumParams() const
unsigned getContextParamPosition() const
ImplicitParamDecl * getParam(unsigned i) const
This captures a statement into a function.
CapturedDecl * getCapturedDecl()
Retrieve the outlined function declaration.
Stmt * getCapturedStmt()
Retrieve the statement being captured.
SourceLocation getBeginLoc() const LLVM_READONLY
CapturedRegionKind getCapturedRegionKind() const
Retrieve the captured region kind.
CaseStmt - Represent a case statement.
Expr * getSubExprAsWritten()
Retrieve the cast subexpression as it was written in the source code, looking through any implicit ca...
ChooseExpr - GNU builtin-in function __builtin_choose_expr.
Represents a 'co_await' expression.
CompoundAssignOperator - For compound assignments (e.g.
CompoundLiteralExpr - [C99 6.5.2.5].
CompoundStmt - This represents a group of statements like { stmt stmt }.
FPOptionsOverride getStoredFPFeatures() const
Get FPOptionsOverride from trailing storage.
SourceLocation getLBracLoc() const
bool hasStoredFPFeatures() const
SourceLocation getRBracLoc() const
Declaration of a C++20 concept.
static ConceptReference * Create(const ASTContext &C, NestedNameSpecifierLoc NNS, SourceLocation TemplateKWLoc, DeclarationNameInfo ConceptNameInfo, NamedDecl *FoundDecl, TemplateDecl *NamedConcept, const ASTTemplateArgumentListInfo *ArgsAsWritten)
Represents the specialization of a concept - evaluates to a prvalue of type bool.
const TypeClass * getTypePtr() const
ConditionalOperator - The ?
Represents the canonical version of C arrays with a specified constant size.
ConstantExpr - An expression that occurs in a constant context and optionally the result of evaluatin...
Represents a concrete matrix type with constant number of rows and columns.
ContinueStmt - This represents a continue.
ConvertVectorExpr - Clang builtin function __builtin_convertvector This AST node provides support for...
Represents a 'co_return' statement in the C++ Coroutines TS.
Represents the body of a coroutine.
Represents a sugar type with __counted_by or __sized_by annotations, including their _or_null variant...
Represents a 'co_yield' expression.
Wrapper for source info for pointers decayed from arrays and functions.
static DeclAccessPair make(NamedDecl *D, AccessSpecifier AS)
DeclContext - This is used only as base class of specific decl types that can act as declaration cont...
DeclContext * getParent()
getParent - Returns the containing DeclContext.
DeclContextLookupResult lookup_result
lookup_result lookup(DeclarationName Name) const
lookup - Find the declarations (if any) with the given Name in this context.
void addDecl(Decl *D)
Add the declaration D into this context.
A reference to a declared variable, function, enum, etc.
DeclStmt - Adaptor class for mixing declarations with statements and expressions.
Decl - This represents one declaration (or definition), e.g.
bool isInvalidDecl() const
SourceLocation getLocation() const
DeclContext * getDeclContext()
AccessSpecifier getAccess() const
The name of a declaration.
TemplateDecl * getCXXDeductionGuideTemplate() const
If this name is the name of a C++ deduction guide, return the template associated with that name.
@ CXXConversionFunctionName
QualType getCXXNameType() const
If this name is one of the C++ names (of a constructor, destructor, or conversion function),...
NameKind getNameKind() const
Determine what kind of name this is.
SourceLocation getInnerLocStart() const
Return start of source range ignoring outer template declarations.
TypeSourceInfo * getTypeSourceInfo() const
Information about one declarator, including the parsed type information and the identifier.
void setDecltypeLoc(SourceLocation Loc)
void setElaboratedKeywordLoc(SourceLocation Loc)
DeferStmt - This represents a deferred statement.
static DeferStmt * Create(ASTContext &Context, SourceLocation DeferLoc, Stmt *Body)
void setAttrOperandParensRange(SourceRange range)
Represents an extended address space qualifier where the input address space value is dependent.
Represents a 'co_await' expression while the type of the promise is dependent.
void setElaboratedKeywordLoc(SourceLocation Loc)
A qualified reference to a name whose declaration cannot yet be resolved.
SourceLocation getRAngleLoc() const
Retrieve the location of the right angle bracket ending the explicit template argument list following...
NestedNameSpecifierLoc getQualifierLoc() const
Retrieve the nested-name-specifier that qualifies the name, with source location information.
SourceLocation getLAngleLoc() const
Retrieve the location of the left angle bracket starting the explicit template argument list followin...
bool hasExplicitTemplateArgs() const
Determines whether this lookup had explicit template arguments.
SourceLocation getTemplateKeywordLoc() const
Retrieve the location of the template keyword preceding this name, if any.
unsigned getNumTemplateArgs() const
DeclarationName getDeclName() const
Retrieve the name that this expression refers to.
TemplateArgumentLoc const * getTemplateArgs() const
const DeclarationNameInfo & getNameInfo() const
Retrieve the name that this expression refers to.
Represents an array type in C++ whose size is a value-dependent expression.
void setNameLoc(SourceLocation Loc)
Represents an extended vector type where either the type or size is dependent.
Represents a matrix type where the type and the number of rows and columns is dependent on a template...
void setNameLoc(SourceLocation Loc)
Represents a vector type where either the type or size is dependent.
Represents a single C99 designator.
Represents a C99 designated initializer expression.
Designation - Represent a full designation, which is a sequence of designators.
static Designator CreateArrayRangeDesignator(Expr *Start, Expr *End, SourceLocation LBracketLoc, SourceLocation EllipsisLoc)
Creates a GNU array-range designator.
static Designator CreateArrayDesignator(Expr *Index, SourceLocation LBracketLoc)
Creates an array designator.
static Designator CreateFieldDesignator(const IdentifierInfo *FieldName, SourceLocation DotLoc, SourceLocation FieldLoc)
Creates a field designator.
bool hasErrorOccurred() const
DoStmt - This represents a 'do/while' stmt.
Wrap a function effect's condition expression in another struct so that FunctionProtoType's TrailingO...
Expr * getCondition() const
void set(SourceLocation ElaboratedKeywordLoc, NestedNameSpecifierLoc QualifierLoc, SourceLocation NameLoc)
Represents a reference to emded data.
RAII object that enters a new expression evaluation context.
Wrapper for source info for enum types.
TypeSourceInfo * getTypeInfoAsWritten() const
getTypeInfoAsWritten - Returns the type source info for the type that this expression is casting to.
Represents an expression – generally a full-expression – that introduces cleanups to be run at the en...
This represents one expression.
bool isValueDependent() const
Determines whether the value of this expression depends on.
bool isTypeDependent() const
Determines whether the type of this expression depends on.
ExprObjectKind getObjectKind() const
getObjectKind - The object kind that this expression produces.
Expr * IgnoreImplicitAsWritten() LLVM_READONLY
Skip past any implicit AST nodes which might surround this expression until reaching a fixed point.
bool isDefaultArgument() const
Determine whether this expression is a default function argument.
bool hasPlaceholderType() const
Returns whether this expression has a placeholder type.
static ExprValueKind getValueKindForType(QualType T)
getValueKindForType - Given a formal return or parameter type, give its value kind.
An expression trait intrinsic.
ExtVectorElementExpr - This represents access to specific elements of a vector, and may occur on the ...
Represents difference between two FPOptions values.
FPOptions applyOverrides(FPOptions Base)
Represents a member of a struct/union/class.
ForStmt - This represents a 'for (init;cond;inc)' stmt.
Represents a function declaration or definition.
ArrayRef< ParmVarDecl * > parameters() const
SmallVector< Conflict > Conflicts
Represents an abstract function effect, using just an enumeration describing its kind.
StringRef name() const
The description printed in diagnostics, e.g. 'nonblocking'.
Kind oppositeKind() const
Return the opposite kind, for effects which have opposites.
ArrayRef< EffectConditionExpr > conditions() const
Represents a K&R-style 'int foo()' function, which has no information available about its arguments.
Represents a reference to a function parameter pack, init-capture pack, or binding pack that has been...
Represents a prototype with parameter type info, e.g.
param_type_iterator param_type_begin() const
unsigned getNumParams() const
SourceLocation getLocalRangeEnd() const
void setLocalRangeBegin(SourceLocation L)
void setLParenLoc(SourceLocation Loc)
SourceRange getExceptionSpecRange() const
void setParam(unsigned i, ParmVarDecl *VD)
ArrayRef< ParmVarDecl * > getParams() const
void setRParenLoc(SourceLocation Loc)
void setLocalRangeEnd(SourceLocation L)
void setExceptionSpecRange(SourceRange R)
TypeLoc getReturnLoc() const
SourceLocation getLocalRangeBegin() const
SourceLocation getLParenLoc() const
SourceLocation getRParenLoc() const
Interesting information about a specific parameter that can't simply be reflected in parameter's type...
This represents a GCC inline-assembly statement extension.
GNUNullExpr - Implements the GNU __null extension, which is a name for a null pointer constant that h...
Represents a C11 generic selection.
AssociationTy< false > Association
GotoStmt - This represents a direct goto.
Type source information for HLSL attributed resource type.
This class represents temporary values used to represent inout and out arguments in HLSL.
One of these records is kept for each identifier that is lexed.
IfStmt - This represents an if/then/else.
ImaginaryLiteral - We support imaginary integer and floating point literals, like "1....
ImplicitCastExpr - Allows us to explicitly represent implicit type conversions, which have no direct ...
Represents an implicitly-generated value initialization of an object of a given type.
Represents a C array with an unspecified size.
IndirectGotoStmt - This represents an indirect goto.
const TypeClass * getTypePtr() const
Describes an C or C++ initializer list.
InitListExpr * getSyntacticForm() const
Wrapper for source info for injected class names of class templates.
static IntegerLiteral * Create(const ASTContext &C, const llvm::APInt &V, QualType type, SourceLocation l)
Returns a new integer literal with value 'V' and type 'type'.
Represents the declaration of a label.
LabelStmt - Represents a label, which has a substatement.
A C++ lambda expression, which produces a function object (of unspecified type) that can be invoked l...
capture_iterator capture_begin() const
Retrieve an iterator pointing to the first lambda capture.
bool isInitCapture(const LambdaCapture *Capture) const
Determine whether one of this lambda's captures is an init-capture.
capture_iterator capture_end() const
Retrieve an iterator pointing past the end of the sequence of lambda captures.
const LambdaCapture * capture_iterator
An iterator that walks over the captures of the lambda, both implicit and explicit.
Represents the results of name lookup.
LLVM_ATTRIBUTE_REINITIALIZES void clear()
Clears out any current state.
void addDecl(NamedDecl *D)
Add a declaration to these results with its natural access.
bool empty() const
Return true if no decls were found.
void resolveKind()
Resolves the result kind of the lookup, possibly hiding decls.
SourceLocation getNameLoc() const
Gets the location of the identifier.
NamedDecl * getRepresentativeDecl() const
Fetches a representative decl. Useful for lazy diagnostics.
DeclarationName getLookupName() const
Gets the name to look up.
This represents a Microsoft inline-assembly statement extension.
Representation of a Microsoft __if_exists or __if_not_exists statement with a dependent name.
An instance of this class represents the declaration of a property member.
A member reference to an MSPropertyDecl.
MS property subscript expression.
void setExpansionLoc(SourceLocation Loc)
Represents a prvalue temporary that is written into memory so that a reference can bind to it.
MatrixSingleSubscriptExpr - Matrix single subscript expression for the MatrixType extension when you ...
MatrixSubscriptExpr - Matrix subscript expression for the MatrixType extension.
void setAttrNameLoc(SourceLocation loc)
MemberExpr - [C99 6.5.2.3] Structure and Union Members.
Wrapper for source info for member pointers.
A pointer to member type per C++ 8.3.3 - Pointers to members.
Data structure that captures multiple levels of template argument lists for use in template instantia...
This represents a decl that may have a name.
NamedDecl * getUnderlyingDecl()
Looks through UsingDecls and ObjCCompatibleAliasDecls for the underlying named decl.
IdentifierInfo * getIdentifier() const
Get the identifier that names this declaration, if there is one.
StringRef getName() const
Get the name of identifier for this declaration as a StringRef.
DeclarationName getDeclName() const
Get the actual, stored name of the declaration, which may be a special name.
Represents C++ namespaces and their aliases.
Class that aids in the construction of nested-name-specifiers along with source-location information ...
void MakeTrivial(ASTContext &Context, NestedNameSpecifier Qualifier, SourceRange R)
Make a new nested-name-specifier from incomplete source-location information.
A C++ nested-name-specifier augmented with source location information.
NestedNameSpecifier getNestedNameSpecifier() const
Retrieve the nested-name-specifier to which this instance refers.
SourceLocation getLocalEndLoc() const
Retrieve the location of the end of this component of the nested-name-specifier.
SourceRange getSourceRange() const LLVM_READONLY
Retrieve the source range covering the entirety of this nested-name-specifier.
SourceLocation getEndLoc() const
Retrieve the location of the end of this nested-name-specifier.
SourceLocation getBeginLoc() const
Retrieve the location of the beginning of this nested-name-specifier.
TypeLoc castAsTypeLoc() const
For a nested-name-specifier that refers to a type, retrieve the type with source-location information...
void * getOpaqueData() const
Retrieve the opaque pointer that refers to source-location data.
SourceLocation getLocalBeginLoc() const
Retrieve the location of the beginning of this component of the nested-name-specifier.
Represents a C++ nested name specifier, such as "\::std::vector<int>::".
NamespaceAndPrefix getAsNamespaceAndPrefix() const
CXXRecordDecl * getAsRecordDecl() const
Retrieve the record declaration stored in this nested name specifier, or null.
bool isDependent() const
Whether this nested name specifier refers to a dependent type or not.
@ MicrosoftSuper
Microsoft's '__super' specifier, stored as a CXXRecordDecl* of the class it appeared in.
@ Global
The global specifier '::'. There is no stored value.
@ Type
A type, stored as a Type*.
@ Namespace
A namespace-like entity, stored as a NamespaceBaseDecl*.
Represents a place-holder for an object not to be initialized by anything.
NonTypeTemplateParmDecl - Declares a non-type template parameter, e.g., "Size" in.
NullStmt - This is the null statement ";": C99 6.8.3p3.
This represents the 'absent' clause in the 'pragma omp assume' directive.
This represents 'acq_rel' clause in the 'pragma omp atomic|flush' directives.
This represents 'acquire' clause in the 'pragma omp atomic|flush' directives.
This represents clause 'affinity' in the 'pragma omp task'-based directives.
This represents the 'align' clause in the 'pragma omp allocate' directive.
This represents clause 'aligned' in the 'pragma omp ...' directives.
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 represents 'at' clause in the 'pragma omp error' directive.
This represents 'atomic_default_mem_order' clause in the 'pragma omp requires' directive.
This represents 'bind' clause in the 'pragma omp ...' directives.
This represents 'capture' clause in the 'pragma omp atomic' directive.
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 'compare' clause in the 'pragma omp atomic' directive.
This represents the 'contains' clause in the 'pragma omp assume' directive.
This represents clause 'copyin' in the 'pragma omp ...' directives.
This represents clause 'copyprivate' in the 'pragma omp ...' directives.
This represents 'default' clause in the 'pragma omp ...' directive.
This represents 'defaultmap' clause in the 'pragma omp ...' directive.
This represents implicit clause 'depend' for the 'pragma omp task' directive.
This represents implicit clause 'depobj' for the 'pragma omp depobj' directive.
This represents 'destroy' clause in the 'pragma omp depobj' directive or the 'pragma omp interop' dir...
This represents 'detach' clause in the 'pragma omp task' directive.
This represents 'device' clause in the 'pragma omp ...' directive.
This represents 'dist_schedule' clause in the 'pragma omp ...' directive.
This represents the 'doacross' clause for the 'pragma omp ordered' directive.
This represents 'dyn_groupprivate' clause in 'pragma omp target ...' and 'pragma omp teams ....
This represents 'dynamic_allocators' clause in the 'pragma omp requires' directive.
This represents clause 'exclusive' in the 'pragma omp scan' directive.
This represents 'fail' clause in the 'pragma omp atomic' directive.
This represents 'filter' clause in the 'pragma omp ...' directive.
This represents 'final' clause in the 'pragma omp ...' directive.
This represents clause 'firstprivate' in the 'pragma omp ...' directives.
This represents implicit clause 'flush' for the 'pragma omp flush' directive.
This represents clause 'from' in the 'pragma omp ...' directives.
Representation of the 'full' clause of the 'pragma omp unroll' directive.
This represents 'grainsize' clause in the 'pragma omp ...' directive.
This represents clause 'has_device_ptr' in the 'pragma omp ...' directives.
This represents 'hint' clause in the 'pragma omp ...' directive.
This represents the 'holds' clause in the 'pragma omp assume' directive.
This represents 'if' clause in the 'pragma omp ...' directive.
This represents clause 'in_reduction' in the 'pragma omp task' directives.
This represents clause 'inclusive' in the 'pragma omp scan' directive.
This represents the 'init' clause in 'pragma omp ...' directives.
This represents clause 'is_device_ptr' in the 'pragma omp ...' directives.
OpenMP 5.0 [2.1.6 Iterators] Iterators are identifiers that expand to multiple values in the clause o...
This represents clause 'lastprivate' in the 'pragma omp ...' directives.
This represents clause 'linear' in the 'pragma omp ...' directives.
This class represents the 'looprange' clause in the 'pragma omp fuse' directive.
This represents clauses with a list of expressions that are mappable.
This represents 'mergeable' clause in the 'pragma omp ...' directive.
This represents the 'message' clause in the 'pragma omp error' and the 'pragma omp parallel' directiv...
This represents the 'no_openmp' clause in the 'pragma omp assume' directive.
This represents the 'no_openmp_constructs' clause in the.
This represents the 'no_openmp_routines' clause in the 'pragma omp assume' directive.
This represents the 'no_parallelism' clause in the 'pragma omp assume' directive.
This represents 'nocontext' clause in the 'pragma omp ...' directive.
This represents 'nogroup' clause in the 'pragma omp ...' directive.
This represents clause 'nontemporal' in the 'pragma omp ...' directives.
This represents 'novariants' clause in the 'pragma omp ...' directive.
This represents 'nowait' clause in the 'pragma omp ...' directive.
This represents 'num_tasks' clause in the 'pragma omp ...' directive.
This represents 'num_teams' clause in the 'pragma omp ...' directive.
This represents 'num_threads' clause in the 'pragma omp ...' directive.
This represents 'order' clause in the 'pragma omp ...' directive.
This represents 'ordered' 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 'priority' clause in the 'pragma omp ...' directive.
This represents clause 'private' in the 'pragma omp ...' directives.
This represents 'proc_bind' clause in the 'pragma omp ...' directive.
This represents 'read' clause in the 'pragma omp atomic' directive.
This represents clause 'reduction' in the 'pragma omp ...' directives.
This represents 'relaxed' clause in the 'pragma omp atomic' directives.
This represents 'release' clause in the 'pragma omp atomic|flush' directives.
This represents 'reverse_offload' clause in the 'pragma omp requires' directive.
This represents 'simd' clause in the 'pragma omp ...' directive.
This represents 'safelen' clause in the 'pragma omp ...' directive.
This represents 'schedule' clause in the 'pragma omp ...' directive.
This represents 'self_maps' clause in the 'pragma omp requires' directive.
This represents 'seq_cst' clause in the 'pragma omp atomic|flush' directives.
This represents the 'severity' clause in the 'pragma omp error' and the 'pragma omp parallel' directi...
This represents clause 'shared' in the 'pragma omp ...' directives.
This represents 'simdlen' clause in the 'pragma omp ...' directive.
This represents the 'sizes' clause in the 'pragma omp tile' directive.
This represents clause 'task_reduction' in the 'pragma omp taskgroup' directives.
This represents 'thread_limit' clause in the 'pragma omp ...' directive.
This represents 'threads' clause in the 'pragma omp ...' directive.
This represents 'threadset' clause in the 'pragma omp task ...' directive.
This represents clause 'to' in the 'pragma omp ...' directives.
This represents 'unified_address' clause in the 'pragma omp requires' directive.
This represents 'unified_shared_memory' clause in the 'pragma omp requires' directive.
This represents 'untied' clause in the 'pragma omp ...' directive.
This represents 'update' clause in the 'pragma omp atomic' directive.
This represents the 'use' clause in 'pragma omp ...' directives.
This represents clause 'use_device_addr' in the 'pragma omp ...' directives.
This represents clause 'use_device_ptr' in the 'pragma omp ...' directives.
This represents clause 'uses_allocators' in the 'pragma omp target'-based directives.
This represents 'weak' clause in the 'pragma omp atomic' directives.
This represents 'write' clause in the 'pragma omp atomic' directive.
This represents 'ompx_attribute' clause in a directive that might generate an outlined function.
This represents 'ompx_bare' clause in the 'pragma omp target teams ...' directive.
This represents 'ompx_dyn_cgroup_mem' clause in the 'pragma omp target ...' directive.
ObjCArrayLiteral - used for objective-c array containers; as in: @["Hello", NSApp,...
Represents Objective-C's @catch statement.
Represents Objective-C's @finally statement.
Represents Objective-C's @synchronized statement.
Represents Objective-C's @throw statement.
Represents Objective-C's @try ... @catch ... @finally statement.
Represents Objective-C's @autoreleasepool Statement.
A runtime availability query.
ObjCBoolLiteralExpr - Objective-C Boolean Literal.
ObjCBoxedExpr - used for generalized expression boxing.
An Objective-C "bridged" cast expression, which casts between Objective-C pointers and C pointers,...
ObjCDictionaryLiteral - AST node to represent objective-c dictionary literals; as in:"name" : NSUserN...
ObjCEncodeExpr, used for @encode in Objective-C.
Represents Objective-C's collection statement.
ObjCIndirectCopyRestoreExpr - Represents the passing of a function argument by indirect copy-restore ...
Wrapper for source info for ObjC interfaces.
ObjCIsaExpr - Represent X->isa and X.isa when X is an ObjC 'id' type.
ObjCIvarDecl - Represents an ObjC instance variable.
ObjCIvarRefExpr - A reference to an ObjC instance variable.
An expression that sends a message to the given Objective-C object or class.
@ SuperInstance
The receiver is the instance of the superclass object.
@ Instance
The receiver is an object instance.
@ SuperClass
The receiver is a superclass.
@ Class
The receiver is a class.
ObjCMethodDecl - Represents an instance or class method declaration.
Wraps an ObjCPointerType with source location information.
void setStarLoc(SourceLocation Loc)
void setHasBaseTypeAsWritten(bool HasBaseType)
Represents one property declaration in an Objective-C interface.
ObjCPropertyRefExpr - A dot-syntax expression to access an ObjC property.
ObjCProtocolExpr used for protocol expression in Objective-C.
ObjCSelectorExpr used for @selector in Objective-C.
ObjCStringLiteral, used for Objective-C string literals i.e.
ObjCSubscriptRefExpr - used for array and dictionary subscripting.
Represents the declaration of an Objective-C type parameter.
ProtocolLAngleLoc, ProtocolRAngleLoc, and the source locations for protocol qualifiers are stored aft...
@ Array
An index into an array.
@ Identifier
A field in a dependent type, known only by its name.
@ Base
An implicit indirection through a C++ base class, when the field found is in a base class.
static OpaquePtr make(QualType P)
OpaqueValueExpr - An expression referring to an opaque object of a fixed type and value class.
Expr * getSourceExpr() const
The source expression of an opaque value expression is the expression which originally generated the ...
This expression type represents an asterisk in an OpenACC Size-Expr, used in the 'tile' and 'gang' cl...
static OpenACCAsyncClause * Create(const ASTContext &C, SourceLocation BeginLoc, SourceLocation LParenLoc, Expr *IntExpr, SourceLocation EndLoc)
static OpenACCAttachClause * Create(const ASTContext &C, SourceLocation BeginLoc, SourceLocation LParenLoc, ArrayRef< Expr * > VarList, SourceLocation EndLoc)
static OpenACCAutoClause * Create(const ASTContext &Ctx, SourceLocation BeginLoc, SourceLocation EndLoc)
This is the base type for all OpenACC Clauses.
Represents a 'collapse' clause on a 'loop' construct.
static OpenACCCollapseClause * Create(const ASTContext &C, SourceLocation BeginLoc, SourceLocation LParenLoc, bool HasForce, Expr *LoopCount, SourceLocation EndLoc)
static OpenACCCopyClause * Create(const ASTContext &C, OpenACCClauseKind Spelling, SourceLocation BeginLoc, SourceLocation LParenLoc, OpenACCModifierKind Mods, ArrayRef< Expr * > VarList, SourceLocation EndLoc)
static OpenACCCopyInClause * Create(const ASTContext &C, OpenACCClauseKind Spelling, SourceLocation BeginLoc, SourceLocation LParenLoc, OpenACCModifierKind Mods, ArrayRef< Expr * > VarList, SourceLocation EndLoc)
static OpenACCCopyOutClause * Create(const ASTContext &C, OpenACCClauseKind Spelling, SourceLocation BeginLoc, SourceLocation LParenLoc, OpenACCModifierKind Mods, ArrayRef< Expr * > VarList, SourceLocation EndLoc)
static OpenACCCreateClause * Create(const ASTContext &C, OpenACCClauseKind Spelling, SourceLocation BeginLoc, SourceLocation LParenLoc, OpenACCModifierKind Mods, ArrayRef< Expr * > VarList, SourceLocation EndLoc)
static OpenACCDefaultAsyncClause * Create(const ASTContext &C, SourceLocation BeginLoc, SourceLocation LParenLoc, Expr *IntExpr, SourceLocation EndLoc)
A 'default' clause, has the optional 'none' or 'present' argument.
static OpenACCDefaultClause * Create(const ASTContext &C, OpenACCDefaultClauseKind K, SourceLocation BeginLoc, SourceLocation LParenLoc, SourceLocation EndLoc)
static OpenACCDeleteClause * Create(const ASTContext &C, SourceLocation BeginLoc, SourceLocation LParenLoc, ArrayRef< Expr * > VarList, SourceLocation EndLoc)
static OpenACCDetachClause * Create(const ASTContext &C, SourceLocation BeginLoc, SourceLocation LParenLoc, ArrayRef< Expr * > VarList, SourceLocation EndLoc)
static OpenACCDeviceClause * Create(const ASTContext &C, SourceLocation BeginLoc, SourceLocation LParenLoc, ArrayRef< Expr * > VarList, SourceLocation EndLoc)
static OpenACCDeviceNumClause * Create(const ASTContext &C, SourceLocation BeginLoc, SourceLocation LParenLoc, Expr *IntExpr, SourceLocation EndLoc)
static OpenACCDevicePtrClause * Create(const ASTContext &C, SourceLocation BeginLoc, SourceLocation LParenLoc, ArrayRef< Expr * > VarList, SourceLocation EndLoc)
A 'device_type' or 'dtype' clause, takes a list of either an 'asterisk' or an identifier.
static OpenACCDeviceTypeClause * Create(const ASTContext &C, OpenACCClauseKind K, SourceLocation BeginLoc, SourceLocation LParenLoc, ArrayRef< DeviceTypeArgument > Archs, SourceLocation EndLoc)
static OpenACCFinalizeClause * Create(const ASTContext &Ctx, SourceLocation BeginLoc, SourceLocation EndLoc)
static OpenACCFirstPrivateClause * Create(const ASTContext &C, SourceLocation BeginLoc, SourceLocation LParenLoc, ArrayRef< Expr * > VarList, ArrayRef< OpenACCFirstPrivateRecipe > InitRecipes, SourceLocation EndLoc)
static OpenACCHostClause * Create(const ASTContext &C, SourceLocation BeginLoc, SourceLocation LParenLoc, ArrayRef< Expr * > VarList, SourceLocation EndLoc)
An 'if' clause, which has a required condition expression.
static OpenACCIfClause * Create(const ASTContext &C, SourceLocation BeginLoc, SourceLocation LParenLoc, Expr *ConditionExpr, SourceLocation EndLoc)
static OpenACCIfPresentClause * Create(const ASTContext &Ctx, SourceLocation BeginLoc, SourceLocation EndLoc)
static OpenACCIndependentClause * Create(const ASTContext &Ctx, SourceLocation BeginLoc, SourceLocation EndLoc)
static OpenACCNoCreateClause * Create(const ASTContext &C, SourceLocation BeginLoc, SourceLocation LParenLoc, ArrayRef< Expr * > VarList, SourceLocation EndLoc)
static OpenACCNumGangsClause * Create(const ASTContext &C, SourceLocation BeginLoc, SourceLocation LParenLoc, ArrayRef< Expr * > IntExprs, SourceLocation EndLoc)
static OpenACCNumWorkersClause * Create(const ASTContext &C, SourceLocation BeginLoc, SourceLocation LParenLoc, Expr *IntExpr, SourceLocation EndLoc)
static OpenACCPresentClause * Create(const ASTContext &C, SourceLocation BeginLoc, SourceLocation LParenLoc, ArrayRef< Expr * > VarList, SourceLocation EndLoc)
static OpenACCPrivateClause * Create(const ASTContext &C, SourceLocation BeginLoc, SourceLocation LParenLoc, ArrayRef< Expr * > VarList, ArrayRef< OpenACCPrivateRecipe > InitRecipes, SourceLocation EndLoc)
A 'self' clause, which has an optional condition expression, or, in the event of an 'update' directiv...
static OpenACCSelfClause * Create(const ASTContext &C, SourceLocation BeginLoc, SourceLocation LParenLoc, Expr *ConditionExpr, SourceLocation EndLoc)
static OpenACCSeqClause * Create(const ASTContext &Ctx, SourceLocation BeginLoc, SourceLocation EndLoc)
static OpenACCTileClause * Create(const ASTContext &C, SourceLocation BeginLoc, SourceLocation LParenLoc, ArrayRef< Expr * > SizeExprs, SourceLocation EndLoc)
static OpenACCUseDeviceClause * Create(const ASTContext &C, SourceLocation BeginLoc, SourceLocation LParenLoc, ArrayRef< Expr * > VarList, SourceLocation EndLoc)
static OpenACCVectorClause * Create(const ASTContext &Ctx, SourceLocation BeginLoc, SourceLocation LParenLoc, Expr *IntExpr, SourceLocation EndLoc)
static OpenACCVectorLengthClause * Create(const ASTContext &C, SourceLocation BeginLoc, SourceLocation LParenLoc, Expr *IntExpr, SourceLocation EndLoc)
static OpenACCWaitClause * Create(const ASTContext &C, SourceLocation BeginLoc, SourceLocation LParenLoc, Expr *DevNumExpr, SourceLocation QueuesLoc, ArrayRef< Expr * > QueueIdExprs, SourceLocation EndLoc)
static OpenACCWorkerClause * Create(const ASTContext &Ctx, SourceLocation BeginLoc, SourceLocation LParenLoc, Expr *IntExpr, SourceLocation EndLoc)
A reference to an overloaded function set, either an UnresolvedLookupExpr or an UnresolvedMemberExpr.
bool hasExplicitTemplateArgs() const
Determines whether this expression had explicit template arguments.
SourceLocation getLAngleLoc() const
Retrieve the location of the left angle bracket starting the explicit template argument list followin...
SourceLocation getNameLoc() const
Gets the location of the name.
SourceLocation getTemplateKeywordLoc() const
Retrieve the location of the template keyword preceding this name, if any.
NestedNameSpecifierLoc getQualifierLoc() const
Fetches the nested-name qualifier with source-location information, if one was given.
TemplateArgumentLoc const * getTemplateArgs() const
llvm::iterator_range< decls_iterator > decls() const
unsigned getNumTemplateArgs() const
DeclarationName getName() const
Gets the name looked up.
SourceLocation getRAngleLoc() const
Retrieve the location of the right angle bracket ending the explicit template argument list following...
bool hasTemplateKeyword() const
Determines whether the name was preceded by the template keyword.
Represents a C++11 pack expansion that produces a sequence of expressions.
void setEllipsisLoc(SourceLocation Loc)
SourceLocation getEllipsisLoc() const
TypeLoc getPatternLoc() const
void setEllipsisLoc(SourceLocation Loc)
ParenExpr - This represents a parenthesized expression, e.g.
SourceLocation getLParen() const
Get the location of the left parentheses '('.
SourceLocation getRParen() const
Get the location of the right parentheses ')'.
void setLParenLoc(SourceLocation Loc)
Represents a parameter to a function.
unsigned getFunctionScopeIndex() const
Returns the index of this parameter in its prototype or method scope.
void setScopeInfo(unsigned scopeDepth, unsigned parameterIndex)
static ParmVarDecl * Create(ASTContext &C, DeclContext *DC, SourceLocation StartLoc, SourceLocation IdLoc, const IdentifierInfo *Id, QualType T, TypeSourceInfo *TInfo, StorageClass S, Expr *DefArg)
unsigned getFunctionScopeDepth() const
void setKWLoc(SourceLocation Loc)
Pointer-authentication qualifiers.
void setSigilLoc(SourceLocation Loc)
TypeLoc getPointeeLoc() const
SourceLocation getSigilLoc() const
Wrapper for source info for pointers.
PointerType - C99 6.7.5.1 - Pointer Declarators.
[C99 6.4.2.2] - A predefined identifier such as func.
Stores the type being destroyed by a pseudo-destructor expression.
const IdentifierInfo * getIdentifier() const
SourceLocation getLocation() const
TypeSourceInfo * getTypeSourceInfo() const
PseudoObjectExpr - An expression which accesses a pseudo-object l-value.
A (possibly-)qualified type.
bool isNull() const
Return true if this QualType doesn't point to a type yet.
const Type * getTypePtr() const
Retrieves a pointer to the underlying (unqualified) type.
Qualifiers getQualifiers() const
Retrieve the set of qualifiers applied to this type.
QualType getUnqualifiedType() const
Retrieve the unqualified variant of the given type, removing as little sugar as possible.
Qualifiers getLocalQualifiers() const
Retrieve the set of qualifiers local to this particular QualType instance, not including any qualifie...
Represents a template name as written in source code.
Wrapper of type source information for a type with non-trivial direct qualifiers.
The collection of all-type qualifiers we support.
void removeObjCLifetime()
static Qualifiers fromCVRMask(unsigned CVR)
PointerAuthQualifier getPointerAuth() const
bool hasObjCLifetime() const
LangAS getAddressSpace() const
Frontend produces RecoveryExprs on semantic errors that prevent creating other well-formed expression...
Base for LValueReferenceType and RValueReferenceType.
QualType getPointeeTypeAsWritten() const
Represents the body of a requires-expression.
static RequiresExprBodyDecl * Create(ASTContext &C, DeclContext *DC, SourceLocation StartLoc)
C++2a [expr.prim.req]: A requires-expression provides a concise way to express requirements on templa...
static RequiresExpr * Create(ASTContext &C, SourceLocation RequiresKWLoc, RequiresExprBodyDecl *Body, SourceLocation LParenLoc, ArrayRef< ParmVarDecl * > LocalParameters, SourceLocation RParenLoc, ArrayRef< concepts::Requirement * > Requirements, SourceLocation RBraceLoc)
ReturnStmt - This represents a return, optionally of an expression: return; return 4;.
static SEHFinallyStmt * Create(const ASTContext &C, SourceLocation FinallyLoc, Stmt *Block)
Represents a __leave statement.
SYCLKernelCallStmt represents the transformation that is applied to the body of a function declared w...
Smart pointer class that efficiently represents Objective-C method names.
SemaDiagnosticBuilder Diag(SourceLocation Loc, unsigned DiagID)
Emit a diagnostic.
VarDecl * BuildObjCExceptionDecl(TypeSourceInfo *TInfo, QualType ExceptionType, SourceLocation StartLoc, SourceLocation IdLoc, const IdentifierInfo *Id, bool Invalid=false)
Build a type-check a new Objective-C exception variable declaration.
StmtResult ActOnObjCForCollectionStmt(SourceLocation ForColLoc, Stmt *First, Expr *collection, SourceLocation RParenLoc)
StmtResult FinishObjCForCollectionStmt(Stmt *ForCollection, Stmt *Body)
FinishObjCForCollectionStmt - Attach the body to a objective-C foreach statement.
ExprResult BuildObjCDictionaryLiteral(SourceRange SR, MutableArrayRef< ObjCDictionaryElement > Elements)
StmtResult ActOnObjCAtSynchronizedStmt(SourceLocation AtLoc, Expr *SynchExpr, Stmt *SynchBody)
ExprResult BuildObjCArrayLiteral(SourceRange SR, MultiExprArg Elements)
ExprResult BuildObjCBoxedExpr(SourceRange SR, Expr *ValueExpr)
BuildObjCBoxedExpr - builds an ObjCBoxedExpr AST node for the '@' prefixed parenthesized expression.
StmtResult ActOnObjCAtTryStmt(SourceLocation AtLoc, Stmt *Try, MultiStmtArg Catch, Stmt *Finally)
StmtResult ActOnObjCAtFinallyStmt(SourceLocation AtLoc, Stmt *Body)
StmtResult BuildObjCAtThrowStmt(SourceLocation AtLoc, Expr *Throw)
ExprResult ActOnObjCAtSynchronizedOperand(SourceLocation atLoc, Expr *operand)
ExprResult BuildObjCBridgedCast(SourceLocation LParenLoc, ObjCBridgeCastKind Kind, SourceLocation BridgeKeywordLoc, TypeSourceInfo *TSInfo, Expr *SubExpr)
StmtResult ActOnObjCAtCatchStmt(SourceLocation AtLoc, SourceLocation RParen, Decl *Parm, Stmt *Body)
StmtResult ActOnObjCAutoreleasePoolStmt(SourceLocation AtLoc, Stmt *Body)
ExprResult BuildObjCSubscriptExpression(SourceLocation RB, Expr *BaseExpr, Expr *IndexExpr, ObjCMethodDecl *getterMethod, ObjCMethodDecl *setterMethod)
Build an ObjC subscript pseudo-object expression, given that that's supported by the runtime.
Helper type for the registration/assignment of constructs that need to 'know' about their parent cons...
Helper type to restore the state of various 'loop' constructs when we run into a loop (for,...
A type to represent all the data for an OpenACC Clause that has been parsed, but not yet created/sema...
void ActOnWhileStmt(SourceLocation WhileLoc)
ExprResult ActOnOpenACCAsteriskSizeExpr(SourceLocation AsteriskLoc)
void ActOnDoStmt(SourceLocation DoLoc)
void ActOnRangeForStmtBegin(SourceLocation ForLoc, const Stmt *OldRangeFor, const Stmt *RangeFor)
StmtResult ActOnEndStmtDirective(OpenACCDirectiveKind K, SourceLocation StartLoc, SourceLocation DirLoc, SourceLocation LParenLoc, SourceLocation MiscLoc, ArrayRef< Expr * > Exprs, OpenACCAtomicKind AK, SourceLocation RParenLoc, SourceLocation EndLoc, ArrayRef< OpenACCClause * > Clauses, StmtResult AssocStmt)
Called after the directive has been completely parsed, including the declaration group or associated ...
void ActOnForStmtEnd(SourceLocation ForLoc, StmtResult Body)
void ActOnForStmtBegin(SourceLocation ForLoc, const Stmt *First, const Stmt *Second, const Stmt *Third)
ExprResult ActOnArraySectionExpr(Expr *Base, SourceLocation LBLoc, Expr *LowerBound, SourceLocation ColonLocFirst, Expr *Length, SourceLocation RBLoc)
Checks and creates an Array Section used in an OpenACC construct/clause.
OMPClause * ActOnOpenMPNocontextClause(Expr *Condition, SourceLocation StartLoc, SourceLocation LParenLoc, SourceLocation EndLoc)
Called on well-formed 'nocontext' clause.
OMPClause * ActOnOpenMPXDynCGroupMemClause(Expr *Size, SourceLocation StartLoc, SourceLocation LParenLoc, SourceLocation EndLoc)
Called on a well-formed 'ompx_dyn_cgroup_mem' clause.
OMPClause * ActOnOpenMPSafelenClause(Expr *Length, SourceLocation StartLoc, SourceLocation LParenLoc, SourceLocation EndLoc)
Called on well-formed 'safelen' clause.
OMPClause * ActOnOpenMPHoldsClause(Expr *E, SourceLocation StartLoc, SourceLocation LParenLoc, SourceLocation EndLoc)
Called on well-formed 'holds' clause.
OMPClause * ActOnOpenMPFilterClause(Expr *ThreadID, SourceLocation StartLoc, SourceLocation LParenLoc, SourceLocation EndLoc)
Called on well-formed 'filter' clause.
OMPClause * ActOnOpenMPFullClause(SourceLocation StartLoc, SourceLocation EndLoc)
Called on well-form 'full' clauses.
OMPClause * ActOnOpenMPDetachClause(Expr *Evt, SourceLocation StartLoc, SourceLocation LParenLoc, SourceLocation EndLoc)
Called on well-formed 'detach' clause.
OMPClause * ActOnOpenMPUseClause(Expr *InteropVar, SourceLocation StartLoc, SourceLocation LParenLoc, SourceLocation VarLoc, SourceLocation EndLoc)
Called on well-formed 'use' clause.
OMPClause * ActOnOpenMPPrivateClause(ArrayRef< Expr * > VarList, SourceLocation StartLoc, SourceLocation LParenLoc, SourceLocation EndLoc)
Called on well-formed 'private' clause.
OMPClause * ActOnOpenMPOrderedClause(SourceLocation StartLoc, SourceLocation EndLoc, SourceLocation LParenLoc=SourceLocation(), Expr *NumForLoops=nullptr)
Called on well-formed 'ordered' clause.
OMPClause * ActOnOpenMPIsDevicePtrClause(ArrayRef< Expr * > VarList, const OMPVarListLocTy &Locs)
Called on well-formed 'is_device_ptr' clause.
OMPClause * ActOnOpenMPHasDeviceAddrClause(ArrayRef< Expr * > VarList, const OMPVarListLocTy &Locs)
Called on well-formed 'has_device_addr' clause.
OMPClause * ActOnOpenMPPartialClause(Expr *FactorExpr, SourceLocation StartLoc, SourceLocation LParenLoc, SourceLocation EndLoc)
Called on well-form 'partial' clauses.
OMPClause * ActOnOpenMPLastprivateClause(ArrayRef< Expr * > VarList, OpenMPLastprivateModifier LPKind, SourceLocation LPKindLoc, SourceLocation ColonLoc, SourceLocation StartLoc, SourceLocation LParenLoc, SourceLocation EndLoc)
Called on well-formed 'lastprivate' clause.
OMPClause * ActOnOpenMPFirstprivateClause(ArrayRef< Expr * > VarList, SourceLocation StartLoc, SourceLocation LParenLoc, SourceLocation EndLoc)
Called on well-formed 'firstprivate' clause.
OMPClause * ActOnOpenMPPriorityClause(Expr *Priority, SourceLocation StartLoc, SourceLocation LParenLoc, SourceLocation EndLoc)
Called on well-formed 'priority' clause.
OMPClause * ActOnOpenMPDistScheduleClause(OpenMPDistScheduleClauseKind Kind, Expr *ChunkSize, SourceLocation StartLoc, SourceLocation LParenLoc, SourceLocation KindLoc, SourceLocation CommaLoc, SourceLocation EndLoc)
Called on well-formed 'dist_schedule' clause.
OMPClause * ActOnOpenMPLoopRangeClause(Expr *First, Expr *Count, SourceLocation StartLoc, SourceLocation LParenLoc, SourceLocation FirstLoc, SourceLocation CountLoc, SourceLocation EndLoc)
Called on well-form 'looprange' clause after parsing its arguments.
OMPClause * ActOnOpenMPPermutationClause(ArrayRef< Expr * > PermExprs, SourceLocation StartLoc, SourceLocation LParenLoc, SourceLocation EndLoc)
Called on well-form 'permutation' clause after parsing its arguments.
OMPClause * ActOnOpenMPNontemporalClause(ArrayRef< Expr * > VarList, SourceLocation StartLoc, SourceLocation LParenLoc, SourceLocation EndLoc)
Called on well-formed 'nontemporal' clause.
OMPClause * ActOnOpenMPBindClause(OpenMPBindClauseKind Kind, SourceLocation KindLoc, SourceLocation StartLoc, SourceLocation LParenLoc, SourceLocation EndLoc)
Called on a well-formed 'bind' clause.
OMPClause * ActOnOpenMPThreadLimitClause(ArrayRef< Expr * > VarList, SourceLocation StartLoc, SourceLocation LParenLoc, SourceLocation EndLoc)
Called on well-formed 'thread_limit' clause.
OMPClause * ActOnOpenMPSharedClause(ArrayRef< Expr * > VarList, SourceLocation StartLoc, SourceLocation LParenLoc, SourceLocation EndLoc)
Called on well-formed 'shared' clause.
OMPClause * ActOnOpenMPCopyinClause(ArrayRef< Expr * > VarList, SourceLocation StartLoc, SourceLocation LParenLoc, SourceLocation EndLoc)
Called on well-formed 'copyin' clause.
OMPClause * ActOnOpenMPDestroyClause(Expr *InteropVar, SourceLocation StartLoc, SourceLocation LParenLoc, SourceLocation VarLoc, SourceLocation EndLoc)
Called on well-formed 'destroy' clause.
OMPClause * ActOnOpenMPAffinityClause(SourceLocation StartLoc, SourceLocation LParenLoc, SourceLocation ColonLoc, SourceLocation EndLoc, Expr *Modifier, ArrayRef< Expr * > Locators)
Called on well-formed 'affinity' clause.
OMPClause * ActOnOpenMPNumTeamsClause(ArrayRef< Expr * > VarList, SourceLocation StartLoc, SourceLocation LParenLoc, SourceLocation EndLoc)
Called on well-formed 'num_teams' clause.
OMPClause * ActOnOpenMPDependClause(const OMPDependClause::DependDataTy &Data, Expr *DepModifier, ArrayRef< Expr * > VarList, SourceLocation StartLoc, SourceLocation LParenLoc, SourceLocation EndLoc)
Called on well-formed 'depend' clause.
OMPClause * ActOnOpenMPDoacrossClause(OpenMPDoacrossClauseModifier DepType, SourceLocation DepLoc, SourceLocation ColonLoc, ArrayRef< Expr * > VarList, SourceLocation StartLoc, SourceLocation LParenLoc, SourceLocation EndLoc)
Called on well-formed 'doacross' clause.
OMPClause * 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 * ActOnOpenMPUseDevicePtrClause(ArrayRef< Expr * > VarList, const OMPVarListLocTy &Locs)
Called on well-formed 'use_device_ptr' 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 * ActOnOpenMPHintClause(Expr *Hint, SourceLocation StartLoc, SourceLocation LParenLoc, SourceLocation EndLoc)
Called on well-formed 'hint' clause.
ExprResult ActOnOMPArrayShapingExpr(Expr *Base, SourceLocation LParenLoc, SourceLocation RParenLoc, ArrayRef< Expr * > Dims, ArrayRef< SourceRange > Brackets)
OMPClause * ActOnOpenMPNumThreadsClause(OpenMPNumThreadsClauseModifier Modifier, Expr *NumThreads, SourceLocation StartLoc, SourceLocation LParenLoc, SourceLocation ModifierLoc, SourceLocation EndLoc)
Called on well-formed 'num_threads' clause.
OMPClause * ActOnOpenMPAtClause(OpenMPAtClauseKind Kind, SourceLocation KindLoc, SourceLocation StartLoc, SourceLocation LParenLoc, SourceLocation EndLoc)
Called on well-formed 'at' clause.
OMPClause * ActOnOpenMPInitClause(Expr *InteropVar, OMPInteropInfo &InteropInfo, SourceLocation StartLoc, SourceLocation LParenLoc, SourceLocation VarLoc, SourceLocation EndLoc)
Called on well-formed 'init' clause.
OMPClause * ActOnOpenMPUseDeviceAddrClause(ArrayRef< Expr * > VarList, const OMPVarListLocTy &Locs)
Called on well-formed 'use_device_addr' clause.
OMPClause * ActOnOpenMPAllocateClause(Expr *Allocator, Expr *Alignment, OpenMPAllocateClauseModifier FirstModifier, SourceLocation FirstModifierLoc, OpenMPAllocateClauseModifier SecondModifier, SourceLocation SecondModifierLoc, ArrayRef< Expr * > VarList, SourceLocation StartLoc, SourceLocation ColonLoc, SourceLocation LParenLoc, SourceLocation EndLoc)
Called on well-formed 'allocate' clause.
OMPClause * ActOnOpenMPFinalClause(Expr *Condition, SourceLocation StartLoc, SourceLocation LParenLoc, SourceLocation EndLoc)
Called on well-formed 'final' clause.
OMPClause * ActOnOpenMPMapClause(Expr *IteratorModifier, ArrayRef< OpenMPMapModifierKind > MapTypeModifiers, ArrayRef< SourceLocation > MapTypeModifiersLoc, CXXScopeSpec &MapperIdScopeSpec, DeclarationNameInfo &MapperId, OpenMPMapClauseKind MapType, bool IsMapTypeImplicit, SourceLocation MapLoc, SourceLocation ColonLoc, ArrayRef< Expr * > VarList, const OMPVarListLocTy &Locs, bool NoDiagnose=false, ArrayRef< Expr * > UnresolvedMappers={})
Called on well-formed 'map' clause.
OMPClause * ActOnOpenMPNumTasksClause(OpenMPNumTasksClauseModifier Modifier, Expr *NumTasks, SourceLocation StartLoc, SourceLocation LParenLoc, SourceLocation ModifierLoc, SourceLocation EndLoc)
Called on well-formed 'num_tasks' clause.
OMPClause * ActOnOpenMPFromClause(ArrayRef< OpenMPMotionModifierKind > MotionModifiers, ArrayRef< SourceLocation > MotionModifiersLoc, Expr *IteratorModifier, CXXScopeSpec &MapperIdScopeSpec, DeclarationNameInfo &MapperId, SourceLocation ColonLoc, ArrayRef< Expr * > VarList, const OMPVarListLocTy &Locs, ArrayRef< Expr * > UnresolvedMappers={})
Called on well-formed 'from' clause.
OMPClause * ActOnOpenMPDynGroupprivateClause(OpenMPDynGroupprivateClauseModifier M1, OpenMPDynGroupprivateClauseFallbackModifier M2, Expr *Size, SourceLocation StartLoc, SourceLocation LParenLoc, SourceLocation M1Loc, SourceLocation M2Loc, SourceLocation EndLoc)
Called on a well-formed 'dyn_groupprivate' clause.
void StartOpenMPDSABlock(OpenMPDirectiveKind K, const DeclarationNameInfo &DirName, Scope *CurScope, SourceLocation Loc)
Called on start of new data sharing attribute block.
OMPClause * ActOnOpenMPSeverityClause(OpenMPSeverityClauseKind Kind, SourceLocation KindLoc, SourceLocation StartLoc, SourceLocation LParenLoc, SourceLocation EndLoc)
Called on well-formed 'severity' clause.
OMPClause * ActOnOpenMPToClause(ArrayRef< OpenMPMotionModifierKind > MotionModifiers, ArrayRef< SourceLocation > MotionModifiersLoc, Expr *IteratorModifier, CXXScopeSpec &MapperIdScopeSpec, DeclarationNameInfo &MapperId, SourceLocation ColonLoc, ArrayRef< Expr * > VarList, const OMPVarListLocTy &Locs, ArrayRef< Expr * > UnresolvedMappers={})
Called on well-formed 'to' clause.
OMPClause * ActOnOpenMPLinearClause(ArrayRef< Expr * > VarList, Expr *Step, SourceLocation StartLoc, SourceLocation LParenLoc, OpenMPLinearClauseKind LinKind, SourceLocation LinLoc, SourceLocation ColonLoc, SourceLocation StepModifierLoc, SourceLocation EndLoc)
Called on well-formed 'linear' clause.
OMPClause * ActOnOpenMPDefaultmapClause(OpenMPDefaultmapClauseModifier M, OpenMPDefaultmapClauseKind Kind, SourceLocation StartLoc, SourceLocation LParenLoc, SourceLocation MLoc, SourceLocation KindLoc, SourceLocation EndLoc)
Called on well-formed 'defaultmap' clause.
OMPClause * ActOnOpenMPReductionClause(ArrayRef< Expr * > VarList, OpenMPVarListDataTy::OpenMPReductionClauseModifiers Modifiers, SourceLocation StartLoc, SourceLocation LParenLoc, SourceLocation ModifierLoc, SourceLocation ColonLoc, SourceLocation EndLoc, CXXScopeSpec &ReductionIdScopeSpec, const DeclarationNameInfo &ReductionId, ArrayRef< Expr * > UnresolvedReductions={})
Called on well-formed 'reduction' clause.
OMPClause * ActOnOpenMPAlignedClause(ArrayRef< Expr * > VarList, Expr *Alignment, SourceLocation StartLoc, SourceLocation LParenLoc, SourceLocation ColonLoc, SourceLocation EndLoc)
Called on well-formed 'aligned' clause.
OMPClause * ActOnOpenMPDepobjClause(Expr *Depobj, SourceLocation StartLoc, SourceLocation LParenLoc, SourceLocation EndLoc)
Called on well-formed 'depobj' pseudo clause.
OMPClause * ActOnOpenMPNovariantsClause(Expr *Condition, SourceLocation StartLoc, SourceLocation LParenLoc, SourceLocation EndLoc)
Called on well-formed 'novariants' clause.
OMPClause * ActOnOpenMPCopyprivateClause(ArrayRef< Expr * > VarList, SourceLocation StartLoc, SourceLocation LParenLoc, SourceLocation EndLoc)
Called on well-formed 'copyprivate' clause.
OMPClause * ActOnOpenMPCollapseClause(Expr *NumForLoops, SourceLocation StartLoc, SourceLocation LParenLoc, SourceLocation EndLoc)
Called on well-formed 'collapse' clause.
OMPClause * ActOnOpenMPDefaultClause(llvm::omp::DefaultKind M, SourceLocation MLoc, OpenMPDefaultClauseVariableCategory VCKind, SourceLocation VCKindLoc, SourceLocation StartLoc, SourceLocation LParenLoc, SourceLocation EndLoc)
Called on well-formed 'default' clause.
OMPClause * ActOnOpenMPAlignClause(Expr *Alignment, SourceLocation StartLoc, SourceLocation LParenLoc, SourceLocation EndLoc)
Called on well-formed 'align' clause.
OMPClause * ActOnOpenMPXAttributeClause(ArrayRef< const Attr * > Attrs, SourceLocation StartLoc, SourceLocation LParenLoc, SourceLocation EndLoc)
Called on a well-formed 'ompx_attribute' clause.
OMPClause * ActOnOpenMPExclusiveClause(ArrayRef< Expr * > VarList, SourceLocation StartLoc, SourceLocation LParenLoc, SourceLocation EndLoc)
Called on well-formed 'exclusive' clause.
OMPClause * ActOnOpenMPIfClause(OpenMPDirectiveKind NameModifier, Expr *Condition, SourceLocation StartLoc, SourceLocation LParenLoc, SourceLocation NameModifierLoc, SourceLocation ColonLoc, SourceLocation EndLoc)
Called on well-formed 'if' clause.
Expr * recreateSyntacticForm(PseudoObjectExpr *E)
Given a pseudo-object expression, recreate what it looks like syntactically without the attendant Opa...
ExprResult checkRValue(Expr *E)
ExprResult BuildUniqueStableNameExpr(SourceLocation OpLoc, SourceLocation LParen, SourceLocation RParen, TypeSourceInfo *TSI)
RAII object used to change the argument pack substitution index within a Sema object.
RAII object used to temporarily allow the C++ 'this' expression to be used, with the given qualifiers...
A RAII object to enter scope of a compound statement.
A helper class for building up ExtParameterInfos.
const FunctionProtoType::ExtParameterInfo * getPointerOrNull(unsigned numParams)
Return a pointer (suitable for setting in an ExtProtoInfo) to the ExtParameterInfo array we've built ...
void set(unsigned index, FunctionProtoType::ExtParameterInfo info)
Set the ExtParameterInfo for the parameter at the given index,.
Records and restores the CurFPFeatures state on entry/exit of compound statements.
Sema - This implements semantic analysis and AST building for C.
ParsedType CreateParsedType(QualType T, TypeSourceInfo *TInfo)
Package the given type and TSI into a ParsedType.
ExprResult ActOnCXXParenListInitExpr(ArrayRef< Expr * > Args, QualType T, unsigned NumUserSpecifiedExprs, SourceLocation InitLoc, SourceLocation LParenLoc, SourceLocation RParenLoc)
ExprResult BuildOperatorCoawaitCall(SourceLocation Loc, Expr *E, UnresolvedLookupExpr *Lookup)
Build a call to 'operator co_await' if there is a suitable operator for the given expression.
ExprResult BuildMemberReferenceExpr(Expr *Base, QualType BaseType, SourceLocation OpLoc, bool IsArrow, CXXScopeSpec &SS, SourceLocation TemplateKWLoc, NamedDecl *FirstQualifierInScope, const DeclarationNameInfo &NameInfo, const TemplateArgumentListInfo *TemplateArgs, const Scope *S, ActOnMemberAccessExtraArgs *ExtraArgs=nullptr)
StmtResult BuildMSDependentExistsStmt(SourceLocation KeywordLoc, bool IsIfExists, NestedNameSpecifierLoc QualifierLoc, DeclarationNameInfo NameInfo, Stmt *Nested)
@ LookupOrdinaryName
Ordinary name lookup, which finds ordinary names (functions, variables, typedefs, etc....
@ LookupMemberName
Member name lookup, which finds the names of class/struct/union members.
@ LookupTagName
Tag name lookup, which finds the names of enums, classes, structs, and unions.
bool checkFinalSuspendNoThrow(const Stmt *FinalSuspend)
Check that the expression co_await promise.final_suspend() shall not be potentially-throwing.
ExprResult CreateBuiltinMatrixSingleSubscriptExpr(Expr *Base, Expr *RowIdx, SourceLocation RBLoc)
ExprResult ActOnConstantExpression(ExprResult Res)
StmtResult ActOnMSAsmStmt(SourceLocation AsmLoc, SourceLocation LBraceLoc, ArrayRef< Token > AsmToks, StringRef AsmString, unsigned NumOutputs, unsigned NumInputs, ArrayRef< StringRef > Constraints, ArrayRef< StringRef > Clobbers, ArrayRef< Expr * > Exprs, SourceLocation EndLoc)
StmtResult BuildCoroutineBodyStmt(CoroutineBodyStmt::CtorArgs)
ExprResult BuildCoyieldExpr(SourceLocation KwLoc, Expr *E)
void ActOnStartStmtExpr()
void ActOnStmtExprError()
void MarkDeclarationsReferencedInExpr(Expr *E, bool SkipLocalVariables=false, ArrayRef< const Expr * > StopAt={})
Mark any declarations that appear within this expression or any potentially-evaluated subexpressions ...
VarDecl * buildCoroutinePromise(SourceLocation Loc)
ExprResult CheckBooleanCondition(SourceLocation Loc, Expr *E, bool IsConstexpr=false)
CheckBooleanCondition - Diagnose problems involving the use of the given expression as a boolean cond...
@ Boolean
A boolean condition, from 'if', 'while', 'for', or 'do'.
@ Switch
An integral condition for a 'switch' statement.
@ ConstexprIf
A constant boolean condition from 'if constexpr'.
ExprResult BuildSubstNonTypeTemplateParmExpr(Decl *AssociatedDecl, const NonTypeTemplateParmDecl *NTTP, SourceLocation loc, TemplateArgument Replacement, UnsignedOrNone PackIndex, bool Final)
ExprResult BuildBuiltinBitCastExpr(SourceLocation KWLoc, TypeSourceInfo *TSI, Expr *Operand, SourceLocation RParenLoc)
StmtResult ActOnGotoStmt(SourceLocation GotoLoc, SourceLocation LabelLoc, LabelDecl *TheDecl)
ExprResult MaybeBindToTemporary(Expr *E)
MaybeBindToTemporary - If the passed in expression has a record type with a non-trivial destructor,...
StmtResult BuildCoreturnStmt(SourceLocation KwLoc, Expr *E, bool IsImplicit=false)
ExprResult ActOnStartCXXMemberReference(Scope *S, Expr *Base, SourceLocation OpLoc, tok::TokenKind OpKind, ParsedType &ObjectType, bool &MayBePseudoDestructor)
ExprResult ActOnCaseExpr(SourceLocation CaseLoc, ExprResult Val)
ExprResult BuildStmtExpr(SourceLocation LPLoc, Stmt *SubStmt, SourceLocation RPLoc, unsigned TemplateDepth)
ExprResult BuildResolvedCoawaitExpr(SourceLocation KwLoc, Expr *Operand, Expr *Awaiter, bool IsImplicit=false)
ExprResult BuildVAArgExpr(SourceLocation BuiltinLoc, Expr *E, TypeSourceInfo *TInfo, SourceLocation RPLoc)
@ CTAK_Specified
The template argument was specified in the code or was instantiated with some deduced template argume...
ExprResult ActOnCXXDelete(SourceLocation StartLoc, bool UseGlobal, bool ArrayForm, Expr *Operand)
ActOnCXXDelete - Parsed a C++ 'delete' expression (C++ 5.3.5), as in:
ExprResult BuildCXXTypeId(QualType TypeInfoType, SourceLocation TypeidLoc, TypeSourceInfo *Operand, SourceLocation RParenLoc)
Build a C++ typeid expression with a type operand.
ExprResult PerformMemberExprBaseConversion(Expr *Base, bool IsArrow)
Perform conversions on the LHS of a member access expression.
DiagnosticsEngine & getDiagnostics() const
ExprResult BuildPackIndexingExpr(Expr *PackExpression, SourceLocation EllipsisLoc, Expr *IndexExpr, SourceLocation RSquareLoc, ArrayRef< Expr * > ExpandedExprs={}, bool FullySubstituted=false)
ParsedType getDestructorName(const IdentifierInfo &II, SourceLocation NameLoc, Scope *S, CXXScopeSpec &SS, ParsedType ObjectType, bool EnteringContext)
ASTContext & getASTContext() const
CXXDestructorDecl * LookupDestructor(CXXRecordDecl *Class)
Look for the destructor of the given class.
ExprResult BuildUnaryOp(Scope *S, SourceLocation OpLoc, UnaryOperatorKind Opc, Expr *Input, bool IsAfterAmp=false)
ExprResult BuildTemplateIdExpr(const CXXScopeSpec &SS, SourceLocation TemplateKWLoc, LookupResult &R, bool RequiresADL, const TemplateArgumentListInfo *TemplateArgs)
ExprResult CreateOverloadedBinOp(SourceLocation OpLoc, BinaryOperatorKind Opc, const UnresolvedSetImpl &Fns, Expr *LHS, Expr *RHS, bool RequiresADL=true, bool AllowRewrittenCandidates=true, FunctionDecl *DefaultedFn=nullptr)
Create a binary operation that may resolve to an overloaded operator.
StmtResult ActOnSEHTryBlock(bool IsCXXTry, SourceLocation TryLoc, Stmt *TryBlock, Stmt *Handler)
ExprResult BuildPredefinedExpr(SourceLocation Loc, PredefinedIdentKind IK)
ExprResult CheckConceptTemplateId(const CXXScopeSpec &SS, SourceLocation TemplateKWLoc, const DeclarationNameInfo &ConceptNameInfo, NamedDecl *FoundDecl, TemplateDecl *NamedConcept, const TemplateArgumentListInfo *TemplateArgs, bool DoCheckConstraintSatisfaction=true)
ExprResult BuildCompoundLiteralExpr(SourceLocation LParenLoc, TypeSourceInfo *TInfo, SourceLocation RParenLoc, Expr *LiteralExpr)
ExprResult ActOnAddrLabel(SourceLocation OpLoc, SourceLocation LabLoc, LabelDecl *TheDecl)
ActOnAddrLabel - Parse the GNU address of label extension: "&&foo".
ExprResult ActOnParenListExpr(SourceLocation L, SourceLocation R, MultiExprArg Val)
QualType BuildCountAttributedArrayOrPointerType(QualType WrappedTy, Expr *CountExpr, bool CountInBytes, bool OrNull)
ExprResult BuildCXXNew(SourceRange Range, bool UseGlobal, SourceLocation PlacementLParen, MultiExprArg PlacementArgs, SourceLocation PlacementRParen, SourceRange TypeIdParens, QualType AllocType, TypeSourceInfo *AllocTypeInfo, std::optional< Expr * > ArraySize, SourceRange DirectInitRange, Expr *Initializer)
DeclRefExpr * BuildDeclRefExpr(ValueDecl *D, QualType Ty, ExprValueKind VK, SourceLocation Loc, const CXXScopeSpec *SS=nullptr)
ExprResult BuildCXXFoldExpr(UnresolvedLookupExpr *Callee, SourceLocation LParenLoc, Expr *LHS, BinaryOperatorKind Operator, SourceLocation EllipsisLoc, Expr *RHS, SourceLocation RParenLoc, UnsignedOrNone NumExpansions)
ExprResult CreateGenericSelectionExpr(SourceLocation KeyLoc, SourceLocation DefaultLoc, SourceLocation RParenLoc, bool PredicateIsExpr, void *ControllingExprOrType, ArrayRef< TypeSourceInfo * > Types, ArrayRef< Expr * > Exprs)
ControllingExprOrType is either a TypeSourceInfo * or an Expr *.
bool CheckTemplateArgument(NamedDecl *Param, TemplateArgumentLoc &Arg, NamedDecl *Template, SourceLocation TemplateLoc, SourceLocation RAngleLoc, unsigned ArgumentPackIndex, CheckTemplateArgumentInfo &CTAI, CheckTemplateArgumentKind CTAK)
Check that the given template argument corresponds to the given template parameter.
StmtResult ActOnFinishSwitchStmt(SourceLocation SwitchLoc, Stmt *Switch, Stmt *Body)
SourceLocation getLocForEndOfToken(SourceLocation Loc, unsigned Offset=0)
Calls Lexer::getLocForEndOfToken()
const LangOptions & getLangOpts() const
StmtResult ActOnWhileStmt(SourceLocation WhileLoc, SourceLocation LParenLoc, ConditionResult Cond, SourceLocation RParenLoc, Stmt *Body)
bool isPotentialImplicitMemberAccess(const CXXScopeSpec &SS, LookupResult &R, bool IsAddressOfOperand)
Check whether an expression might be an implicit class member access.
void collectUnexpandedParameterPacks(TemplateArgument Arg, SmallVectorImpl< UnexpandedParameterPack > &Unexpanded)
Collect the set of unexpanded parameter packs within the given template argument.
ExprResult BuildSourceLocExpr(SourceLocIdentKind Kind, QualType ResultTy, SourceLocation BuiltinLoc, SourceLocation RPLoc, DeclContext *ParentContext)
ExprResult BuildCXXTypeConstructExpr(TypeSourceInfo *Type, SourceLocation LParenLoc, MultiExprArg Exprs, SourceLocation RParenLoc, bool ListInitialization)
ExprResult BuildBuiltinOffsetOf(SourceLocation BuiltinLoc, TypeSourceInfo *TInfo, ArrayRef< OffsetOfComponent > Components, SourceLocation RParenLoc)
__builtin_offsetof(type, a.b[123][456].c)
ExprResult TemporaryMaterializationConversion(Expr *E)
If E is a prvalue denoting an unmaterialized temporary, materialize it as an xvalue.
ExprResult BuildTypeTrait(TypeTrait Kind, SourceLocation KWLoc, ArrayRef< TypeSourceInfo * > Args, SourceLocation RParenLoc)
TemplateArgument getPackSubstitutedTemplateArgument(TemplateArgument Arg) const
ExprResult BuildUnresolvedCoawaitExpr(SourceLocation KwLoc, Expr *Operand, UnresolvedLookupExpr *Lookup)
ExprResult BuildExpressionTrait(ExpressionTrait OET, SourceLocation KWLoc, Expr *Queried, SourceLocation RParen)
bool buildCoroutineParameterMoves(SourceLocation Loc)
ExprResult BuildCStyleCastExpr(SourceLocation LParenLoc, TypeSourceInfo *Ty, SourceLocation RParenLoc, Expr *Op)
ExprResult BuildCXXUuidof(QualType TypeInfoType, SourceLocation TypeidLoc, TypeSourceInfo *Operand, SourceLocation RParenLoc)
Build a Microsoft __uuidof expression with a type operand.
sema::FunctionScopeInfo * getCurFunction() const
DeclGroupPtrTy BuildDeclaratorGroup(MutableArrayRef< Decl * > Group)
BuildDeclaratorGroup - convert a list of declarations into a declaration group, performing any necess...
Expr * BuildCXXThisExpr(SourceLocation Loc, QualType Type, bool IsImplicit)
Build a CXXThisExpr and mark it referenced in the current context.
UnsignedOrNone getPackIndex(TemplateArgument Pack) const
ExprResult BuildDeclarationNameExpr(const CXXScopeSpec &SS, LookupResult &R, bool NeedsADL, bool AcceptInvalidDecl=false)
sema::BlockScopeInfo * getCurBlock()
Retrieve the current block, if any.
DeclContext * CurContext
CurContext - This is the current declaration context of parsing.
VarDecl * BuildExceptionDeclaration(Scope *S, TypeSourceInfo *TInfo, SourceLocation StartLoc, SourceLocation IdLoc, const IdentifierInfo *Id)
Perform semantic analysis for the variable declaration that occurs within a C++ catch clause,...
void MarkDeclRefReferenced(DeclRefExpr *E, const Expr *Base=nullptr)
Perform reference-marking and odr-use handling for a DeclRefExpr.
ExprResult BuildQualifiedDeclarationNameExpr(CXXScopeSpec &SS, const DeclarationNameInfo &NameInfo, bool IsAddressOfOperand, TypeSourceInfo **RecoveryTSI=nullptr)
BuildQualifiedDeclarationNameExpr - Build a C++ qualified declaration name, generally during template...
StmtResult ActOnForStmt(SourceLocation ForLoc, SourceLocation LParenLoc, Stmt *First, ConditionResult Second, FullExprArg Third, SourceLocation RParenLoc, Stmt *Body)
StmtResult ActOnIndirectGotoStmt(SourceLocation GotoLoc, SourceLocation StarLoc, Expr *DestExp)
ExprResult ActOnParenExpr(SourceLocation L, SourceLocation R, Expr *E)
ExprResult BuildCXXConstructExpr(SourceLocation ConstructLoc, QualType DeclInitType, NamedDecl *FoundDecl, CXXConstructorDecl *Constructor, MultiExprArg Exprs, bool HadMultipleCandidates, bool IsListInitialization, bool IsStdInitListInitialization, bool RequiresZeroInit, CXXConstructionKind ConstructKind, SourceRange ParenRange)
BuildCXXConstructExpr - Creates a complete call to a constructor, including handling of its default a...
ExprResult BuildAsTypeExpr(Expr *E, QualType DestTy, SourceLocation BuiltinLoc, SourceLocation RParenLoc)
Create a new AsTypeExpr node (bitcast) from the arguments.
ExprResult BuildFieldReferenceExpr(Expr *BaseExpr, bool IsArrow, SourceLocation OpLoc, const CXXScopeSpec &SS, FieldDecl *Field, DeclAccessPair FoundDecl, const DeclarationNameInfo &MemberNameInfo)
ExprResult ActOnConditionalOp(SourceLocation QuestionLoc, SourceLocation ColonLoc, Expr *CondExpr, Expr *LHSExpr, Expr *RHSExpr)
ActOnConditionalOp - Parse a ?
ExprResult BuildPossibleImplicitMemberExpr(const CXXScopeSpec &SS, SourceLocation TemplateKWLoc, LookupResult &R, const TemplateArgumentListInfo *TemplateArgs, const Scope *S)
Builds an expression which might be an implicit member expression.
UnsignedOrNone ArgPackSubstIndex
The current index into pack expansion arguments that will be used for substitution of parameter packs...
StmtResult BuildReturnStmt(SourceLocation ReturnLoc, Expr *RetValExp, bool AllowRecovery=false)
StmtResult BuildCXXForRangeStmt(SourceLocation ForLoc, SourceLocation CoawaitLoc, Stmt *InitStmt, SourceLocation ColonLoc, Stmt *RangeDecl, Stmt *Begin, Stmt *End, Expr *Cond, Expr *Inc, Stmt *LoopVarDecl, SourceLocation RParenLoc, BuildForRangeKind Kind, ArrayRef< MaterializeTemporaryExpr * > LifetimeExtendTemps={})
BuildCXXForRangeStmt - Build or instantiate a C++11 for-range statement.
StmtResult ActOnDoStmt(SourceLocation DoLoc, Stmt *Body, SourceLocation WhileLoc, SourceLocation CondLParen, Expr *Cond, SourceLocation CondRParen)
StmtResult ActOnStartOfSwitchStmt(SourceLocation SwitchLoc, SourceLocation LParenLoc, Stmt *InitStmt, ConditionResult Cond, SourceLocation RParenLoc)
ExprResult BuildQualifiedTemplateIdExpr(CXXScopeSpec &SS, SourceLocation TemplateKWLoc, const DeclarationNameInfo &NameInfo, const TemplateArgumentListInfo *TemplateArgs, bool IsAddressOfOperand)
@ ConstantEvaluated
The current context is "potentially evaluated" in C++11 terms, but the expression is evaluated at com...
@ PotentiallyEvaluated
The current expression is potentially evaluated at run time, which means that code may be generated t...
@ Unevaluated
The current expression and its subexpressions occur within an unevaluated operand (C++11 [expr]p7),...
@ ImmediateFunctionContext
In addition of being constant evaluated, the current expression occurs in an immediate function conte...
StmtResult ActOnSEHExceptBlock(SourceLocation Loc, Expr *FilterExpr, Stmt *Block)
ExprResult CreateUnaryExprOrTypeTraitExpr(TypeSourceInfo *TInfo, SourceLocation OpLoc, UnaryExprOrTypeTrait ExprKind, SourceRange R)
Build a sizeof or alignof expression given a type operand.
StmtResult ActOnDeclStmt(DeclGroupPtrTy Decl, SourceLocation StartLoc, SourceLocation EndLoc)
ExprResult PerformObjectMemberConversion(Expr *From, NestedNameSpecifier Qualifier, NamedDecl *FoundDecl, NamedDecl *Member)
Cast a base object to a member's actual type.
Expr * MaybeCreateExprWithCleanups(Expr *SubExpr)
MaybeCreateExprWithCleanups - If the current full-expression requires any cleanups,...
SmallVector< ExpressionEvaluationContextRecord, 8 > ExprEvalContexts
A stack of expression evaluation contexts.
ExprResult BuildEmptyCXXFoldExpr(SourceLocation EllipsisLoc, BinaryOperatorKind Operator)
ExprResult BuildCXXThrow(SourceLocation OpLoc, Expr *Ex, bool IsThrownVarInScope)
ExprResult BuildBinOp(Scope *S, SourceLocation OpLoc, BinaryOperatorKind Opc, Expr *LHSExpr, Expr *RHSExpr, bool ForFoldExpression=false)
ExprResult BuildCXXDefaultInitExpr(SourceLocation Loc, FieldDecl *Field)
ExprResult BuildLambdaExpr(SourceLocation StartLoc, SourceLocation EndLoc)
Complete a lambda-expression having processed and attached the lambda body.
@ BFRK_Rebuild
Instantiation or recovery rebuild of a for-range statement.
void ActOnCaseStmtBody(Stmt *CaseStmt, Stmt *SubStmt)
ActOnCaseStmtBody - This installs a statement as the body of a case.
ExprResult ActOnBlockStmtExpr(SourceLocation CaretLoc, Stmt *Body, Scope *CurScope)
ActOnBlockStmtExpr - This is called when the body of a block statement literal was successfully compl...
ExprResult BuildArrayTypeTrait(ArrayTypeTrait ATT, SourceLocation KWLoc, TypeSourceInfo *TSInfo, Expr *DimExpr, SourceLocation RParen)
void MarkMemberReferenced(MemberExpr *E)
Perform reference-marking and odr-use handling for a MemberExpr.
ExprResult BuildCXXNamedCast(SourceLocation OpLoc, tok::TokenKind Kind, TypeSourceInfo *Ty, Expr *E, SourceRange AngleBrackets, SourceRange Parens)
void MarkFunctionReferenced(SourceLocation Loc, FunctionDecl *Func, bool MightBeOdrUse=true)
Mark a function referenced, and check whether it is odr-used (C++ [basic.def.odr]p2,...
ExprResult CreateRecoveryExpr(SourceLocation Begin, SourceLocation End, ArrayRef< Expr * > SubExprs, QualType T=QualType())
Attempts to produce a RecoveryExpr after some AST node cannot be created.
ExprResult ActOnGCCAsmStmtString(Expr *Stm, bool ForAsmLabel)
StmtResult ActOnIfStmt(SourceLocation IfLoc, IfStatementKind StatementKind, SourceLocation LParenLoc, Stmt *InitStmt, ConditionResult Cond, SourceLocation RParenLoc, Stmt *ThenVal, SourceLocation ElseLoc, Stmt *ElseVal)
void ActOnBlockStart(SourceLocation CaretLoc, Scope *CurScope)
ActOnBlockStart - This callback is invoked when a block literal is started.
ExprResult ActOnArraySubscriptExpr(Scope *S, Expr *Base, SourceLocation LLoc, MultiExprArg ArgExprs, SourceLocation RLoc)
ExprResult BuildAtomicExpr(SourceRange CallRange, SourceRange ExprRange, SourceLocation RParenLoc, MultiExprArg Args, AtomicExpr::AtomicOp Op, AtomicArgumentOrder ArgOrder=AtomicArgumentOrder::API)
ExprResult ActOnCallExpr(Scope *S, Expr *Fn, SourceLocation LParenLoc, MultiExprArg ArgExprs, SourceLocation RParenLoc, Expr *ExecConfig=nullptr)
ActOnCallExpr - Handle a call to Fn with the specified array of arguments.
OpaquePtr< TemplateName > TemplateTy
static QualType GetTypeFromParser(ParsedType Ty, TypeSourceInfo **TInfo=nullptr)
static ConditionResult ConditionError()
StmtResult ActOnCompoundStmt(SourceLocation L, SourceLocation R, ArrayRef< Stmt * > Elts, bool isStmtExpr)
SemaPseudoObject & PseudoObject()
StmtResult ActOnCXXTryBlock(SourceLocation TryLoc, Stmt *TryBlock, ArrayRef< Stmt * > Handlers)
ActOnCXXTryBlock - Takes a try compound-statement and a number of handlers and creates a try statemen...
OpaquePtr< DeclGroupRef > DeclGroupPtrTy
StmtResult ActOnDefaultStmt(SourceLocation DefaultLoc, SourceLocation ColonLoc, Stmt *SubStmt, Scope *CurScope)
ExprResult HandleExprEvaluationContextForTypeof(Expr *E)
StmtResult ActOnCaseStmt(SourceLocation CaseLoc, ExprResult LHS, SourceLocation DotDotDotLoc, ExprResult RHS, SourceLocation ColonLoc)
TypeSourceInfo * CheckPackExpansion(TypeSourceInfo *Pattern, SourceLocation EllipsisLoc, UnsignedOrNone NumExpansions)
Construct a pack expansion type from the pattern of the pack expansion.
StmtResult FinishCXXForRangeStmt(Stmt *ForRange, Stmt *Body)
FinishCXXForRangeStmt - Attach the body to a C++0x for-range statement.
ExprResult ActOnFinishFullExpr(Expr *Expr, bool DiscardedValue)
ExprResult CreateBuiltinMatrixSubscriptExpr(Expr *Base, Expr *RowIdx, Expr *ColumnIdx, SourceLocation RBLoc)
StmtResult ActOnGCCAsmStmt(SourceLocation AsmLoc, bool IsSimple, bool IsVolatile, unsigned NumOutputs, unsigned NumInputs, IdentifierInfo **Names, MultiExprArg Constraints, MultiExprArg Exprs, Expr *AsmString, MultiExprArg Clobbers, unsigned NumLabels, SourceLocation RParenLoc)
ShuffleVectorExpr - clang-specific builtin-in function __builtin_shufflevector.
Represents an expression that computes the length of a parameter pack.
SourceLocation getPackLoc() const
Determine the location of the parameter pack.
bool isPartiallySubstituted() const
Determine whether this represents a partially-substituted sizeof... expression, such as is produced f...
static SizeOfPackExpr * Create(ASTContext &Context, SourceLocation OperatorLoc, NamedDecl *Pack, SourceLocation PackLoc, SourceLocation RParenLoc, UnsignedOrNone Length=std::nullopt, ArrayRef< TemplateArgument > PartialArgs={})
ArrayRef< TemplateArgument > getPartialArguments() const
Get.
SourceLocation getOperatorLoc() const
Determine the location of the 'sizeof' keyword.
SourceLocation getRParenLoc() const
Determine the location of the right parenthesis.
NamedDecl * getPack() const
Retrieve the parameter pack.
Represents a function call to one of __builtin_LINE(), __builtin_COLUMN(), __builtin_FUNCTION(),...
static bool MayBeDependent(SourceLocIdentKind Kind)
Encodes a location in the source.
bool isValid() const
Return true if this is a valid SourceLocation object.
A trivial tuple used to represent a source range.
SourceLocation getEnd() const
SourceLocation getBegin() const
StmtExpr - This is the GNU Statement Expression extension: ({int X=4; X;}).
Stmt - This represents one statement.
SourceLocation getEndLoc() const LLVM_READONLY
StmtClass getStmtClass() const
SourceRange getSourceRange() const LLVM_READONLY
SourceLocation tokens are not useful in isolation - they are low level value objects created/interpre...
StringLiteral - This represents a string literal expression, e.g.
Wrapper for substituted template type parameters.
Represents a reference to a non-type template parameter that has been substituted with a template arg...
Represents a reference to a non-type template parameter pack that has been substituted with a non-tem...
A structure for storing an already-substituted template template parameter pack.
A structure for storing the information associated with a substituted template template parameter.
Wrapper for substituted template type parameters.
SwitchStmt - This represents a 'switch' stmt.
Represents the declaration of a struct/union/class/enum.
SourceLocation getNameLoc() const
SourceLocation getElaboratedKeywordLoc() const
NestedNameSpecifierLoc getQualifierLoc() const
void setQualifierLoc(NestedNameSpecifierLoc QualifierLoc)
void setNameLoc(SourceLocation Loc)
void setElaboratedKeywordLoc(SourceLocation Loc)
A convenient class for passing around template argument information.
void setLAngleLoc(SourceLocation Loc)
void setRAngleLoc(SourceLocation Loc)
void addArgument(const TemplateArgumentLoc &Loc)
const TemplateArgumentLoc * operator->() const
pointer(TemplateArgumentLoc Arg)
Simple iterator that traverses the template arguments in a container that provides a getArgLoc() memb...
TemplateArgumentLoc operator*() const
TemplateArgumentLocContainerIterator operator++(int)
friend bool operator!=(const TemplateArgumentLocContainerIterator &X, const TemplateArgumentLocContainerIterator &Y)
TemplateArgumentLocContainerIterator()
TemplateArgumentLoc value_type
TemplateArgumentLocContainerIterator(ArgLocContainer &Container, unsigned Index)
friend bool operator==(const TemplateArgumentLocContainerIterator &X, const TemplateArgumentLocContainerIterator &Y)
TemplateArgumentLocContainerIterator & operator++()
std::input_iterator_tag iterator_category
TemplateArgumentLoc reference
pointer operator->() const
const TemplateArgumentLoc * operator->() const
pointer(TemplateArgumentLoc Arg)
Iterator adaptor that invents template argument location information for each of the template argumen...
TemplateArgumentLocInventIterator & operator++()
pointer operator->() const
std::iterator_traits< InputIterator >::difference_type difference_type
reference operator*() const
TemplateArgumentLocInventIterator operator++(int)
friend bool operator==(const TemplateArgumentLocInventIterator &X, const TemplateArgumentLocInventIterator &Y)
TemplateArgumentLocInventIterator(TreeTransform< Derived > &Self, InputIterator Iter)
friend bool operator!=(const TemplateArgumentLocInventIterator &X, const TemplateArgumentLocInventIterator &Y)
std::input_iterator_tag iterator_category
TemplateArgumentLoc reference
TemplateArgumentLoc value_type
Location wrapper for a TemplateArgument.
const TemplateArgument & getArgument() const
SourceLocation getTemplateNameLoc() const
SourceLocation getTemplateKWLoc() const
TypeSourceInfo * getTypeSourceInfo() const
Expr * getSourceExpression() const
NestedNameSpecifierLoc getTemplateQualifierLoc() const
Represents a template argument.
Expr * getAsExpr() const
Retrieve the template argument as an expression.
const TemplateArgument * pack_iterator
Iterator that traverses the elements of a template argument pack.
QualType getNonTypeTemplateArgumentType() const
If this is a non-type template argument, get its type.
QualType getAsType() const
Retrieve the type for a type template argument.
llvm::APSInt getAsIntegral() const
Retrieve the template argument as an integral value.
TemplateName getAsTemplate() const
Retrieve the template name for a template name argument.
bool containsUnexpandedParameterPack() const
Whether this template argument contains an unexpanded parameter pack.
ValueDecl * getAsDecl() const
Retrieve the declaration for a declaration non-type template argument.
@ Declaration
The template argument is a declaration that was provided for a pointer, reference,...
@ Template
The template argument is a template name that was provided for a template template parameter.
@ StructuralValue
The template argument is a non-type template argument that can't be represented by the special-case D...
@ Pack
The template argument is actually a parameter pack.
@ TemplateExpansion
The template argument is a pack expansion of a template name that was provided for a template templat...
@ NullPtr
The template argument is a null pointer or null pointer to member that was provided for a non-type te...
@ Type
The template argument is a type.
@ Null
Represents an empty template argument, e.g., one that has not been deduced.
@ Integral
The template argument is an integral value stored in an llvm::APSInt that was provided for an integra...
@ Expression
The template argument is an expression, and we've not resolved it to one of the other forms yet,...
ArgKind getKind() const
Return the kind of stored template argument.
bool isPackExpansion() const
Determine whether this template argument is a pack expansion.
const APValue & getAsStructuralValue() const
Get the value of a StructuralValue.
The base class of all kinds of template declarations (e.g., class, function, etc.).
Represents a C++ template name within the type system.
TemplateDecl * getAsTemplateDecl(bool IgnoreDeduced=false) const
Retrieve the underlying template declaration that this template name refers to, if known.
DeducedTemplateStorage * getAsDeducedTemplateName() const
Retrieve the deduced template info, if any.
bool isNull() const
Determine whether this template name is NULL.
DependentTemplateName * getAsDependentTemplateName() const
Retrieve the underlying dependent template name structure, if any.
QualifiedTemplateName * getAsQualifiedTemplateName() const
Retrieve the underlying qualified template name structure, if any.
NestedNameSpecifier getQualifier() const
SubstTemplateTemplateParmPackStorage * getAsSubstTemplateTemplateParmPack() const
Retrieve the substituted template template parameter pack, if known.
SubstTemplateTemplateParmStorage * getAsSubstTemplateTemplateParm() const
Retrieve the substituted template template parameter, if known.
Stores a list of template parameters for a TemplateDecl and its derived classes.
unsigned getNumArgs() const
SourceLocation getLAngleLoc() const
SourceLocation getRAngleLoc() const
SourceLocation getTemplateNameLoc() const
SourceLocation getTemplateKeywordLoc() const
NestedNameSpecifierLoc getQualifierLoc() const
SourceLocation getElaboratedKeywordLoc() const
Wrapper for template type parameters.
The top declaration context.
TypeLoc getTypeLocInContext(ASTContext &Context, QualType T)
Copies the type-location information to the given AST context and returns a TypeLoc referring into th...
TyLocType push(QualType T)
Pushes space for a new TypeLoc of the given type.
void reserve(size_t Requested)
Ensures that this buffer has at least as much capacity as described.
void TypeWasModifiedSafely(QualType T)
Tell the TypeLocBuilder that the type it is storing has been modified in some safe way that doesn't a...
TypeSourceInfo * getTypeSourceInfo(ASTContext &Context, QualType T)
Creates a TypeSourceInfo for the given type.
Base wrapper for a particular "section" of type source info.
UnqualTypeLoc getUnqualifiedLoc() const
Skips past any qualifiers, if this is qualified.
QualType getType() const
Get the type for which this source info wrapper provides information.
T getAs() const
Convert to the specified TypeLoc type, returning a null TypeLoc if this TypeLoc is not of the desired...
T castAs() const
Convert to the specified TypeLoc type, asserting that this TypeLoc is of the desired type.
SourceRange getSourceRange() const LLVM_READONLY
Get the full source range.
unsigned getFullDataSize() const
Returns the size of the type source info data block.
TypeLocClass getTypeLocClass() const
T getAsAdjusted() const
Convert to the specified TypeLoc type, returning a null TypeLoc if this TypeLoc is not of the desired...
SourceLocation getBeginLoc() const
Get the begin source location.
Represents a typeof (or typeof) expression (a C23 feature and GCC extension) or a typeof_unqual expre...
A container of type source information.
TypeLoc getTypeLoc() const
Return the TypeLoc wrapper for the type source info.
QualType getType() const
Return the type wrapped by this type source info.
void setNameLoc(SourceLocation Loc)
A type trait used in the implementation of various C++11 and Library TR1 trait templates.
The base class of the type hierarchy.
bool isDependentType() const
Whether this type is a dependent type, meaning that its definition somehow depends on a template para...
bool containsUnexpandedParameterPack() const
Whether this type is or contains an unexpanded parameter pack, used to support C++0x variadic templat...
bool isOverloadableType() const
Determines whether this is a type for which one can define an overloaded operator.
bool isObjCObjectPointerType() const
const T * getAs() const
Member-template getAs<specific type>'.
Base class for declarations which introduce a typedef-name.
Wrapper for source info for typedefs.
void setTypeofLoc(SourceLocation Loc)
UnaryExprOrTypeTraitExpr - expression with either a type or (unevaluated) expression operand.
UnaryOperator - This represents the unary-expression's (except sizeof and alignof),...
SourceLocation getOperatorLoc() const
getOperatorLoc - Return the location of the operator.
Expr * getSubExpr() const
static Opcode getOverloadedOpcode(OverloadedOperatorKind OO, bool Postfix)
Retrieve the unary opcode that corresponds to the given overloaded operator.
Represents a C++ unqualified-id that has been parsed.
void setOperatorFunctionId(SourceLocation OperatorLoc, OverloadedOperatorKind Op, SourceLocation SymbolLocations[3])
Specify that this unqualified-id was parsed as an operator-function-id.
A reference to a name which we were able to look up during parsing but could not resolve to a specifi...
CXXRecordDecl * getNamingClass()
Gets the 'naming class' (in the sense of C++0x [class.access.base]p5) of the lookup.
bool requiresADL() const
True if this declaration should be extended by argument-dependent lookup.
static UnresolvedLookupExpr * Create(const ASTContext &Context, CXXRecordDecl *NamingClass, NestedNameSpecifierLoc QualifierLoc, const DeclarationNameInfo &NameInfo, bool RequiresADL, UnresolvedSetIterator Begin, UnresolvedSetIterator End, bool KnownDependent, bool KnownInstantiationDependent)
Represents a C++ member access expression for which lookup produced a set of overloaded functions.
A set of unresolved declarations.
void append(iterator I, iterator E)
A set of unresolved declarations.
Wrapper for source info for unresolved typename using decls.
Represents the dependent type named by a dependently-scoped typename using declaration,...
A call to a literal operator (C++11 [over.literal]) written as a user-defined literal (C++11 [lit....
Represents a shadow declaration implicitly introduced into a scope by a (resolved) using-declaration ...
NamedDecl * getTargetDecl() const
Gets the underlying declaration which has been brought into the local scope.
Wrapper for source info for types used via transparent aliases.
Represents a call to the builtin function __builtin_va_arg.
Represent the declaration of a variable (in which case it is an lvalue) a function (in which case it ...
bool isParameterPack() const
Determine whether this value is actually a function parameter pack, init-capture pack,...
Represents a variable declaration or definition.
@ CInit
C-style initialization with assignment.
@ CallInit
Call-style initialization (C++98)
StorageClass getStorageClass() const
Returns the storage class as written in the source.
Represents a C array with a specified size that is not an integer-constant-expression.
void setNameLoc(SourceLocation Loc)
Represents a GCC generic vector type.
WhileStmt - This represents a 'while' stmt.
A requires-expression requirement which queries the validity and properties of an expression ('simple...
SubstitutionDiagnostic * getExprSubstitutionDiagnostic() const
bool isExprSubstitutionFailure() const
const ReturnTypeRequirement & getReturnTypeRequirement() const
SourceLocation getNoexceptLoc() const
A requires-expression requirement which is satisfied when a general constraint expression is satisfie...
const ASTConstraintSatisfaction & getConstraintSatisfaction() const
bool hasInvalidConstraint() const
Expr * getConstraintExpr() const
StringRef getInvalidConstraintEntity()
A static requirement that can be used in a requires-expression to check properties of types and expre...
A requires-expression requirement which queries the existence of a type name or type template special...
bool isSubstitutionFailure() const
SubstitutionDiagnostic * getSubstitutionDiagnostic() const
TypeSourceInfo * getType() const
Retains information about a block that is currently being parsed.
bool ContainsUnexpandedParameterPack
Whether this contains an unexpanded parameter pack.
CXXRecordDecl * Lambda
The class that describes the lambda.
CXXMethodDecl * CallOperator
The lambda's compiler-generated operator().
@ AttributedType
The l-value was considered opaque, so the alignment was determined from a type, but that type was an ...
const AstTypeMatcher< FunctionType > functionType
llvm::PointerUnion< const Decl *, const Expr * > DeclTy
bool Comp(InterpState &S, CodePtr OpPC)
1) Pops the value from the stack.
bool Inc(InterpState &S, CodePtr OpPC, bool CanOverflow)
1) Pops a pointer from the stack 2) Load the value from the pointer 3) Writes the value increased by ...
The JSON file list parser is used to communicate input to InstallAPI.
CanQual< Type > CanQualType
Represents a canonical, potentially-qualified type.
OpenMPOriginalSharingModifier
OpenMP 6.0 original sharing modifiers.
OverloadedOperatorKind
Enumeration specifying the different kinds of C++ overloaded operators.
@ OO_None
Not an overloaded operator.
@ NUM_OVERLOADED_OPERATORS
bool isa(CodeGen::Address addr)
ArrayTypeTrait
Names for the array type traits.
OpenMPDefaultClauseVariableCategory
OpenMP variable-category for 'default' clause.
AutoTypeKeyword
Which keyword(s) were used to create an AutoType.
OpenMPDefaultmapClauseModifier
OpenMP modifiers for 'defaultmap' clause.
OpenMPOrderClauseModifier
OpenMP modifiers for 'order' clause.
@ Ambiguous
Name lookup results in an ambiguity; use getAmbiguityKind to figure out what kind of ambiguity we hav...
@ NotFound
No entity found met the criteria.
@ FoundOverloaded
Name lookup found a set of overloaded functions that met the criteria.
@ Found
Name lookup found a single declaration that met the criteria.
@ FoundUnresolvedValue
Name lookup found an unresolvable value declaration and cannot yet complete.
@ NotFoundInCurrentInstantiation
No entity found met the criteria within the current instantiation,, but there were dependent base cla...
IfStatementKind
In an if statement, this denotes whether the statement is a constexpr or consteval if statement.
@ TemplateName
The identifier is a template name. FIXME: Add an annotation for that.
@ OK_ObjCProperty
An Objective-C property is a logical field of an Objective-C object which is read and written via Obj...
OpenMPAtClauseKind
OpenMP attributes for 'at' clause.
@ LCK_ByCopy
Capturing by copy (a.k.a., by value)
@ LCK_ByRef
Capturing by reference.
@ LCK_StarThis
Capturing the *this object by copy.
NonTagKind
Common ways to introduce type names without a tag for use in diagnostics.
OpenMPReductionClauseModifier
OpenMP modifiers for 'reduction' clause.
std::pair< llvm::PointerUnion< const TemplateTypeParmType *, NamedDecl *, const TemplateSpecializationType *, const SubstBuiltinTemplatePackType * >, SourceLocation > UnexpandedParameterPack
@ DevicePtr
'deviceptr' clause, allowed on Compute and Combined Constructs, plus 'data' and 'declare'.
@ Invalid
Represents an invalid clause, for the purposes of parsing.
@ Attach
'attach' clause, allowed on Compute and Combined constructs, plus 'data' and 'enter data'.
@ Self
'self' clause, allowed on Compute and Combined Constructs, plus 'update'.
@ Detach
'detach' clause, allowed on the 'exit data' construct.
TypeOfKind
The kind of 'typeof' expression we're after.
OpenMPScheduleClauseModifier
OpenMP modifiers for 'schedule' clause.
OpenACCComputeConstruct(OpenACCDirectiveKind K, SourceLocation Start, SourceLocation DirectiveLoc, SourceLocation End, ArrayRef< const OpenACCClause * > Clauses, Stmt *StructuredBlock)
OpenMPDistScheduleClauseKind
OpenMP attributes for 'dist_schedule' clause.
OpenMPDoacrossClauseModifier
OpenMP dependence types for 'doacross' clause.
@ Dependent
Parse the block as a dependent block, which may be used in some template instantiations but not other...
UnaryExprOrTypeTrait
Names for the "expression or type" traits.
std::pair< NullabilityKind, bool > DiagNullabilityKind
A nullability kind paired with a bit indicating whether it used a context-sensitive keyword.
OpenMPDynGroupprivateClauseFallbackModifier
MutableArrayRef< Expr * > MultiExprArg
@ Property
The type of a property.
@ Result
The result type of a method or function.
OpenMPBindClauseKind
OpenMP bindings for the 'bind' clause.
ArraySizeModifier
Capture whether this is a normal array (e.g.
const FunctionProtoType * T
bool isComputedNoexcept(ExceptionSpecificationType ESpecType)
OpenMPLastprivateModifier
OpenMP 'lastprivate' clause modifier.
@ Template
We are parsing a template declaration.
ActionResult< CXXBaseSpecifier * > BaseResult
OpenMPGrainsizeClauseModifier
OpenMPNumTasksClauseModifier
TagTypeKind
The kind of a tag type.
bool transformOMPMappableExprListClause(TreeTransform< Derived > &TT, OMPMappableExprListClause< T > *C, llvm::SmallVectorImpl< Expr * > &Vars, CXXScopeSpec &MapperIdScopeSpec, DeclarationNameInfo &MapperIdInfo, llvm::SmallVectorImpl< Expr * > &UnresolvedMappers)
@ Keyword
The name has been typo-corrected to a keyword.
bool isOpenMPLoopDirective(OpenMPDirectiveKind DKind)
Checks if the specified directive is a directive with an associated loop construct.
OpenMPSeverityClauseKind
OpenMP attributes for 'severity' clause.
std::tuple< NamedDecl *, TemplateArgument > getReplacedTemplateParameter(Decl *D, unsigned Index)
Internal helper used by Subst* nodes to retrieve a parameter from the AssociatedDecl,...
OpenMPDefaultmapClauseKind
OpenMP attributes for 'defaultmap' clause.
OpenMPAllocateClauseModifier
OpenMP modifiers for 'allocate' clause.
OpenMPLinearClauseKind
OpenMP attributes for 'linear' clause.
llvm::omp::Directive OpenMPDirectiveKind
OpenMP directives.
OpenMPDynGroupprivateClauseModifier
@ VK_PRValue
A pr-value expression (in the C++11 taxonomy) produces a temporary value.
@ VK_LValue
An l-value expression is a reference to an object with independent storage.
@ Dependent
The name is a dependent name, so the results will differ from one instantiation to the next.
@ Exists
The symbol exists.
@ Error
An error occurred.
@ DoesNotExist
The symbol does not exist.
MutableArrayRef< Stmt * > MultiStmtArg
OpenMPNumThreadsClauseModifier
U cast(CodeGen::Address addr)
OpenMPDeviceClauseModifier
OpenMP modifiers for 'device' clause.
OpaquePtr< QualType > ParsedType
An opaque type for threading parsed type information through the parser.
ElaboratedTypeKeyword
The elaboration keyword that precedes a qualified type name or introduces an elaborated-type-specifie...
@ None
No keyword precedes the qualified type name.
@ Class
The "class" keyword introduces the elaborated-type-specifier.
@ Typename
The "typename" keyword precedes the qualified type name, e.g., typename T::type.
ActionResult< Expr * > ExprResult
OpenMPOrderClauseKind
OpenMP attributes for 'order' clause.
TypeTrait
Names for traits that operate specifically on types.
@ Parens
New-expression has a C++98 paren-delimited initializer.
ExceptionSpecificationType
The various types of exception specifications that exist in C++11.
@ EST_Uninstantiated
not instantiated yet
@ EST_Unevaluated
not evaluated yet, for special member function
@ EST_Dynamic
throw(T1, T2)
OpenMPScheduleClauseKind
OpenMP attributes for 'schedule' clause.
static QualType TransformTypeSpecType(TypeLocBuilder &TLB, TyLoc T)
ActionResult< Stmt * > StmtResult
OpenMPMapClauseKind
OpenMP mapping kind for 'map' clause.
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].
Data for list of allocators.
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