34#include "llvm/ADT/ArrayRef.h"
35#include "llvm/Support/Casting.h"
36#include "llvm/Support/ErrorHandling.h"
58 case OO_Call:
case OO_Subscript:
71 bool SkippedNot =
false;
72 if (
auto *NotEq = dyn_cast<UnaryOperator>(E)) {
73 assert(NotEq->getOpcode() == UO_LNot);
79 if (
auto *BO = dyn_cast<BinaryOperator>(E)) {
80 assert(!SkippedNot || BO->getOpcode() == BO_EQ);
81 Result.Opcode = SkippedNot ? BO_NE : BO->getOpcode();
85 }
else if (
auto *BO = dyn_cast<CXXOperatorCallExpr>(E)) {
86 assert(!SkippedNot || BO->getOperator() == OO_EqualEqual);
87 assert(BO->isInfixBinaryOp());
88 switch (BO->getOperator()) {
89 case OO_Less:
Result.Opcode = BO_LT;
break;
90 case OO_LessEqual:
Result.Opcode = BO_LE;
break;
91 case OO_Greater:
Result.Opcode = BO_GT;
break;
92 case OO_GreaterEqual:
Result.Opcode = BO_GE;
break;
93 case OO_Spaceship:
Result.Opcode = BO_Cmp;
break;
94 case OO_EqualEqual:
Result.Opcode = SkippedNot ? BO_NE : BO_EQ;
break;
95 default: llvm_unreachable(
"unexpected binop in rewritten operator expr");
97 Result.LHS = BO->getArg(0);
98 Result.RHS = BO->getArg(1);
101 llvm_unreachable(
"unexpected rewritten operator form");
114 E =
Result.LHS->IgnoreImplicitAsWritten();
115 if (
auto *BO = dyn_cast<BinaryOperator>(E)) {
116 assert(BO->getOpcode() == BO_Cmp);
117 Result.LHS = BO->getLHS();
118 Result.RHS = BO->getRHS();
120 }
else if (
auto *BO = dyn_cast<CXXOperatorCallExpr>(E)) {
121 assert(BO->getOperator() == OO_Spaceship);
122 Result.LHS = BO->getArg(0);
123 Result.RHS = BO->getArg(1);
126 llvm_unreachable(
"unexpected rewritten operator form");
144 if (RD->isPolymorphic() && E->
isGLValue())
151 assert(!
isTypeOperand() &&
"Cannot call isMostDerived for typeid(type)");
153 if (
const auto *DRE = dyn_cast<DeclRefExpr>(E)) {
154 QualType Ty = DRE->getDecl()->getType();
163 assert(
isTypeOperand() &&
"Cannot call getTypeOperand for typeid(expr)");
170 assert(
isTypeOperand() &&
"Cannot call getTypeOperand for __uuidof(expr)");
182CXXNewExpr::CXXNewExpr(
bool IsGlobalNew,
FunctionDecl *OperatorNew,
184 bool UsualArrayDeleteWantsSize,
186 std::optional<Expr *> ArraySize,
187 InitializationStyle InitializationStyle,
192 OperatorNew(OperatorNew), OperatorDelete(OperatorDelete),
193 AllocatedTypeInfo(AllocatedTypeInfo), Range(Range),
194 DirectInitRange(DirectInitRange) {
197 "Only NoInit can have no initializer!");
202 CXXNewExprBits.UsualArrayDeleteWantsSize = UsualArrayDeleteWantsSize;
205 bool IsParenTypeId = TypeIdParens.
isValid();
210 getTrailingObjects<Stmt *>()[arraySizeOffset()] = *ArraySize;
212 getTrailingObjects<Stmt *>()[initExprOffset()] =
Initializer;
213 for (
unsigned I = 0; I != PlacementArgs.size(); ++I)
214 getTrailingObjects<Stmt *>()[placementNewArgsOffset() + I] =
217 getTrailingObjects<SourceRange>()[0] = TypeIdParens;
219 switch (getInitializationStyle()) {
235CXXNewExpr::CXXNewExpr(EmptyShell Empty,
bool IsArray,
236 unsigned NumPlacementArgs,
bool IsParenTypeId)
237 :
Expr(CXXNewExprClass, Empty) {
246 bool ShouldPassAlignment,
bool UsualArrayDeleteWantsSize,
248 std::optional<Expr *> ArraySize,
252 bool IsArray = ArraySize.has_value();
254 unsigned NumPlacementArgs = PlacementArgs.size();
255 bool IsParenTypeId = TypeIdParens.
isValid();
257 Ctx.
Allocate(totalSizeToAlloc<Stmt *, SourceRange>(
258 IsArray + HasInit + NumPlacementArgs, IsParenTypeId),
261 CXXNewExpr(IsGlobalNew, OperatorNew, OperatorDelete, ShouldPassAlignment,
262 UsualArrayDeleteWantsSize, PlacementArgs, TypeIdParens,
264 AllocatedTypeInfo, Range, DirectInitRange);
268 bool HasInit,
unsigned NumPlacementArgs,
269 bool IsParenTypeId) {
271 Ctx.
Allocate(totalSizeToAlloc<Stmt *, SourceRange>(
272 IsArray + HasInit + NumPlacementArgs, IsParenTypeId),
294 while (
const auto *ICE = dyn_cast<ImplicitCastExpr>(Arg)) {
295 if (ICE->getCastKind() == CK_DerivedToBase ||
296 ICE->getCastKind() == CK_UncheckedDerivedToBase ||
297 ICE->getCastKind() == CK_NoOp) {
298 assert((ICE->getCastKind() == CK_NoOp ||
300 "only a destroying operator delete can have a converted arg");
301 Arg = ICE->getSubExpr();
326 :
Expr(CXXPseudoDestructorExprClass, Context.BoundMemberTy,
VK_PRValue,
329 OperatorLoc(OperatorLoc), QualifierLoc(QualifierLoc),
330 ScopeType(ScopeType), ColonColonLoc(ColonColonLoc), TildeLoc(TildeLoc),
331 DestroyedType(DestroyedType) {
337 return TInfo->getType();
345 End = TInfo->getTypeLoc().getSourceRange().getEnd();
350UnresolvedLookupExpr::UnresolvedLookupExpr(
356 :
OverloadExpr(UnresolvedLookupExprClass, Context, QualifierLoc,
357 TemplateKWLoc, NameInfo, TemplateArgs,
Begin, End,
false,
359 NamingClass(NamingClass) {
364UnresolvedLookupExpr::UnresolvedLookupExpr(EmptyShell Empty,
366 bool HasTemplateKWAndArgsInfo)
367 :
OverloadExpr(UnresolvedLookupExprClass, Empty, NumResults,
368 HasTemplateKWAndArgsInfo) {}
375 unsigned NumResults = End -
Begin;
381 Overloaded,
nullptr,
Begin, End);
390 assert(Args || TemplateKWLoc.
isValid());
391 unsigned NumResults = End -
Begin;
392 unsigned NumTemplateArgs = Args ? Args->
size() : 0;
398 TemplateKWLoc, NameInfo, RequiresADL,
399 true, Args,
Begin, End);
403 const ASTContext &Context,
unsigned NumResults,
404 bool HasTemplateKWAndArgsInfo,
unsigned NumTemplateArgs) {
405 assert(NumTemplateArgs == 0 || HasTemplateKWAndArgsInfo);
408 NumResults, HasTemplateKWAndArgsInfo, NumTemplateArgs);
421 bool KnownInstantiationDependent,
422 bool KnownContainsUnexpandedParameterPack)
424 QualifierLoc(QualifierLoc) {
425 unsigned NumResults = End -
Begin;
428 (TemplateArgs != nullptr ) || TemplateKWLoc.
isValid();
438 auto Deps = TemplateArgumentDependence::None;
441 }
else if (TemplateKWLoc.
isValid()) {
446 KnownInstantiationDependent,
447 KnownContainsUnexpandedParameterPack));
453 bool HasTemplateKWAndArgsInfo)
460DependentScopeDeclRefExpr::DependentScopeDeclRefExpr(
465 QualifierLoc(QualifierLoc), NameInfo(NameInfo) {
467 (Args !=
nullptr) || TemplateKWLoc.
isValid();
469 auto Deps = TemplateArgumentDependence::None;
470 getTrailingObjects<ASTTemplateKWAndArgsInfo>()->initializeFrom(
471 TemplateKWLoc, *Args, getTrailingObjects<TemplateArgumentLoc>(), Deps);
472 }
else if (TemplateKWLoc.
isValid()) {
473 getTrailingObjects<ASTTemplateKWAndArgsInfo>()->initializeFrom(
483 assert(QualifierLoc &&
"should be created for dependent qualifiers");
484 bool HasTemplateKWAndArgsInfo = Args || TemplateKWLoc.
isValid();
486 totalSizeToAlloc<ASTTemplateKWAndArgsInfo, TemplateArgumentLoc>(
487 HasTemplateKWAndArgsInfo, Args ? Args->
size() : 0);
490 TemplateKWLoc, NameInfo, Args);
495 bool HasTemplateKWAndArgsInfo,
496 unsigned NumTemplateArgs) {
497 assert(NumTemplateArgs == 0 || HasTemplateKWAndArgsInfo);
499 totalSizeToAlloc<ASTTemplateKWAndArgsInfo, TemplateArgumentLoc>(
500 HasTemplateKWAndArgsInfo, NumTemplateArgs);
506 HasTemplateKWAndArgsInfo;
511 if (isa<CXXTemporaryObjectExpr>(
this))
512 return cast<CXXTemporaryObjectExpr>(
this)->getBeginLoc();
517 if (isa<CXXTemporaryObjectExpr>(
this))
518 return cast<CXXTemporaryObjectExpr>(
this)->getEndLoc();
520 if (ParenOrBraceRange.
isValid())
521 return ParenOrBraceRange.
getEnd();
544 :
CallExpr(CXXOperatorCallExprClass, Fn, {}, Args, Ty, VK,
545 OperatorLoc, FPFeatures, 0, UsesADL) {
546 CXXOperatorCallExprBits.OperatorKind = OpKind;
548 (CXXOperatorCallExprBits.OperatorKind ==
static_cast<unsigned>(OpKind)) &&
549 "OperatorKind overflow!");
550 Range = getSourceRangeImpl();
553CXXOperatorCallExpr::CXXOperatorCallExpr(
unsigned NumArgs,
bool HasFPFeatures,
555 :
CallExpr(CXXOperatorCallExprClass, 0, NumArgs,
556 HasFPFeatures, Empty) {}
565 unsigned NumArgs = Args.size();
579 unsigned SizeOfTrailingObjects =
586SourceRange CXXOperatorCallExpr::getSourceRangeImpl()
const {
588 if (Kind == OO_PlusPlus || Kind == OO_MinusMinus) {
595 }
else if (Kind == OO_Arrow) {
597 }
else if (Kind == OO_Call) {
599 }
else if (Kind == OO_Subscript) {
615 :
CallExpr(CXXMemberCallExprClass, Fn, {}, Args, Ty, VK, RP,
618CXXMemberCallExpr::CXXMemberCallExpr(
unsigned NumArgs,
bool HasFPFeatures,
620 :
CallExpr(CXXMemberCallExprClass, 0, NumArgs, HasFPFeatures,
628 unsigned MinNumArgs) {
630 unsigned NumArgs = std::max<unsigned>(Args.size(), MinNumArgs);
644 unsigned SizeOfTrailingObjects =
653 if (
const auto *MemExpr = dyn_cast<MemberExpr>(Callee))
654 return MemExpr->getBase();
655 if (
const auto *BO = dyn_cast<BinaryOperator>(Callee))
656 if (BO->getOpcode() == BO_PtrMemD || BO->getOpcode() == BO_PtrMemI)
672 return cast<CXXMethodDecl>(MemExpr->getMemberDecl());
699 case CXXStaticCastExprClass:
return "static_cast";
700 case CXXDynamicCastExprClass:
return "dynamic_cast";
701 case CXXReinterpretCastExprClass:
return "reinterpret_cast";
702 case CXXConstCastExprClass:
return "const_cast";
703 case CXXAddrspaceCastExprClass:
return "addrspace_cast";
704 default:
return "<invalid cast>";
714 unsigned PathSize = (BasePath ? BasePath->size() : 0);
716 C.Allocate(totalSizeToAlloc<CXXBaseSpecifier *, FPOptionsOverride>(
719 FPO, L, RParenLoc, AngleBrackets);
721 std::uninitialized_copy_n(BasePath->data(), BasePath->size(),
728 bool HasFPFeatures) {
730 C.Allocate(totalSizeToAlloc<CXXBaseSpecifier *, FPOptionsOverride>(
731 PathSize, HasFPFeatures));
743 unsigned PathSize = (BasePath ? BasePath->size() : 0);
744 void *Buffer =
C.Allocate(totalSizeToAlloc<CXXBaseSpecifier *>(PathSize));
747 RParenLoc, AngleBrackets);
749 std::uninitialized_copy_n(BasePath->data(), BasePath->size(),
756 void *Buffer =
C.Allocate(totalSizeToAlloc<CXXBaseSpecifier *>(PathSize));
784 if (!SrcRD->hasAttr<FinalAttr>())
790 return !DestRD->isDerivedFrom(SrcRD);
800 unsigned PathSize = (BasePath ? BasePath->size() : 0);
801 void *Buffer =
C.Allocate(totalSizeToAlloc<CXXBaseSpecifier *>(PathSize));
804 RParenLoc, AngleBrackets);
806 std::uninitialized_copy_n(BasePath->data(), BasePath->size(),
813 void *Buffer =
C.Allocate(totalSizeToAlloc<CXXBaseSpecifier *>(PathSize));
823 return new (
C)
CXXConstCastExpr(T, VK, Op, WrittenTy, L, RParenLoc, AngleBrackets);
847 unsigned PathSize = (BasePath ? BasePath->size() : 0);
849 C.Allocate(totalSizeToAlloc<CXXBaseSpecifier *, FPOptionsOverride>(
851 auto *E =
new (Buffer)
854 std::uninitialized_copy_n(BasePath->data(), BasePath->size(),
861 bool HasFPFeatures) {
863 C.Allocate(totalSizeToAlloc<CXXBaseSpecifier *, FPOptionsOverride>(
864 PathSize, HasFPFeatures));
882 :
CallExpr(UserDefinedLiteralClass, Fn, {}, Args, Ty, VK,
883 LitEndLoc, FPFeatures, 0, NotADL),
884 UDSuffixLoc(SuffixLoc) {}
886UserDefinedLiteral::UserDefinedLiteral(
unsigned NumArgs,
bool HasFPFeatures,
888 :
CallExpr(UserDefinedLiteralClass, 0, NumArgs,
889 HasFPFeatures, Empty) {}
898 unsigned NumArgs = Args.size();
912 unsigned SizeOfTrailingObjects =
926 assert(
getNumArgs() == 1 &&
"unexpected #args in literal operator call");
928 cast<FunctionDecl>(
getCalleeDecl())->getParamDecl(0)->getType();
938 llvm_unreachable(
"unknown kind of literal operator");
950 return cast<FunctionDecl>(
getCalleeDecl())->getLiteralIdentifier();
954 bool HasRewrittenInit) {
955 size_t Size = totalSizeToAlloc<Expr *>(HasRewrittenInit);
965 size_t Size = totalSizeToAlloc<Expr *>(RewrittenExpr !=
nullptr);
968 RewrittenExpr, UsedContext);
978 "expected this CXXDefaultArgExpr to have a rewritten init.");
980 if (
auto *E = dyn_cast_if_present<FullExpr>(Init))
981 if (!isa<ConstantExpr>(E))
982 return E->getSubExpr();
986CXXDefaultInitExpr::CXXDefaultInitExpr(
const ASTContext &Ctx,
989 Expr *RewrittenInitExpr)
990 :
Expr(CXXDefaultInitExprClass, Ty.getNonLValueExprType(Ctx),
992 : Ty->isRValueReferenceType() ?
VK_XValue
995 Field(Field), UsedContext(UsedContext) {
1000 *getTrailingObjects<Expr *>() = RewrittenInitExpr;
1002 assert(Field->hasInClassInitializer());
1008 bool HasRewrittenInit) {
1009 size_t Size = totalSizeToAlloc<Expr *>(HasRewrittenInit);
1018 Expr *RewrittenInitExpr) {
1020 size_t Size = totalSizeToAlloc<Expr *>(RewrittenInitExpr !=
nullptr);
1023 UsedContext, RewrittenInitExpr);
1027 assert(Field->getInClassInitializer() &&
"initializer hasn't been parsed");
1031 return Field->getInClassInitializer();
1044 "Expression bound to a temporary must have record or array type!");
1049CXXTemporaryObjectExpr::CXXTemporaryObjectExpr(
1052 bool HadMultipleCandidates,
bool ListInitialization,
1053 bool StdInitListInitialization,
bool ZeroInitialization)
1055 CXXTemporaryObjectExprClass, Ty, TSI->getTypeLoc().getBeginLoc(),
1056 Cons,
false, Args, HadMultipleCandidates,
1057 ListInitialization, StdInitListInitialization, ZeroInitialization,
1063CXXTemporaryObjectExpr::CXXTemporaryObjectExpr(EmptyShell Empty,
1070 bool HadMultipleCandidates,
bool ListInitialization,
1071 bool StdInitListInitialization,
bool ZeroInitialization) {
1077 Cons, Ty, TSI, Args, ParenOrBraceRange, HadMultipleCandidates,
1078 ListInitialization, StdInitListInitialization, ZeroInitialization);
1104 bool HadMultipleCandidates,
bool ListInitialization,
1105 bool StdInitListInitialization,
bool ZeroInitialization,
1111 CXXConstructExprClass, Ty, Loc, Ctor, Elidable, Args,
1112 HadMultipleCandidates, ListInitialization, StdInitListInitialization,
1113 ZeroInitialization, ConstructKind, ParenOrBraceRange);
1128 bool ListInitialization,
bool StdInitListInitialization,
1132 ParenOrBraceRange(ParenOrBraceRange), NumArgs(Args.size()) {
1141 Stmt **TrailingArgs = getTrailingArgs();
1142 for (
unsigned I = 0, N = Args.size(); I != N; ++I) {
1143 assert(Args[I] &&
"NULL argument in CXXConstructExpr!");
1144 TrailingArgs[I] = Args[I];
1148 if (SC == CXXConstructExprClass)
1154 :
Expr(SC, Empty), NumArgs(NumArgs) {}
1159 : DeclAndBits(Var, 0), Loc(Loc), EllipsisLoc(EllipsisLoc) {
1162 Bits |= Capture_Implicit;
1166 Bits |= Capture_ByCopy;
1169 assert(!Var &&
"'this' capture cannot have a variable!");
1170 Bits |= Capture_This;
1174 Bits |= Capture_ByCopy;
1177 assert(Var &&
"capture must have a variable!");
1180 assert(!Var &&
"VLA type capture cannot have a variable!");
1183 DeclAndBits.setInt(Bits);
1189 bool CapByCopy = DeclAndBits.getInt() & Capture_ByCopy;
1200 bool ContainsUnexpandedParameterPack)
1202 IntroducerRange(IntroducerRange), CaptureDefaultLoc(CaptureDefaultLoc),
1203 ClosingBrace(ClosingBrace) {
1204 LambdaExprBits.NumCaptures = CaptureInits.size();
1205 LambdaExprBits.CaptureDefault = CaptureDefault;
1206 LambdaExprBits.ExplicitParams = ExplicitParams;
1207 LambdaExprBits.ExplicitResultType = ExplicitResultType;
1211 assert(capture_size() == Class->capture_size() &&
"Wrong number of captures");
1212 assert(getCaptureDefault() == Class->getLambdaCaptureDefault());
1215 Stmt **Stored = getStoredStmts();
1216 for (
unsigned I = 0, N = CaptureInits.size(); I != N; ++I)
1217 *Stored++ = CaptureInits[I];
1220 *Stored++ = getCallOperator()->getBody();
1225LambdaExpr::LambdaExpr(EmptyShell Empty,
unsigned NumCaptures)
1226 :
Expr(LambdaExprClass, Empty) {
1227 LambdaExprBits.NumCaptures = NumCaptures;
1231 getStoredStmts()[NumCaptures] =
nullptr;
1238 bool ExplicitParams,
bool ExplicitResultType,
1241 bool ContainsUnexpandedParameterPack) {
1246 unsigned Size = totalSizeToAlloc<Stmt *>(CaptureInits.size() + 1);
1247 void *Mem = Context.
Allocate(Size);
1249 LambdaExpr(T, IntroducerRange, CaptureDefault, CaptureDefaultLoc,
1250 ExplicitParams, ExplicitResultType, CaptureInits, ClosingBrace,
1251 ContainsUnexpandedParameterPack);
1255 unsigned NumCaptures) {
1256 unsigned Size = totalSizeToAlloc<Stmt *>(NumCaptures + 1);
1257 void *Mem =
C.Allocate(Size);
1261void LambdaExpr::initBodyIfNeeded()
const {
1275 if (
const auto *CoroBody = dyn_cast<CoroutineBodyStmt>(Body))
1276 return cast<CompoundStmt>(CoroBody->getBody());
1277 return cast<CompoundStmt>(Body);
1281 return C->capturesVariable() &&
C->getCapturedVar()->isInitCapture() &&
1328 return Record->getLambdaCallOperator();
1333 return Record->getDependentLambdaCallOperator();
1338 return Record->getGenericLambdaTemplateParameterList();
1343 return Record->getLambdaExplicitTemplateParameters();
1363ExprWithCleanups::ExprWithCleanups(
Expr *subexpr,
1364 bool CleanupsHaveSideEffects,
1366 :
FullExpr(ExprWithCleanupsClass, subexpr) {
1369 for (
unsigned i = 0, e = objects.size(); i != e; ++i)
1370 getTrailingObjects<CleanupObject>()[i] = objects[i];
1374 bool CleanupsHaveSideEffects,
1376 void *buffer =
C.Allocate(totalSizeToAlloc<CleanupObject>(objects.size()),
1382ExprWithCleanups::ExprWithCleanups(EmptyShell empty,
unsigned numObjects)
1383 :
FullExpr(ExprWithCleanupsClass, empty) {
1389 unsigned numObjects) {
1390 void *buffer =
C.Allocate(totalSizeToAlloc<CleanupObject>(numObjects),
1395CXXUnresolvedConstructExpr::CXXUnresolvedConstructExpr(
1398 :
Expr(CXXUnresolvedConstructExprClass, T,
1399 (TSI->getType()->isLValueReferenceType() ?
VK_LValue
1400 : TSI->getType()->isRValueReferenceType() ?
VK_XValue
1403 TypeAndInitForm(TSI, IsListInit), LParenLoc(LParenLoc),
1404 RParenLoc(RParenLoc) {
1406 auto **StoredArgs = getTrailingObjects<Expr *>();
1407 for (
unsigned I = 0; I != Args.size(); ++I)
1408 StoredArgs[I] = Args[I];
1416 void *Mem = Context.
Allocate(totalSizeToAlloc<Expr *>(Args.size()));
1418 RParenLoc, IsListInit);
1424 void *Mem = Context.
Allocate(totalSizeToAlloc<Expr *>(NumArgs));
1429 return TypeAndInitForm.getPointer()->getTypeLoc().getBeginLoc();
1432CXXDependentScopeMemberExpr::CXXDependentScopeMemberExpr(
1438 :
Expr(CXXDependentScopeMemberExprClass, Ctx.DependentTy,
VK_LValue,
1440 Base(
Base), BaseType(BaseType), QualifierLoc(QualifierLoc),
1441 MemberNameInfo(MemberNameInfo) {
1444 (TemplateArgs !=
nullptr) || TemplateKWLoc.
isValid();
1446 FirstQualifierFoundInScope !=
nullptr;
1450 auto Deps = TemplateArgumentDependence::None;
1451 getTrailingObjects<ASTTemplateKWAndArgsInfo>()->initializeFrom(
1452 TemplateKWLoc, *TemplateArgs, getTrailingObjects<TemplateArgumentLoc>(),
1454 }
else if (TemplateKWLoc.
isValid()) {
1455 getTrailingObjects<ASTTemplateKWAndArgsInfo>()->initializeFrom(
1459 if (hasFirstQualifierFoundInScope())
1460 *getTrailingObjects<NamedDecl *>() = FirstQualifierFoundInScope;
1464CXXDependentScopeMemberExpr::CXXDependentScopeMemberExpr(
1465 EmptyShell Empty,
bool HasTemplateKWAndArgsInfo,
1466 bool HasFirstQualifierFoundInScope)
1467 :
Expr(CXXDependentScopeMemberExprClass, Empty) {
1469 HasTemplateKWAndArgsInfo;
1471 HasFirstQualifierFoundInScope;
1480 bool HasTemplateKWAndArgsInfo =
1481 (TemplateArgs !=
nullptr) || TemplateKWLoc.
isValid();
1482 unsigned NumTemplateArgs = TemplateArgs ? TemplateArgs->
size() : 0;
1483 bool HasFirstQualifierFoundInScope = FirstQualifierFoundInScope !=
nullptr;
1487 HasTemplateKWAndArgsInfo, NumTemplateArgs, HasFirstQualifierFoundInScope);
1491 Ctx,
Base, BaseType, IsArrow, OperatorLoc, QualifierLoc, TemplateKWLoc,
1492 FirstQualifierFoundInScope, MemberNameInfo, TemplateArgs);
1496 const ASTContext &Ctx,
bool HasTemplateKWAndArgsInfo,
1497 unsigned NumTemplateArgs,
bool HasFirstQualifierFoundInScope) {
1498 assert(NumTemplateArgs == 0 || HasTemplateKWAndArgsInfo);
1502 HasTemplateKWAndArgsInfo, NumTemplateArgs, HasFirstQualifierFoundInScope);
1506 EmptyShell(), HasTemplateKWAndArgsInfo, HasFirstQualifierFoundInScope);
1513 if (isa<UnresolvedUsingValueDecl>(
decl))
1518 if (cast<CXXMethodDecl>(
decl->getUnderlyingDecl()->getAsFunction())
1521 }
while (++begin != end);
1526UnresolvedMemberExpr::UnresolvedMemberExpr(
1534 UnresolvedMemberExprClass, Context, QualifierLoc, TemplateKWLoc,
1535 MemberNameInfo, TemplateArgs,
Begin, End,
1537 ((
Base &&
Base->isTypeDependent()) || BaseType->isDependentType()),
1538 ((
Base &&
Base->isInstantiationDependent()) ||
1539 BaseType->isInstantiationDependentType()),
1541 ((
Base &&
Base->containsUnexpandedParameterPack()) ||
1542 BaseType->containsUnexpandedParameterPack())),
1543 Base(
Base), BaseType(BaseType), OperatorLoc(OperatorLoc) {
1544 UnresolvedMemberExprBits.IsArrow = IsArrow;
1545 UnresolvedMemberExprBits.HasUnresolvedUsing = HasUnresolvedUsing;
1553UnresolvedMemberExpr::UnresolvedMemberExpr(EmptyShell Empty,
1554 unsigned NumResults,
1555 bool HasTemplateKWAndArgsInfo)
1556 :
OverloadExpr(UnresolvedMemberExprClass, Empty, NumResults,
1557 HasTemplateKWAndArgsInfo) {}
1563 return cast<Expr>(
Base)->isImplicitCXXThis();
1573 unsigned NumResults = End -
Begin;
1574 bool HasTemplateKWAndArgsInfo = TemplateArgs || TemplateKWLoc.
isValid();
1575 unsigned NumTemplateArgs = TemplateArgs ? TemplateArgs->
size() : 0;
1578 NumResults, HasTemplateKWAndArgsInfo, NumTemplateArgs);
1581 Context, HasUnresolvedUsing,
Base, BaseType, IsArrow, OperatorLoc,
1582 QualifierLoc, TemplateKWLoc, MemberNameInfo, TemplateArgs,
Begin, End);
1586 const ASTContext &Context,
unsigned NumResults,
1587 bool HasTemplateKWAndArgsInfo,
unsigned NumTemplateArgs) {
1588 assert(NumTemplateArgs == 0 || HasTemplateKWAndArgsInfo);
1591 NumResults, HasTemplateKWAndArgsInfo, NumTemplateArgs);
1607 assert(T &&
"qualifier in member expression does not name type");
1609 assert(Record &&
"qualifier in member expression does not name record");
1618 assert(Record &&
"base of member expression does not name record");
1628 std::optional<unsigned> Length,
1631 Context.
Allocate(totalSizeToAlloc<TemplateArgument>(PartialArgs.size()));
1633 PackLoc, RParenLoc, Length, PartialArgs);
1637 unsigned NumPartialArgs) {
1639 Context.
Allocate(totalSizeToAlloc<TemplateArgument>(NumPartialArgs));
1644 return cast<NonTypeTemplateParmDecl>(
1657SubstNonTypeTemplateParmPackExpr::SubstNonTypeTemplateParmPackExpr(
1660 :
Expr(SubstNonTypeTemplateParmPackExprClass, T, ValueKind,
OK_Ordinary),
1661 AssociatedDecl(AssociatedDecl), Arguments(ArgPack.pack_begin()),
1662 NumArguments(ArgPack.pack_size()), Index(Index), NameLoc(NameLoc) {
1663 assert(AssociatedDecl !=
nullptr);
1665 ExprDependence::UnexpandedPack);
1670 return cast<NonTypeTemplateParmDecl>(
1678FunctionParmPackExpr::FunctionParmPackExpr(
QualType T,
VarDecl *ParamPack,
1683 ParamPack(ParamPack), NameLoc(NameLoc), NumParameters(NumParams) {
1685 std::uninitialized_copy(Params, Params + NumParams,
1686 getTrailingObjects<VarDecl *>());
1688 ExprDependence::UnexpandedPack);
1695 return new (Context.
Allocate(totalSizeToAlloc<VarDecl *>(Params.size())))
1701 unsigned NumParams) {
1702 return new (Context.
Allocate(totalSizeToAlloc<VarDecl *>(NumParams)))
1707 QualType T,
Expr *Temporary,
bool BoundToLvalueReference,
1709 :
Expr(MaterializeTemporaryExprClass, T,
1713 MTD->ExprWithTemporary = Temporary;
1721 unsigned ManglingNumber) {
1730 cast<Expr>(State.get<
Stmt *>()), ExtendedBy, ManglingNumber);
1733 ES->ExtendingDecl = ExtendedBy;
1734 ES->ManglingNumber = ManglingNumber;
1748 VD->isUsableInConstantExpressions(Context);
1755 RParenLoc(RParenLoc) {
1756 assert(Kind <=
TT_Last &&
"invalid enum value!");
1759 "TypeTraitExprBits.Kind overflow!");
1763 "TypeTraitExprBits.NumArgs overflow!");
1765 auto **ToArgs = getTrailingObjects<TypeSourceInfo *>();
1766 for (
unsigned I = 0, N = Args.size(); I != N; ++I)
1767 ToArgs[I] = Args[I];
1778 void *Mem =
C.Allocate(totalSizeToAlloc<TypeSourceInfo *>(Args.size()));
1784 void *Mem =
C.Allocate(totalSizeToAlloc<TypeSourceInfo *>(NumArgs));
1788CUDAKernelCallExpr::CUDAKernelCallExpr(
Expr *Fn,
CallExpr *Config,
1792 unsigned MinNumArgs)
1793 :
CallExpr(CUDAKernelCallExprClass, Fn, Config, Args, Ty, VK,
1794 RP, FPFeatures, MinNumArgs, NotADL) {}
1796CUDAKernelCallExpr::CUDAKernelCallExpr(
unsigned NumArgs,
bool HasFPFeatures,
1798 :
CallExpr(CUDAKernelCallExprClass, END_PREARG, NumArgs,
1799 HasFPFeatures, Empty) {}
1805 unsigned MinNumArgs) {
1807 unsigned NumArgs = std::max<unsigned>(Args.size(), MinNumArgs);
1822 END_PREARG, NumArgs, HasFPFeatures);
1830 unsigned NumUserSpecifiedExprs,
1833 void *Mem =
C.Allocate(totalSizeToAlloc<Expr *>(Args.size()));
1835 LParenLoc, RParenLoc);
1841 void *Mem =
C.Allocate(totalSizeToAlloc<Expr *>(NumExprs),
Defines the clang::ASTContext interface.
Defines the C++ Decl subclasses, other than those for templates (found in DeclTemplate....
Defines the C++ template declaration subclasses.
static bool hasOnlyNonStaticMemberFunctions(UnresolvedSetIterator begin, UnresolvedSetIterator end)
Defines the clang::Expr interface and subclasses for C++ expressions.
Forward-declares and imports various common LLVM datatypes that clang wants to use unqualified.
Defines the LambdaCapture class.
Defines an enumeration for C++ overloaded operators.
Defines the clang::SourceLocation class and associated facilities.
Defines various enumerations that describe declaration and type specifiers.
Defines the clang::TypeLoc interface and its subclasses.
C Language Family Type Representation.
__DEVICE__ void * memcpy(void *__a, const void *__b, size_t __c)
Holds long-lived AST nodes (such as types and decls) that can be referred to throughout the semantic ...
QualType getLValueReferenceType(QualType T, bool SpelledAsLValue=true) const
Return the uniqued reference to the type for an lvalue reference to the specified type.
QualType getTypeDeclType(const TypeDecl *Decl, const TypeDecl *PrevDecl=nullptr) const
Return the unique reference to the type for the specified type declaration.
CanQualType getSizeType() const
Return the unique type for "size_t" (C99 7.17), defined in <stddef.h>.
CanQualType BoundMemberTy
QualType getUnqualifiedArrayType(QualType T, Qualifiers &Quals)
Return this type as a completely-unqualified array type, capturing the qualifiers in Quals.
void * Allocate(size_t Size, unsigned Align=8) const
Represents a call to a CUDA kernel function.
static CUDAKernelCallExpr * CreateEmpty(const ASTContext &Ctx, unsigned NumArgs, bool HasFPFeatures, EmptyShell Empty)
static CUDAKernelCallExpr * Create(const ASTContext &Ctx, Expr *Fn, CallExpr *Config, ArrayRef< Expr * > Args, QualType Ty, ExprValueKind VK, SourceLocation RP, FPOptionsOverride FPFeatures, unsigned MinNumArgs=0)
A C++ addrspace_cast expression (currently only enabled for OpenCL).
static CXXAddrspaceCastExpr * CreateEmpty(const ASTContext &Context)
static CXXAddrspaceCastExpr * Create(const ASTContext &Context, QualType T, ExprValueKind VK, CastKind Kind, Expr *Op, TypeSourceInfo *WrittenTy, SourceLocation L, SourceLocation RParenLoc, SourceRange AngleBrackets)
Represents a base class of a C++ class.
Represents binding an expression to a temporary.
static CXXBindTemporaryExpr * Create(const ASTContext &C, CXXTemporary *Temp, Expr *SubExpr)
A C++ const_cast expression (C++ [expr.const.cast]).
static CXXConstCastExpr * Create(const ASTContext &Context, QualType T, ExprValueKind VK, Expr *Op, TypeSourceInfo *WrittenTy, SourceLocation L, SourceLocation RParenLoc, SourceRange AngleBrackets)
static CXXConstCastExpr * CreateEmpty(const ASTContext &Context)
Represents a call to a C++ constructor.
SourceRange getParenOrBraceRange() const
CXXConstructExpr(StmtClass SC, QualType Ty, SourceLocation Loc, CXXConstructorDecl *Ctor, bool Elidable, ArrayRef< Expr * > Args, bool HadMultipleCandidates, bool ListInitialization, bool StdInitListInitialization, bool ZeroInitialization, ConstructionKind ConstructKind, SourceRange ParenOrBraceRange)
Build a C++ construction expression.
static CXXConstructExpr * Create(const ASTContext &Ctx, QualType Ty, SourceLocation Loc, CXXConstructorDecl *Ctor, bool Elidable, ArrayRef< Expr * > Args, bool HadMultipleCandidates, bool ListInitialization, bool StdInitListInitialization, bool ZeroInitialization, ConstructionKind ConstructKind, SourceRange ParenOrBraceRange)
Create a C++ construction expression.
Expr * getArg(unsigned Arg)
Return the specified argument.
SourceLocation getLocation() const
static unsigned sizeOfTrailingObjects(unsigned NumArgs)
Return the size in bytes of the trailing objects.
SourceLocation getEndLoc() const LLVM_READONLY
SourceLocation getBeginLoc() const LLVM_READONLY
unsigned getNumArgs() const
Return the number of arguments to the constructor call.
static CXXConstructExpr * CreateEmpty(const ASTContext &Ctx, unsigned NumArgs)
Create an empty C++ construction expression.
Represents a C++ constructor within a class.
A default argument (C++ [dcl.fct.default]).
const ParmVarDecl * getParam() const
Expr * getRewrittenExpr()
Expr * getAdjustedRewrittenExpr()
static CXXDefaultArgExpr * Create(const ASTContext &C, SourceLocation Loc, ParmVarDecl *Param, Expr *RewrittenExpr, DeclContext *UsedContext)
static CXXDefaultArgExpr * CreateEmpty(const ASTContext &C, bool HasRewrittenInit)
bool hasRewrittenInit() const
A use of a default initializer in a constructor or in aggregate initialization.
static CXXDefaultInitExpr * Create(const ASTContext &Ctx, SourceLocation Loc, FieldDecl *Field, DeclContext *UsedContext, Expr *RewrittenInitExpr)
Field is the non-static data member whose default initializer is used by this expression.
const Expr * getRewrittenExpr() const
Retrieve the initializing expression with evaluated immediate calls, if any.
bool hasRewrittenInit() const
Expr * getExpr()
Get the initialization expression that will be used.
static CXXDefaultInitExpr * CreateEmpty(const ASTContext &C, bool HasRewrittenInit)
FunctionDecl * getOperatorDelete() const
QualType getDestroyedType() const
Retrieve the type being destroyed.
Represents a C++ member access expression where the actual member referenced could not be resolved be...
static CXXDependentScopeMemberExpr * Create(const ASTContext &Ctx, Expr *Base, QualType BaseType, bool IsArrow, SourceLocation OperatorLoc, NestedNameSpecifierLoc QualifierLoc, SourceLocation TemplateKWLoc, NamedDecl *FirstQualifierFoundInScope, DeclarationNameInfo MemberNameInfo, const TemplateArgumentListInfo *TemplateArgs)
static CXXDependentScopeMemberExpr * CreateEmpty(const ASTContext &Ctx, bool HasTemplateKWAndArgsInfo, unsigned NumTemplateArgs, bool HasFirstQualifierFoundInScope)
Represents a C++ destructor within a class.
A C++ dynamic_cast expression (C++ [expr.dynamic.cast]).
static CXXDynamicCastExpr * Create(const ASTContext &Context, QualType T, ExprValueKind VK, CastKind Kind, Expr *Op, const CXXCastPath *Path, TypeSourceInfo *Written, SourceLocation L, SourceLocation RParenLoc, SourceRange AngleBrackets)
static CXXDynamicCastExpr * CreateEmpty(const ASTContext &Context, unsigned pathSize)
bool isAlwaysNull() const
isAlwaysNull - Return whether the result of the dynamic_cast is proven to always be null.
Represents an explicit C++ type conversion that uses "functional" notation (C++ [expr....
static CXXFunctionalCastExpr * CreateEmpty(const ASTContext &Context, unsigned PathSize, bool HasFPFeatures)
SourceLocation getBeginLoc() const LLVM_READONLY
SourceLocation getEndLoc() const LLVM_READONLY
static CXXFunctionalCastExpr * Create(const ASTContext &Context, QualType T, ExprValueKind VK, TypeSourceInfo *Written, CastKind Kind, Expr *Op, const CXXCastPath *Path, FPOptionsOverride FPO, SourceLocation LPLoc, SourceLocation RPLoc)
Represents a call to a member function that may be written either with member call syntax (e....
CXXMethodDecl * getMethodDecl() const
Retrieve the declaration of the called method.
Expr * getImplicitObjectArgument() const
Retrieve the implicit object argument for the member call.
static CXXMemberCallExpr * CreateEmpty(const ASTContext &Ctx, unsigned NumArgs, bool HasFPFeatures, EmptyShell Empty)
static CXXMemberCallExpr * Create(const ASTContext &Ctx, Expr *Fn, ArrayRef< Expr * > Args, QualType Ty, ExprValueKind VK, SourceLocation RP, FPOptionsOverride FPFeatures, unsigned MinNumArgs=0)
QualType getObjectType() const
Retrieve the type of the object argument.
CXXRecordDecl * getRecordDecl() const
Retrieve the CXXRecordDecl for the underlying type of the implicit object argument.
Represents a static or instance method of a struct/union/class.
const char * getCastName() const
getCastName - Get the name of the C++ cast being used, e.g., "static_cast", "dynamic_cast",...
Represents a new-expression for memory allocation and constructor calls, e.g: "new CXXNewExpr(foo)".
static CXXNewExpr * CreateEmpty(const ASTContext &Ctx, bool IsArray, bool HasInit, unsigned NumPlacementArgs, bool IsParenTypeId)
Create an empty c++ new expression.
bool shouldNullCheckAllocation() const
True if the allocation result needs to be null-checked.
static CXXNewExpr * Create(const ASTContext &Ctx, bool IsGlobalNew, FunctionDecl *OperatorNew, FunctionDecl *OperatorDelete, bool ShouldPassAlignment, bool UsualArrayDeleteWantsSize, ArrayRef< Expr * > PlacementArgs, SourceRange TypeIdParens, std::optional< Expr * > ArraySize, InitializationStyle InitializationStyle, Expr *Initializer, QualType Ty, TypeSourceInfo *AllocatedTypeInfo, SourceRange Range, SourceRange DirectInitRange)
Create a c++ new expression.
FunctionDecl * getOperatorNew() const
A call to an overloaded operator written using operator syntax.
bool isInfixBinaryOp() const
Is this written as an infix binary operator?
SourceLocation getOperatorLoc() const
Returns the location of the operator symbol in the expression.
SourceLocation getEndLoc() const
OverloadedOperatorKind getOperator() const
Returns the kind of overloaded operator that this expression refers to.
static CXXOperatorCallExpr * Create(const ASTContext &Ctx, OverloadedOperatorKind OpKind, Expr *Fn, ArrayRef< Expr * > Args, QualType Ty, ExprValueKind VK, SourceLocation OperatorLoc, FPOptionsOverride FPFeatures, ADLCallKind UsesADL=NotADL)
static CXXOperatorCallExpr * CreateEmpty(const ASTContext &Ctx, unsigned NumArgs, bool HasFPFeatures, EmptyShell Empty)
SourceLocation getBeginLoc() const
Represents a list-initialization with parenthesis.
static CXXParenListInitExpr * Create(ASTContext &C, ArrayRef< Expr * > Args, QualType T, unsigned NumUserSpecifiedExprs, SourceLocation InitLoc, SourceLocation LParenLoc, SourceLocation RParenLoc)
static CXXParenListInitExpr * CreateEmpty(ASTContext &C, unsigned numExprs, EmptyShell Empty)
CXXPseudoDestructorExpr(const ASTContext &Context, Expr *Base, bool isArrow, SourceLocation OperatorLoc, NestedNameSpecifierLoc QualifierLoc, TypeSourceInfo *ScopeType, SourceLocation ColonColonLoc, SourceLocation TildeLoc, PseudoDestructorTypeStorage DestroyedType)
SourceLocation getEndLoc() const LLVM_READONLY
QualType getDestroyedType() const
Retrieve the type being destroyed.
Represents a C++ struct/union/class.
capture_const_iterator captures_end() const
capture_const_iterator captures_begin() const
A C++ reinterpret_cast expression (C++ [expr.reinterpret.cast]).
static CXXReinterpretCastExpr * Create(const ASTContext &Context, QualType T, ExprValueKind VK, CastKind Kind, Expr *Op, const CXXCastPath *Path, TypeSourceInfo *WrittenTy, SourceLocation L, SourceLocation RParenLoc, SourceRange AngleBrackets)
static CXXReinterpretCastExpr * CreateEmpty(const ASTContext &Context, unsigned pathSize)
Expr * getSemanticForm()
Get an equivalent semantic form for this expression.
bool isReversed() const
Determine whether this expression was rewritten in reverse form.
DecomposedForm getDecomposedForm() const LLVM_READONLY
Decompose this operator into its syntactic form.
SourceLocation getBeginLoc() const LLVM_READONLY
SourceLocation getRParenLoc() const
A C++ static_cast expression (C++ [expr.static.cast]).
static CXXStaticCastExpr * Create(const ASTContext &Context, QualType T, ExprValueKind VK, CastKind K, Expr *Op, const CXXCastPath *Path, TypeSourceInfo *Written, FPOptionsOverride FPO, SourceLocation L, SourceLocation RParenLoc, SourceRange AngleBrackets)
static CXXStaticCastExpr * CreateEmpty(const ASTContext &Context, unsigned PathSize, bool hasFPFeatures)
Represents a C++ functional cast expression that builds a temporary object.
static CXXTemporaryObjectExpr * Create(const ASTContext &Ctx, CXXConstructorDecl *Cons, QualType Ty, TypeSourceInfo *TSI, ArrayRef< Expr * > Args, SourceRange ParenOrBraceRange, bool HadMultipleCandidates, bool ListInitialization, bool StdInitListInitialization, bool ZeroInitialization)
TypeSourceInfo * getTypeSourceInfo() const
SourceLocation getEndLoc() const LLVM_READONLY
static CXXTemporaryObjectExpr * CreateEmpty(const ASTContext &Ctx, unsigned NumArgs)
SourceLocation getBeginLoc() const LLVM_READONLY
Represents a C++ temporary.
static CXXTemporary * Create(const ASTContext &C, const CXXDestructorDecl *Destructor)
QualType getTypeOperand(ASTContext &Context) const
Retrieves the type operand of this typeid() expression after various required adjustments (removing r...
bool isTypeOperand() const
Expr * getExprOperand() const
bool isMostDerived(ASTContext &Context) const
Best-effort check if the expression operand refers to a most derived object.
bool isPotentiallyEvaluated() const
Determine whether this typeid has a type operand which is potentially evaluated, per C++11 [expr....
Describes an explicit type conversion that uses functional notion but could not be resolved because o...
static CXXUnresolvedConstructExpr * Create(const ASTContext &Context, QualType T, TypeSourceInfo *TSI, SourceLocation LParenLoc, ArrayRef< Expr * > Args, SourceLocation RParenLoc, bool IsListInit)
SourceLocation getBeginLoc() const LLVM_READONLY
static CXXUnresolvedConstructExpr * CreateEmpty(const ASTContext &Context, unsigned NumArgs)
QualType getTypeOperand(ASTContext &Context) const
Retrieves the type operand of this __uuidof() expression after various required adjustments (removing...
bool isTypeOperand() const
CallExpr - Represents a function call (C99 6.5.2.2, C++ [expr.call]).
Expr * getArg(unsigned Arg)
getArg - Return the specified argument.
static unsigned sizeOfTrailingObjects(unsigned NumPreArgs, unsigned NumArgs, bool HasFPFeatures)
Return the size in bytes needed for the trailing objects.
unsigned getNumArgs() const
getNumArgs - Return the number of actual arguments to this call.
SourceLocation getRParenLoc() const
static constexpr ADLCallKind UsesADL
CompoundStmt - This represents a group of statements like { stmt stmt }.
A POD class for pairing a NamedDecl* with an access specifier.
DeclContext - This is used only as base class of specific decl types that can act as declaration cont...
Decl - This represents one declaration (or definition), e.g.
Expr * getTrailingRequiresClause()
Get the constraint-expression introduced by the trailing requires-clause in the function/member decla...
A qualified reference to a name whose declaration cannot yet be resolved.
static DependentScopeDeclRefExpr * Create(const ASTContext &Context, NestedNameSpecifierLoc QualifierLoc, SourceLocation TemplateKWLoc, const DeclarationNameInfo &NameInfo, const TemplateArgumentListInfo *TemplateArgs)
static DependentScopeDeclRefExpr * CreateEmpty(const ASTContext &Context, bool HasTemplateKWAndArgsInfo, unsigned NumTemplateArgs)
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...
static ExprWithCleanups * Create(const ASTContext &C, EmptyShell empty, unsigned numObjects)
This represents one expression.
Expr * IgnoreParenNoopCasts(const ASTContext &Ctx) LLVM_READONLY
Skip past any parentheses and casts which do not change the value (including ptr->int casts of the sa...
bool isTypeDependent() const
Determines whether the type of this expression depends on.
Expr * IgnoreImplicit() LLVM_READONLY
Skip past any implicit AST nodes which might surround this expression until reaching a fixed point.
Expr * IgnoreParens() LLVM_READONLY
Skip past any parentheses which might surround this expression until reaching a fixed point.
bool isDefaultArgument() const
Determine whether this expression is a default function argument.
void setDependence(ExprDependence Deps)
Each concrete expr subclass is expected to compute its dependence and call this in the constructor.
Represents difference between two FPOptions values.
bool requiresTrailingStorage() const
Represents a member of a struct/union/class.
FullExpr - Represents a "full-expression" node.
Represents a function declaration or definition.
Stmt * getBody(const FunctionDecl *&Definition) const
Retrieve the body (definition) of the function.
bool isReservedGlobalPlacementOperator() const
Determines whether this operator new or delete is one of the reserved global placement operators: voi...
Represents a reference to a function parameter pack or init-capture pack that has been substituted bu...
static FunctionParmPackExpr * Create(const ASTContext &Context, QualType T, VarDecl *ParamPack, SourceLocation NameLoc, ArrayRef< VarDecl * > Params)
static FunctionParmPackExpr * CreateEmpty(const ASTContext &Context, unsigned NumParams)
Represents a prototype with parameter type info, e.g.
Declaration of a template function.
One of these records is kept for each identifier that is lexed.
Describes the capture of a variable or of this, or of a C++1y init-capture.
bool capturesVLAType() const
Determine whether this captures a variable length array bound expression.
LambdaCapture(SourceLocation Loc, bool Implicit, LambdaCaptureKind Kind, ValueDecl *Var=nullptr, SourceLocation EllipsisLoc=SourceLocation())
Create a new capture of a variable or of this.
LambdaCaptureKind getCaptureKind() const
Determine the kind of capture.
bool capturesThis() const
Determine whether this capture handles the C++ this pointer.
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.
static LambdaExpr * CreateDeserialized(const ASTContext &C, unsigned NumCaptures)
Construct a new lambda expression that will be deserialized from an external source.
static LambdaExpr * Create(const ASTContext &C, CXXRecordDecl *Class, SourceRange IntroducerRange, LambdaCaptureDefault CaptureDefault, SourceLocation CaptureDefaultLoc, bool ExplicitParams, bool ExplicitResultType, ArrayRef< Expr * > CaptureInits, SourceLocation ClosingBrace, bool ContainsUnexpandedParameterPack)
Construct a new lambda expression.
Stmt * getBody() const
Retrieve the body of the lambda.
bool isMutable() const
Determine whether the lambda is mutable, meaning that any captures values can be modified.
capture_iterator implicit_capture_end() const
Retrieve an iterator pointing past the end of the sequence of implicit lambda captures.
unsigned capture_size() const
Determine the number of captures in this lambda.
capture_range explicit_captures() const
Retrieve this lambda's explicit captures.
bool isInitCapture(const LambdaCapture *Capture) const
Determine whether one of this lambda's captures is an init-capture.
CXXMethodDecl * getCallOperator() const
Retrieve the function call operator associated with this lambda expression.
const CompoundStmt * getCompoundStmtBody() const
Retrieve the CompoundStmt representing the body of the lambda.
capture_range implicit_captures() const
Retrieve this lambda's implicit captures.
TemplateParameterList * getTemplateParameterList() const
If this is a generic lambda expression, retrieve the template parameter list associated with it,...
ArrayRef< NamedDecl * > getExplicitTemplateParameters() const
Get the template parameters were explicitly specified (as opposed to being invented by use of an auto...
capture_iterator implicit_capture_begin() const
Retrieve an iterator pointing to the first implicit lambda capture.
capture_iterator explicit_capture_end() const
Retrieve an iterator pointing past the end of the sequence of explicit lambda captures.
capture_iterator capture_end() const
Retrieve an iterator pointing past the end of the sequence of lambda captures.
llvm::iterator_range< capture_iterator > capture_range
An iterator over a range of lambda captures.
Expr * getTrailingRequiresClause() const
Get the trailing requires clause, if any.
capture_iterator explicit_capture_begin() const
Retrieve an iterator pointing to the first explicit lambda capture.
child_range children()
Includes the captures and the body of the lambda.
FunctionTemplateDecl * getDependentCallOperator() const
Retrieve the function template call operator associated with this lambda expression.
capture_range captures() const
Retrieve this lambda's captures.
CXXRecordDecl * getLambdaClass() const
Retrieve the class that corresponds to the lambda.
Implicit declaration of a temporary that was materialized by a MaterializeTemporaryExpr and lifetime-...
static LifetimeExtendedTemporaryDecl * Create(Expr *Temp, ValueDecl *EDec, unsigned Mangling)
MaterializeTemporaryExpr(QualType T, Expr *Temporary, bool BoundToLvalueReference, LifetimeExtendedTemporaryDecl *MTD=nullptr)
ValueDecl * getExtendingDecl()
Get the declaration which triggered the lifetime-extension of this temporary, if any.
bool isUsableInConstantExpressions(const ASTContext &Context) const
Determine whether this temporary object is usable in constant expressions, as specified in C++20 [exp...
void setExtendingDecl(ValueDecl *ExtendedBy, unsigned ManglingNumber)
This represents a decl that may have a name.
A C++ nested-name-specifier augmented with source location information.
@ Super
Microsoft's '__super' specifier, stored as a CXXRecordDecl* of the class it appeared in.
const Type * getAsType() const
Retrieve the type stored in this nested name specifier.
NonTypeTemplateParmDecl - Declares a non-type template parameter, e.g., "Size" in.
A reference to an overloaded function set, either an UnresolvedLookupExpr or an UnresolvedMemberExpr.
NestedNameSpecifier * getQualifier() const
Fetches the nested-name qualifier, if one was given.
ASTTemplateKWAndArgsInfo * getTrailingASTTemplateKWAndArgsInfo()
Return the optional template keyword and arguments info.
TemplateArgumentLoc * getTrailingTemplateArgumentLoc()
Return the optional template arguments.
DeclAccessPair * getTrailingResults()
Return the results. Defined after UnresolvedMemberExpr.
OverloadExpr(StmtClass SC, const ASTContext &Context, NestedNameSpecifierLoc QualifierLoc, SourceLocation TemplateKWLoc, const DeclarationNameInfo &NameInfo, const TemplateArgumentListInfo *TemplateArgs, UnresolvedSetIterator Begin, UnresolvedSetIterator End, bool KnownDependent, bool KnownInstantiationDependent, bool KnownContainsUnexpandedParameterPack)
Represents a parameter to a function.
PointerType - C99 6.7.5.1 - Pointer Declarators.
Stores the type being destroyed by a pseudo-destructor expression.
PseudoDestructorTypeStorage()=default
SourceLocation getLocation() const
TypeSourceInfo * getTypeSourceInfo() const
A (possibly-)qualified type.
bool isVolatileQualified() const
Determine whether this type is volatile-qualified.
bool isConstant(const ASTContext &Ctx) const
QualType getNonReferenceType() const
If Type is a reference type (e.g., const int&), returns the type that the reference refers to ("const...
QualType getUnqualifiedType() const
Retrieve the unqualified variant of the given type, removing as little sugar as possible.
The collection of all-type qualifiers we support.
A helper class that allows the use of isa/cast/dyncast to detect TagType objects of structs/unions/cl...
RecordDecl * getDecl() const
Represents an expression that computes the length of a parameter pack.
static SizeOfPackExpr * CreateDeserialized(ASTContext &Context, unsigned NumPartialArgs)
static SizeOfPackExpr * Create(ASTContext &Context, SourceLocation OperatorLoc, NamedDecl *Pack, SourceLocation PackLoc, SourceLocation RParenLoc, std::optional< unsigned > Length=std::nullopt, ArrayRef< TemplateArgument > PartialArgs=std::nullopt)
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
void setEnd(SourceLocation e)
Stmt - This represents one statement.
SourceLocation getEndLoc() const LLVM_READONLY
CXXUnresolvedConstructExprBitfields CXXUnresolvedConstructExprBits
UnresolvedLookupExprBitfields UnresolvedLookupExprBits
ExprWithCleanupsBitfields ExprWithCleanupsBits
StmtClass getStmtClass() const
SourceRange getSourceRange() const LLVM_READONLY
SourceLocation tokens are not useful in isolation - they are low level value objects created/interpre...
OverloadExprBitfields OverloadExprBits
CXXConstructExprBitfields CXXConstructExprBits
CXXDependentScopeMemberExprBitfields CXXDependentScopeMemberExprBits
TypeTraitExprBitfields TypeTraitExprBits
CXXNewExprBitfields CXXNewExprBits
llvm::iterator_range< child_iterator > child_range
CXXDefaultInitExprBitfields CXXDefaultInitExprBits
DependentScopeDeclRefExprBitfields DependentScopeDeclRefExprBits
llvm::iterator_range< const_child_iterator > const_child_range
CXXDefaultArgExprBitfields CXXDefaultArgExprBits
Decl * getAssociatedDecl() const
A template-like entity which owns the whole pattern being substituted.
QualType getParameterType(const ASTContext &Ctx) const
Determine the substituted type of the template parameter.
bool isReferenceParameter() const
NonTypeTemplateParmDecl * getParameter() const
TemplateArgument getArgumentPack() const
Retrieve the template argument pack containing the substituted template arguments.
NonTypeTemplateParmDecl * getParameterPack() const
Retrieve the non-type template parameter pack being substituted.
Decl * getAssociatedDecl() const
A template-like entity which owns the whole pattern being substituted.
A convenient class for passing around template argument information.
Location wrapper for a TemplateArgument.
Represents a template argument.
Stores a list of template parameters for a TemplateDecl and its derived classes.
SourceLocation getBeginLoc() const
Get the begin source location.
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.
A type trait used in the implementation of various C++11 and Library TR1 trait templates.
static TypeTraitExpr * Create(const ASTContext &C, QualType T, SourceLocation Loc, TypeTrait Kind, ArrayRef< TypeSourceInfo * > Args, SourceLocation RParenLoc, bool Value)
Create a new type trait expression.
static TypeTraitExpr * CreateDeserialized(const ASTContext &C, unsigned NumArgs)
The base class of the type hierarchy.
CXXRecordDecl * getAsCXXRecordDecl() const
Retrieves the CXXRecordDecl that this type refers to, either because the type is a RecordType or beca...
bool isLiteralType(const ASTContext &Ctx) const
Return true if this is a literal type (C++11 [basic.types]p10)
bool isPointerType() const
bool isIntegerType() const
isIntegerType() does not include complex integers (a GCC extension).
const T * castAs() const
Member-template castAs<specific type>.
bool isReferenceType() const
QualType getPointeeType() const
If this is a pointer, ObjC object pointer, or block pointer, this returns the respective pointee.
bool isAnyCharacterType() const
Determine whether this type is any of the built-in character types.
bool isDependentType() const
Whether this type is a dependent type, meaning that its definition somehow depends on a template para...
bool isFloatingType() const
bool isAnyPointerType() const
const T * getAs() const
Member-template getAs<specific type>'.
bool isRecordType() const
A reference to a name which we were able to look up during parsing but could not resolve to a specifi...
static UnresolvedLookupExpr * CreateEmpty(const ASTContext &Context, unsigned NumResults, bool HasTemplateKWAndArgsInfo, unsigned NumTemplateArgs)
static UnresolvedLookupExpr * Create(const ASTContext &Context, CXXRecordDecl *NamingClass, NestedNameSpecifierLoc QualifierLoc, const DeclarationNameInfo &NameInfo, bool RequiresADL, bool Overloaded, UnresolvedSetIterator Begin, UnresolvedSetIterator End)
Represents a C++ member access expression for which lookup produced a set of overloaded functions.
QualType getBaseType() const
bool isArrow() const
Determine whether this member expression used the '->' operator; otherwise, it used the '.
static UnresolvedMemberExpr * Create(const ASTContext &Context, bool HasUnresolvedUsing, Expr *Base, QualType BaseType, bool IsArrow, SourceLocation OperatorLoc, NestedNameSpecifierLoc QualifierLoc, SourceLocation TemplateKWLoc, const DeclarationNameInfo &MemberNameInfo, const TemplateArgumentListInfo *TemplateArgs, UnresolvedSetIterator Begin, UnresolvedSetIterator End)
CXXRecordDecl * getNamingClass()
Retrieve the naming class of this lookup.
bool isImplicitAccess() const
True if this is an implicit access, i.e., one in which the member being accessed was not written in t...
static UnresolvedMemberExpr * CreateEmpty(const ASTContext &Context, unsigned NumResults, bool HasTemplateKWAndArgsInfo, unsigned NumTemplateArgs)
The iterator over UnresolvedSets.
A call to a literal operator (C++11 [over.literal]) written as a user-defined literal (C++11 [lit....
LiteralOperatorKind getLiteralOperatorKind() const
Returns the kind of literal operator invocation which this expression represents.
const IdentifierInfo * getUDSuffix() const
Returns the ud-suffix specified for this literal.
static UserDefinedLiteral * Create(const ASTContext &Ctx, Expr *Fn, ArrayRef< Expr * > Args, QualType Ty, ExprValueKind VK, SourceLocation LitEndLoc, SourceLocation SuffixLoc, FPOptionsOverride FPFeatures)
static UserDefinedLiteral * CreateEmpty(const ASTContext &Ctx, unsigned NumArgs, bool HasFPOptions, EmptyShell Empty)
Expr * getCookedLiteral()
If this is not a raw user-defined literal, get the underlying cooked literal (representing the litera...
LiteralOperatorKind
The kind of literal operator which is invoked.
@ LOK_String
operator "" X (const CharT *, size_t)
@ LOK_Raw
Raw form: operator "" X (const char *)
@ LOK_Floating
operator "" X (long double)
@ LOK_Integer
operator "" X (unsigned long long)
@ LOK_Template
Raw form: operator "" X<cs...> ()
@ LOK_Character
operator "" X (CharT)
Represent the declaration of a variable (in which case it is an lvalue) a function (in which case it ...
Represents a variable declaration or definition.
const internal::VariadicAllOfMatcher< Decl > decl
Matches declarations.
OverloadedOperatorKind
Enumeration specifying the different kinds of C++ overloaded operators.
@ OK_Ordinary
An ordinary object is located at an address in memory.
LambdaCaptureKind
The different capture forms in a lambda introducer.
@ LCK_ByCopy
Capturing by copy (a.k.a., by value)
@ LCK_ByRef
Capturing by reference.
@ LCK_VLAType
Capturing variable-length array type.
@ LCK_StarThis
Capturing the *this object by copy.
@ LCK_This
Capturing the *this object by reference.
ExprDependence computeDependence(FullExpr *E)
@ C
Languages that the frontend can parse and compile.
@ Result
The result type of a method or function.
TemplateParameterList * getReplacedTemplateParameterList(Decl *D)
Internal helper used by Subst* nodes to retrieve the parameter list for their AssociatedDecl.
CastKind
CastKind - The kind of operation required for a conversion.
LambdaCaptureDefault
The default, if any, capture method for a lambda expression.
ExprValueKind
The categorization of expression values, currently following the C++11 scheme.
@ VK_PRValue
A pr-value expression (in the C++11 taxonomy) produces a temporary value.
@ VK_XValue
An x-value expression is a reference to an object with independent storage but which can be "moved",...
@ VK_LValue
An l-value expression is a reference to an object with independent storage.
TypeTrait
Names for traits that operate specifically on types.
Represents an explicit template argument list in C++, e.g., the "<int>" in "sort<int>".
void initializeFrom(SourceLocation TemplateKWLoc, const TemplateArgumentListInfo &List, TemplateArgumentLoc *OutArgArray)
DeclarationNameInfo - A collector data type for bundling together a DeclarationName and the correspon...
A placeholder type used to construct an empty shell of a type, that will be filled in later (e....