32 #include "llvm/ADT/ArrayRef.h" 33 #include "llvm/Support/Casting.h" 34 #include "llvm/Support/ErrorHandling.h" 40 using namespace clang;
55 case OO_Call:
case OO_Subscript:
68 bool SkippedNot =
false;
69 if (
auto *NotEq = dyn_cast<UnaryOperator>(E)) {
70 assert(NotEq->getOpcode() == UO_LNot);
76 if (
auto *BO = dyn_cast<BinaryOperator>(E)) {
77 assert(!SkippedNot || BO->getOpcode() == BO_EQ);
78 Result.
Opcode = SkippedNot ? BO_NE : BO->getOpcode();
79 Result.
LHS = BO->getLHS();
80 Result.
RHS = BO->getRHS();
82 }
else if (
auto *BO = dyn_cast<CXXOperatorCallExpr>(E)) {
83 assert(!SkippedNot || BO->getOperator() == OO_EqualEqual);
84 assert(BO->isInfixBinaryOp());
85 switch (BO->getOperator()) {
86 case OO_Less: Result.
Opcode = BO_LT;
break;
87 case OO_LessEqual: Result.
Opcode = BO_LE;
break;
88 case OO_Greater: Result.
Opcode = BO_GT;
break;
89 case OO_GreaterEqual: Result.
Opcode = BO_GE;
break;
90 case OO_Spaceship: Result.
Opcode = BO_Cmp;
break;
91 case OO_EqualEqual: Result.
Opcode = SkippedNot ? BO_NE : BO_EQ;
break;
92 default: llvm_unreachable(
"unexpected binop in rewritten operator expr");
94 Result.
LHS = BO->getArg(0);
95 Result.
RHS = BO->getArg(1);
98 llvm_unreachable(
"unexpected rewritten operator form");
104 std::swap(Result.
LHS, Result.
RHS);
112 if (
auto *BO = dyn_cast<BinaryOperator>(E)) {
113 assert(BO->getOpcode() == BO_Cmp);
114 Result.
LHS = BO->getLHS();
115 Result.
RHS = BO->getRHS();
117 }
else if (
auto *BO = dyn_cast<CXXOperatorCallExpr>(E)) {
118 assert(BO->getOperator() == OO_Spaceship);
119 Result.
LHS = BO->getArg(0);
120 Result.
RHS = BO->getArg(1);
123 llvm_unreachable(
"unexpected rewritten operator form");
128 std::swap(Result.
LHS, Result.
RHS);
139 const Expr *E = getExprOperand();
141 if (RD->isPolymorphic() && E->
isGLValue())
148 assert(isTypeOperand() &&
"Cannot call getTypeOperand for typeid(expr)");
155 assert(isTypeOperand() &&
"Cannot call getTypeOperand for __uuidof(expr)");
167 CXXNewExpr::CXXNewExpr(
bool IsGlobalNew,
FunctionDecl *OperatorNew,
169 bool UsualArrayDeleteWantsSize,
172 InitializationStyle InitializationStyle,
179 OperatorNew(OperatorNew), OperatorDelete(OperatorDelete),
180 AllocatedTypeInfo(AllocatedTypeInfo), Range(Range),
181 DirectInitRange(DirectInitRange) {
183 assert((Initializer !=
nullptr || InitializationStyle ==
NoInit) &&
184 "Only NoInit can have no initializer!");
189 CXXNewExprBits.UsualArrayDeleteWantsSize = UsualArrayDeleteWantsSize;
191 Initializer ? InitializationStyle + 1 : 0;
192 bool IsParenTypeId = TypeIdParens.
isValid();
197 if (
Expr *SizeExpr = *ArraySize) {
198 if (SizeExpr->isValueDependent())
200 if (SizeExpr->isInstantiationDependent())
201 ExprBits.InstantiationDependent =
true;
202 if (SizeExpr->containsUnexpandedParameterPack())
203 ExprBits.ContainsUnexpandedParameterPack =
true;
206 getTrailingObjects<Stmt *>()[arraySizeOffset()] = *ArraySize;
213 ExprBits.InstantiationDependent =
true;
215 ExprBits.ContainsUnexpandedParameterPack =
true;
217 getTrailingObjects<Stmt *>()[initExprOffset()] =
Initializer;
220 for (
unsigned I = 0; I != PlacementArgs.size(); ++I) {
224 ExprBits.InstantiationDependent =
true;
226 ExprBits.ContainsUnexpandedParameterPack =
true;
228 getTrailingObjects<Stmt *>()[placementNewArgsOffset() + I] =
233 getTrailingObjects<SourceRange>()[0] = TypeIdParens;
235 switch (getInitializationStyle()) {
249 CXXNewExpr::CXXNewExpr(
EmptyShell Empty,
bool IsArray,
250 unsigned NumPlacementArgs,
bool IsParenTypeId)
251 :
Expr(CXXNewExprClass, Empty) {
260 bool ShouldPassAlignment,
bool UsualArrayDeleteWantsSize,
266 bool IsArray = ArraySize.hasValue();
267 bool HasInit = Initializer !=
nullptr;
268 unsigned NumPlacementArgs = PlacementArgs.size();
269 bool IsParenTypeId = TypeIdParens.
isValid();
271 Ctx.
Allocate(totalSizeToAlloc<Stmt *, SourceRange>(
272 IsArray + HasInit + NumPlacementArgs, IsParenTypeId),
275 CXXNewExpr(IsGlobalNew, OperatorNew, OperatorDelete, ShouldPassAlignment,
276 UsualArrayDeleteWantsSize, PlacementArgs, TypeIdParens,
277 ArraySize, InitializationStyle, Initializer, Ty,
278 AllocatedTypeInfo, Range, DirectInitRange);
282 bool HasInit,
unsigned NumPlacementArgs,
283 bool IsParenTypeId) {
285 Ctx.
Allocate(totalSizeToAlloc<Stmt *, SourceRange>(
286 IsArray + HasInit + NumPlacementArgs, IsParenTypeId),
293 return getOperatorNew()
297 !getOperatorNew()->isReservedGlobalPlacementOperator();
307 while (
const auto *ICE = dyn_cast<ImplicitCastExpr>(Arg)) {
308 if (ICE->getCastKind() == CK_DerivedToBase ||
309 ICE->getCastKind() == CK_UncheckedDerivedToBase ||
310 ICE->getCastKind() == CK_NoOp) {
311 assert((ICE->getCastKind() == CK_NoOp ||
312 getOperatorDelete()->isDestroyingOperatorDelete()) &&
313 "only a destroying operator delete can have a converted arg");
314 Arg = ICE->getSubExpr();
339 :
Expr(CXXPseudoDestructorExprClass,
340 Context.BoundMemberTy,
342 (Base->isTypeDependent() ||
345 Base->isValueDependent(),
346 (Base->isInstantiationDependent() ||
348 QualifierLoc.getNestedNameSpecifier()->isInstantiationDependent()) ||
350 ScopeType->getType()->isInstantiationDependentType()) ||
353 ->isInstantiationDependentType())),
355 (Base->containsUnexpandedParameterPack() ||
357 QualifierLoc.getNestedNameSpecifier()
358 ->containsUnexpandedParameterPack()) ||
360 ScopeType->getType()->containsUnexpandedParameterPack()) ||
363 ->containsUnexpandedParameterPack()))),
364 Base(static_cast<
Stmt *>(Base)), IsArrow(isArrow),
365 OperatorLoc(OperatorLoc), QualifierLoc(QualifierLoc),
366 ScopeType(ScopeType), ColonColonLoc(ColonColonLoc), TildeLoc(TildeLoc),
367 DestroyedType(DestroyedType) {}
371 return TInfo->getType();
379 End = TInfo->getTypeLoc().getLocalSourceRange().getEnd();
384 UnresolvedLookupExpr::UnresolvedLookupExpr(
390 :
OverloadExpr(UnresolvedLookupExprClass, Context, QualifierLoc,
391 TemplateKWLoc, NameInfo, TemplateArgs, Begin, End,
false,
393 NamingClass(NamingClass) {
398 UnresolvedLookupExpr::UnresolvedLookupExpr(
EmptyShell Empty,
400 bool HasTemplateKWAndArgsInfo)
401 :
OverloadExpr(UnresolvedLookupExprClass, Empty, NumResults,
402 HasTemplateKWAndArgsInfo) {}
409 unsigned NumResults = End -
Begin;
424 assert(Args || TemplateKWLoc.
isValid());
425 unsigned NumResults = End -
Begin;
426 unsigned NumTemplateArgs = Args ? Args->
size() : 0;
432 TemplateKWLoc, NameInfo, RequiresADL,
433 true, Args, Begin, End);
437 const ASTContext &Context,
unsigned NumResults,
438 bool HasTemplateKWAndArgsInfo,
unsigned NumTemplateArgs) {
439 assert(NumTemplateArgs == 0 || HasTemplateKWAndArgsInfo);
442 NumResults, HasTemplateKWAndArgsInfo, NumTemplateArgs);
455 bool KnownInstantiationDependent,
456 bool KnownContainsUnexpandedParameterPack)
463 (KnownContainsUnexpandedParameterPack ||
465 (QualifierLoc && QualifierLoc.getNestedNameSpecifier()
467 NameInfo(NameInfo), QualifierLoc(QualifierLoc) {
468 unsigned NumResults = End -
Begin;
471 (TemplateArgs != nullptr ) || TemplateKWLoc.
isValid();
476 if ((*I)->getDeclContext()->isDependentContext() ||
477 isa<UnresolvedUsingValueDecl>(*I)) {
480 ExprBits.InstantiationDependent =
true;
494 bool Dependent =
false;
495 bool InstantiationDependent =
false;
496 bool ContainsUnexpandedParameterPack =
false;
499 Dependent, InstantiationDependent, ContainsUnexpandedParameterPack);
505 if (InstantiationDependent)
506 ExprBits.InstantiationDependent =
true;
507 if (ContainsUnexpandedParameterPack)
508 ExprBits.ContainsUnexpandedParameterPack =
true;
509 }
else if (TemplateKWLoc.
isValid()) {
518 bool HasTemplateKWAndArgsInfo)
525 DependentScopeDeclRefExpr::DependentScopeDeclRefExpr(
538 QualifierLoc(QualifierLoc), NameInfo(NameInfo) {
540 (Args !=
nullptr) || TemplateKWLoc.
isValid();
542 bool Dependent =
true;
543 bool InstantiationDependent =
true;
544 bool ContainsUnexpandedParameterPack
545 =
ExprBits.ContainsUnexpandedParameterPack;
546 getTrailingObjects<ASTTemplateKWAndArgsInfo>()->initializeFrom(
547 TemplateKWLoc, *Args, getTrailingObjects<TemplateArgumentLoc>(),
548 Dependent, InstantiationDependent, ContainsUnexpandedParameterPack);
549 ExprBits.ContainsUnexpandedParameterPack = ContainsUnexpandedParameterPack;
550 }
else if (TemplateKWLoc.
isValid()) {
551 getTrailingObjects<ASTTemplateKWAndArgsInfo>()->initializeFrom(
560 assert(QualifierLoc &&
"should be created for dependent qualifiers");
561 bool HasTemplateKWAndArgsInfo = Args || TemplateKWLoc.
isValid();
563 totalSizeToAlloc<ASTTemplateKWAndArgsInfo, TemplateArgumentLoc>(
564 HasTemplateKWAndArgsInfo, Args ? Args->
size() : 0);
567 TemplateKWLoc, NameInfo, Args);
572 bool HasTemplateKWAndArgsInfo,
573 unsigned NumTemplateArgs) {
574 assert(NumTemplateArgs == 0 || HasTemplateKWAndArgsInfo);
576 totalSizeToAlloc<ASTTemplateKWAndArgsInfo, TemplateArgumentLoc>(
577 HasTemplateKWAndArgsInfo, NumTemplateArgs);
583 HasTemplateKWAndArgsInfo;
588 if (isa<CXXTemporaryObjectExpr>(
this))
589 return cast<CXXTemporaryObjectExpr>(
this)->
getBeginLoc();
590 return getLocation();
594 if (isa<CXXTemporaryObjectExpr>(
this))
595 return cast<CXXTemporaryObjectExpr>(
this)->
getEndLoc();
597 if (ParenOrBraceRange.isValid())
598 return ParenOrBraceRange.getEnd();
601 for (
unsigned I = getNumArgs(); I > 0; --I) {
602 const Expr *Arg = getArg(I-1);
621 :
CallExpr(CXXOperatorCallExprClass, Fn, {}, Args, Ty, VK,
622 OperatorLoc, 0, UsesADL) {
627 "OperatorKind overflow!");
629 "FPFeatures overflow!");
630 Range = getSourceRangeImpl();
633 CXXOperatorCallExpr::CXXOperatorCallExpr(
unsigned NumArgs,
EmptyShell Empty)
634 :
CallExpr(CXXOperatorCallExprClass, 0, NumArgs, Empty) {}
641 unsigned NumArgs = Args.size();
642 unsigned SizeOfTrailingObjects =
647 FPFeatures, UsesADL);
654 unsigned SizeOfTrailingObjects =
661 SourceRange CXXOperatorCallExpr::getSourceRangeImpl()
const {
663 if (Kind == OO_PlusPlus || Kind == OO_MinusMinus) {
664 if (getNumArgs() == 1)
670 }
else if (Kind == OO_Arrow) {
671 return getArg(0)->getSourceRange();
672 }
else if (Kind == OO_Call) {
674 }
else if (Kind == OO_Subscript) {
676 }
else if (getNumArgs() == 1) {
678 }
else if (getNumArgs() == 2) {
681 return getOperatorLoc();
688 :
CallExpr(CXXMemberCallExprClass, Fn, {}, Args, Ty, VK, RP,
689 MinNumArgs, NotADL) {}
691 CXXMemberCallExpr::CXXMemberCallExpr(
unsigned NumArgs,
EmptyShell Empty)
692 :
CallExpr(CXXMemberCallExprClass, 0, NumArgs, Empty) {}
698 unsigned MinNumArgs) {
700 unsigned NumArgs = std::max<unsigned>(Args.size(), MinNumArgs);
701 unsigned SizeOfTrailingObjects =
712 unsigned SizeOfTrailingObjects =
721 if (
const auto *MemExpr = dyn_cast<MemberExpr>(Callee))
722 return MemExpr->getBase();
723 if (
const auto *BO = dyn_cast<BinaryOperator>(Callee))
724 if (BO->getOpcode() == BO_PtrMemD || BO->getOpcode() == BO_PtrMemI)
732 QualType Ty = getImplicitObjectArgument()->getType();
739 if (
const auto *MemExpr = dyn_cast<MemberExpr>(getCallee()->
IgnoreParens()))
740 return cast<CXXMethodDecl>(MemExpr->getMemberDecl());
747 Expr* ThisArg = getImplicitObjectArgument();
766 case CXXStaticCastExprClass:
return "static_cast";
767 case CXXDynamicCastExprClass:
return "dynamic_cast";
768 case CXXReinterpretCastExprClass:
return "reinterpret_cast";
769 case CXXConstCastExprClass:
return "const_cast";
770 default:
return "<invalid cast>";
782 unsigned PathSize = (BasePath ? BasePath->size() : 0);
783 void *Buffer = C.
Allocate(totalSizeToAlloc<CXXBaseSpecifier *>(PathSize));
786 RParenLoc, AngleBrackets);
788 std::uninitialized_copy_n(BasePath->data(), BasePath->size(),
795 void *Buffer = C.
Allocate(totalSizeToAlloc<CXXBaseSpecifier *>(PathSize));
807 unsigned PathSize = (BasePath ? BasePath->size() : 0);
808 void *Buffer = C.
Allocate(totalSizeToAlloc<CXXBaseSpecifier *>(PathSize));
811 RParenLoc, AngleBrackets);
813 std::uninitialized_copy_n(BasePath->data(), BasePath->size(),
820 void *Buffer = C.
Allocate(totalSizeToAlloc<CXXBaseSpecifier *>(PathSize));
834 QualType SrcType = getSubExpr()->getType();
848 if (!SrcRD->hasAttr<FinalAttr>())
854 return !DestRD->isDerivedFrom(SrcRD);
864 unsigned PathSize = (BasePath ? BasePath->size() : 0);
865 void *Buffer = C.
Allocate(totalSizeToAlloc<CXXBaseSpecifier *>(PathSize));
868 RParenLoc, AngleBrackets);
870 std::uninitialized_copy_n(BasePath->data(), BasePath->size(),
877 void *Buffer = C.
Allocate(totalSizeToAlloc<CXXBaseSpecifier *>(PathSize));
887 return new (
C)
CXXConstCastExpr(T, VK, Op, WrittenTy, L, RParenLoc, AngleBrackets);
899 unsigned PathSize = (BasePath ? BasePath->size() : 0);
900 void *Buffer = C.
Allocate(totalSizeToAlloc<CXXBaseSpecifier *>(PathSize));
904 std::uninitialized_copy_n(BasePath->data(), BasePath->size(),
911 void *Buffer = C.
Allocate(totalSizeToAlloc<CXXBaseSpecifier *>(PathSize));
916 return getTypeInfoAsWritten()->getTypeLoc().getBeginLoc();
920 return RParenLoc.
isValid() ? RParenLoc : getSubExpr()->getEndLoc();
927 :
CallExpr(UserDefinedLiteralClass, Fn, {}, Args, Ty, VK,
928 LitEndLoc, 0, NotADL),
929 UDSuffixLoc(SuffixLoc) {}
931 UserDefinedLiteral::UserDefinedLiteral(
unsigned NumArgs,
EmptyShell Empty)
932 :
CallExpr(UserDefinedLiteralClass, 0, NumArgs, Empty) {}
940 unsigned NumArgs = Args.size();
941 unsigned SizeOfTrailingObjects =
952 unsigned SizeOfTrailingObjects =
961 if (getNumArgs() == 0)
963 if (getNumArgs() == 2)
966 assert(getNumArgs() == 1 &&
"unexpected #args in literal operator call");
968 cast<FunctionDecl>(getCalleeDecl())->getParamDecl(0)->getType();
972 return LOK_Character;
978 llvm_unreachable(
"unknown kind of literal operator");
984 assert(LOK != LOK_Template && LOK != LOK_Raw &&
"not a cooked literal");
990 return cast<FunctionDecl>(getCalleeDecl())->getLiteralIdentifier();
1001 Field(Field), UsedContext(UsedContext) {
1016 "Expression bound to a temporary must have record or array type!");
1021 CXXTemporaryObjectExpr::CXXTemporaryObjectExpr(
1024 bool HadMultipleCandidates,
bool ListInitialization,
1025 bool StdInitListInitialization,
bool ZeroInitialization)
1028 Cons,
false, Args, HadMultipleCandidates,
1029 ListInitialization, StdInitListInitialization, ZeroInitialization,
1033 CXXTemporaryObjectExpr::CXXTemporaryObjectExpr(
EmptyShell Empty,
1040 bool HadMultipleCandidates,
bool ListInitialization,
1041 bool StdInitListInitialization,
bool ZeroInitialization) {
1042 unsigned SizeOfTrailingObjects = sizeOfTrailingObjects(Args.size());
1047 Cons, Ty, TSI, Args, ParenOrBraceRange, HadMultipleCandidates,
1048 ListInitialization, StdInitListInitialization, ZeroInitialization);
1053 unsigned SizeOfTrailingObjects = sizeOfTrailingObjects(NumArgs);
1061 return getTypeSourceInfo()->getTypeLoc().getBeginLoc();
1067 Loc = getArg(getNumArgs() - 1)->
getEndLoc();
1074 bool HadMultipleCandidates,
bool ListInitialization,
1075 bool StdInitListInitialization,
bool ZeroInitialization,
1077 unsigned SizeOfTrailingObjects = sizeOfTrailingObjects(Args.size());
1081 CXXConstructExprClass, Ty, Loc, Ctor, Elidable, Args,
1082 HadMultipleCandidates, ListInitialization, StdInitListInitialization,
1083 ZeroInitialization, ConstructKind, ParenOrBraceRange);
1088 unsigned SizeOfTrailingObjects = sizeOfTrailingObjects(NumArgs);
1098 bool ListInitialization,
bool StdInitListInitialization,
1102 Ty->isDependentType(), Ty->isInstantiationDependentType(),
1104 Constructor(Ctor), ParenOrBraceRange(ParenOrBraceRange),
1105 NumArgs(Args.size()) {
1114 Stmt **TrailingArgs = getTrailingArgs();
1115 for (
unsigned I = 0, N = Args.size(); I != N; ++I) {
1116 assert(Args[I] &&
"NULL argument in CXXConstructExpr!");
1121 ExprBits.InstantiationDependent =
true;
1123 ExprBits.ContainsUnexpandedParameterPack =
true;
1125 TrailingArgs[I] = Args[I];
1131 :
Expr(SC, Empty), NumArgs(NumArgs) {}
1136 : DeclAndBits(Var, 0), Loc(Loc), EllipsisLoc(EllipsisLoc) {
1139 Bits |= Capture_Implicit;
1143 Bits |= Capture_ByCopy;
1146 assert(!Var &&
"'this' capture cannot have a variable!");
1147 Bits |= Capture_This;
1151 Bits |= Capture_ByCopy;
1154 assert(Var &&
"capture must have a variable!");
1157 assert(!Var &&
"VLA type capture cannot have a variable!");
1160 DeclAndBits.setInt(Bits);
1166 bool CapByCopy = DeclAndBits.getInt() & Capture_ByCopy;
1178 bool ContainsUnexpandedParameterPack)
1181 ContainsUnexpandedParameterPack),
1182 IntroducerRange(IntroducerRange), CaptureDefaultLoc(CaptureDefaultLoc),
1183 NumCaptures(Captures.size()), CaptureDefault(CaptureDefault),
1184 ExplicitParams(ExplicitParams), ExplicitResultType(ExplicitResultType),
1185 ClosingBrace(ClosingBrace) {
1186 assert(CaptureInits.size() == Captures.size() &&
"Wrong number of arguments");
1188 CXXRecordDecl::LambdaDefinitionData &Data = Class->getLambdaData();
1193 const ASTContext &Context = Class->getASTContext();
1194 Data.NumCaptures = NumCaptures;
1195 Data.NumExplicitCaptures = 0;
1199 for (
unsigned I = 0, N = Captures.size(); I != N; ++I) {
1201 ++Data.NumExplicitCaptures;
1203 *ToCapture++ = Captures[I];
1207 Stmt **Stored = getStoredStmts();
1208 for (
unsigned I = 0, N = CaptureInits.size(); I != N; ++I)
1209 *Stored++ = CaptureInits[I];
1212 *Stored++ = getCallOperator()->getBody();
1219 bool ExplicitParams,
bool ExplicitResultType,
ArrayRef<Expr *> CaptureInits,
1220 SourceLocation ClosingBrace,
bool ContainsUnexpandedParameterPack) {
1225 unsigned Size = totalSizeToAlloc<Stmt *>(Captures.size() + 1);
1226 void *Mem = Context.
Allocate(Size);
1228 LambdaExpr(T, IntroducerRange, CaptureDefault, CaptureDefaultLoc,
1229 Captures, ExplicitParams, ExplicitResultType, CaptureInits,
1230 ClosingBrace, ContainsUnexpandedParameterPack);
1234 unsigned NumCaptures) {
1235 unsigned Size = totalSizeToAlloc<Stmt *>(NumCaptures + 1);
1246 return getLambdaClass()->getLambdaData().Captures;
1250 return capture_begin() + NumCaptures;
1258 return capture_begin();
1262 struct CXXRecordDecl::LambdaDefinitionData &Data
1263 = getLambdaClass()->getLambdaData();
1264 return Data.Captures + Data.NumExplicitCaptures;
1268 return capture_range(explicit_capture_begin(), explicit_capture_end());
1272 return explicit_capture_end();
1276 return capture_end();
1280 return capture_range(implicit_capture_begin(), implicit_capture_end());
1284 return getType()->getAsCXXRecordDecl();
1311 if (!getStoredStmts()[NumCaptures])
1312 *
const_cast<Stmt **
>(&getStoredStmts()[NumCaptures]) =
1313 getCallOperator()->getBody();
1315 return static_cast<CompoundStmt *
>(getStoredStmts()[NumCaptures]);
1319 return !getCallOperator()->isConst();
1322 ExprWithCleanups::ExprWithCleanups(
Expr *subexpr,
1323 bool CleanupsHaveSideEffects,
1325 :
FullExpr(ExprWithCleanupsClass, subexpr) {
1326 ExprWithCleanupsBits.CleanupsHaveSideEffects = CleanupsHaveSideEffects;
1327 ExprWithCleanupsBits.NumObjects = objects.size();
1328 for (
unsigned i = 0, e = objects.size(); i != e; ++i)
1329 getTrailingObjects<CleanupObject>()[i] = objects[i];
1333 bool CleanupsHaveSideEffects,
1335 void *buffer = C.
Allocate(totalSizeToAlloc<CleanupObject>(objects.size()),
1341 ExprWithCleanups::ExprWithCleanups(
EmptyShell empty,
unsigned numObjects)
1342 :
FullExpr(ExprWithCleanupsClass, empty) {
1343 ExprWithCleanupsBits.NumObjects = numObjects;
1348 unsigned numObjects) {
1349 void *buffer = C.
Allocate(totalSizeToAlloc<CleanupObject>(numObjects),
1354 CXXUnresolvedConstructExpr::CXXUnresolvedConstructExpr(
TypeSourceInfo *TSI,
1358 :
Expr(CXXUnresolvedConstructExprClass,
1368 TSI(TSI), LParenLoc(LParenLoc), RParenLoc(RParenLoc) {
1369 CXXUnresolvedConstructExprBits.NumArgs = Args.size();
1370 auto **StoredArgs = getTrailingObjects<Expr *>();
1371 for (
unsigned I = 0; I != Args.size(); ++I) {
1372 if (Args[I]->containsUnexpandedParameterPack())
1373 ExprBits.ContainsUnexpandedParameterPack =
true;
1375 StoredArgs[I] = Args[I];
1382 void *Mem = Context.
Allocate(totalSizeToAlloc<Expr *>(Args.size()));
1389 void *Mem = Context.
Allocate(totalSizeToAlloc<Expr *>(NumArgs));
1397 CXXDependentScopeMemberExpr::CXXDependentScopeMemberExpr(
1409 Base(Base), BaseType(BaseType), QualifierLoc(QualifierLoc),
1410 MemberNameInfo(MemberNameInfo) {
1411 CXXDependentScopeMemberExprBits.IsArrow = IsArrow;
1412 CXXDependentScopeMemberExprBits.HasTemplateKWAndArgsInfo =
1413 (TemplateArgs !=
nullptr) || TemplateKWLoc.
isValid();
1414 CXXDependentScopeMemberExprBits.HasFirstQualifierFoundInScope =
1415 FirstQualifierFoundInScope !=
nullptr;
1416 CXXDependentScopeMemberExprBits.OperatorLoc = OperatorLoc;
1419 bool Dependent =
true;
1420 bool InstantiationDependent =
true;
1421 bool ContainsUnexpandedParameterPack =
false;
1422 getTrailingObjects<ASTTemplateKWAndArgsInfo>()->initializeFrom(
1423 TemplateKWLoc, *TemplateArgs, getTrailingObjects<TemplateArgumentLoc>(),
1424 Dependent, InstantiationDependent, ContainsUnexpandedParameterPack);
1425 if (ContainsUnexpandedParameterPack)
1426 ExprBits.ContainsUnexpandedParameterPack =
true;
1427 }
else if (TemplateKWLoc.
isValid()) {
1428 getTrailingObjects<ASTTemplateKWAndArgsInfo>()->initializeFrom(
1432 if (hasFirstQualifierFoundInScope())
1433 *getTrailingObjects<NamedDecl *>() = FirstQualifierFoundInScope;
1436 CXXDependentScopeMemberExpr::CXXDependentScopeMemberExpr(
1437 EmptyShell Empty,
bool HasTemplateKWAndArgsInfo,
1438 bool HasFirstQualifierFoundInScope)
1439 :
Expr(CXXDependentScopeMemberExprClass, Empty) {
1440 CXXDependentScopeMemberExprBits.HasTemplateKWAndArgsInfo =
1441 HasTemplateKWAndArgsInfo;
1442 CXXDependentScopeMemberExprBits.HasFirstQualifierFoundInScope =
1443 HasFirstQualifierFoundInScope;
1452 bool HasTemplateKWAndArgsInfo =
1453 (TemplateArgs !=
nullptr) || TemplateKWLoc.
isValid();
1454 unsigned NumTemplateArgs = TemplateArgs ? TemplateArgs->
size() : 0;
1455 bool HasFirstQualifierFoundInScope = FirstQualifierFoundInScope !=
nullptr;
1459 HasTemplateKWAndArgsInfo, NumTemplateArgs, HasFirstQualifierFoundInScope);
1463 Ctx, Base, BaseType, IsArrow, OperatorLoc, QualifierLoc, TemplateKWLoc,
1464 FirstQualifierFoundInScope, MemberNameInfo, TemplateArgs);
1468 const ASTContext &Ctx,
bool HasTemplateKWAndArgsInfo,
1469 unsigned NumTemplateArgs,
bool HasFirstQualifierFoundInScope) {
1470 assert(NumTemplateArgs == 0 || HasTemplateKWAndArgsInfo);
1474 HasTemplateKWAndArgsInfo, NumTemplateArgs, HasFirstQualifierFoundInScope);
1478 EmptyShell(), HasTemplateKWAndArgsInfo, HasFirstQualifierFoundInScope);
1485 if (isa<UnresolvedUsingValueDecl>(decl))
1493 }
while (++begin != end);
1498 UnresolvedMemberExpr::UnresolvedMemberExpr(
1506 UnresolvedMemberExprClass, Context, QualifierLoc, TemplateKWLoc,
1507 MemberNameInfo, TemplateArgs, Begin, End,
1515 Base(Base), BaseType(BaseType), OperatorLoc(OperatorLoc) {
1516 UnresolvedMemberExprBits.IsArrow = IsArrow;
1517 UnresolvedMemberExprBits.HasUnresolvedUsing = HasUnresolvedUsing;
1525 UnresolvedMemberExpr::UnresolvedMemberExpr(EmptyShell Empty,
1526 unsigned NumResults,
1527 bool HasTemplateKWAndArgsInfo)
1528 :
OverloadExpr(UnresolvedMemberExprClass, Empty, NumResults,
1529 HasTemplateKWAndArgsInfo) {}
1535 return cast<Expr>(Base)->isImplicitCXXThis();
1545 unsigned NumResults = End -
Begin;
1546 bool HasTemplateKWAndArgsInfo = TemplateArgs || TemplateKWLoc.
isValid();
1547 unsigned NumTemplateArgs = TemplateArgs ? TemplateArgs->
size() : 0;
1550 NumResults, HasTemplateKWAndArgsInfo, NumTemplateArgs);
1553 Context, HasUnresolvedUsing, Base, BaseType, IsArrow, OperatorLoc,
1554 QualifierLoc, TemplateKWLoc, MemberNameInfo, TemplateArgs, Begin, End);
1558 const ASTContext &Context,
unsigned NumResults,
1559 bool HasTemplateKWAndArgsInfo,
unsigned NumTemplateArgs) {
1560 assert(NumTemplateArgs == 0 || HasTemplateKWAndArgsInfo);
1563 NumResults, HasTemplateKWAndArgsInfo, NumTemplateArgs);
1576 auto *NNS = getQualifier();
1578 const Type *T = getQualifier()->getAsType();
1579 assert(T &&
"qualifier in member expression does not name type");
1581 assert(Record &&
"qualifier in member expression does not name record");
1590 assert(Record &&
"base of member expression does not name record");
1603 Context.
Allocate(totalSizeToAlloc<TemplateArgument>(PartialArgs.size()));
1605 PackLoc, RParenLoc, Length, PartialArgs);
1609 unsigned NumPartialArgs) {
1611 Context.
Allocate(totalSizeToAlloc<TemplateArgument>(NumPartialArgs));
1615 SubstNonTypeTemplateParmPackExpr::
1621 :
Expr(SubstNonTypeTemplateParmPackExprClass, T, ValueKind,
OK_Ordinary,
1623 Param(Param), Arguments(ArgPack.pack_begin()),
1624 NumArguments(ArgPack.pack_size()), NameLoc(NameLoc) {}
1630 FunctionParmPackExpr::FunctionParmPackExpr(
QualType T,
VarDecl *ParamPack,
1636 ParamPack(ParamPack), NameLoc(NameLoc), NumParameters(NumParams) {
1638 std::uninitialized_copy(Params, Params + NumParams,
1639 getTrailingObjects<VarDecl *>());
1646 return new (Context.
Allocate(totalSizeToAlloc<VarDecl *>(Params.size())))
1652 unsigned NumParams) {
1653 return new (Context.
Allocate(totalSizeToAlloc<VarDecl *>(NumParams)))
1658 QualType T,
Expr *Temporary,
bool BoundToLvalueReference,
1660 :
Expr(MaterializeTemporaryExprClass, T,
1667 MTD->ExprWithTemporary = Temporary;
1674 unsigned ManglingNumber) {
1683 cast<Expr>(
State.get<
Stmt *>()), ExtendedBy, ManglingNumber);
1686 ES->ExtendingDecl = ExtendedBy;
1687 ES->ManglingNumber = ManglingNumber;
1699 Loc(Loc), RParenLoc(RParenLoc) {
1704 auto **ToArgs = getTrailingObjects<TypeSourceInfo *>();
1706 for (
unsigned I = 0, N = Args.size(); I != N; ++I) {
1714 ToArgs[I] = Args[I];
1724 void *Mem = C.
Allocate(totalSizeToAlloc<TypeSourceInfo *>(Args.size()));
1725 return new (Mem)
TypeTraitExpr(T, Loc, Kind, Args, RParenLoc, Value);
1730 void *Mem = C.
Allocate(totalSizeToAlloc<TypeSourceInfo *>(NumArgs));
1734 CUDAKernelCallExpr::CUDAKernelCallExpr(
Expr *Fn,
CallExpr *Config,
1737 unsigned MinNumArgs)
1738 :
CallExpr(CUDAKernelCallExprClass, Fn, Config, Args, Ty, VK,
1739 RP, MinNumArgs, NotADL) {}
1741 CUDAKernelCallExpr::CUDAKernelCallExpr(
unsigned NumArgs,
EmptyShell Empty)
1742 :
CallExpr(CUDAKernelCallExprClass, END_PREARG, NumArgs,
1750 unsigned NumArgs = std::max<unsigned>(Args.size(), MinNumArgs);
1751 unsigned SizeOfTrailingObjects =
1762 unsigned SizeOfTrailingObjects =
A call to an overloaded operator written using operator syntax.
static DependentScopeDeclRefExpr * CreateEmpty(const ASTContext &Context, bool HasTemplateKWAndArgsInfo, unsigned NumTemplateArgs)
void setValueDependent(bool VD)
Set whether this expression is value-dependent or not.
Defines the clang::ASTContext interface.
LiteralOperatorKind
The kind of literal operator which is invoked.
VarDecl * getCapturedVar() const
Retrieve the declaration of the local variable being captured.
capture_iterator explicit_capture_end() const
Retrieve an iterator pointing past the end of the sequence of explicit lambda captures.
static CXXConstructExpr * CreateEmpty(const ASTContext &Ctx, unsigned NumArgs)
Create an empty C++ construction expression.
Represents a function declaration or definition.
SourceLocation getRParenLoc() const
QualType getTypeOperand(ASTContext &Context) const
Retrieves the type operand of this __uuidof() expression after various required adjustments (removing...
if(T->getSizeExpr()) TRY_TO(TraverseStmt(T -> getSizeExpr()))
PointerType - C99 6.7.5.1 - Pointer Declarators.
Stores the type being destroyed by a pseudo-destructor expression.
A (possibly-)qualified type.
static const TemplateArgument & getArgument(const TemplateArgument &A)
capture_iterator capture_end() const
Retrieve an iterator pointing past the end of the sequence of lambda captures.
A type trait used in the implementation of various C++11 and Library TR1 trait templates.
Stmt - This represents one statement.
unsigned getNumArgs() const
getNumArgs - Return the number of actual arguments to this call.
LambdaCapture(SourceLocation Loc, bool Implicit, LambdaCaptureKind Kind, VarDecl *Var=nullptr, SourceLocation EllipsisLoc=SourceLocation())
Create a new capture of a variable or of this.
QualType getPointeeType() const
If this is a pointer, ObjC object pointer, or block pointer, this returns the respective pointee...
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 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)
C Language Family Type Representation.
Microsoft's '__super' specifier, stored as a CXXRecordDecl* of the class it appeared in...
bool isRecordType() const
static unsigned sizeOfTrailingObjects(unsigned NumPreArgs, unsigned NumArgs)
Return the size in bytes needed for the trailing objects.
Expr * getImplicitObjectArgument() const
Retrieve the implicit object argument for the member call.
LambdaCaptureDefault
The default, if any, capture method for a lambda expression.
A reference to a name which we were able to look up during parsing but could not resolve to a specifi...
Defines the C++ template declaration subclasses.
QualType getNonReferenceType() const
If Type is a reference type (e.g., const int&), returns the type that the reference refers to ("const...
The base class of the type hierarchy.
SourceLocation getEndLoc() const LLVM_READONLY
Represents a call to a C++ constructor.
ArrayRef< NamedDecl * > getLambdaExplicitTemplateParameters() const
Retrieve the lambda template parameters that were specified explicitly.
A container of type source information.
Floating point control options.
bool isInstantiationDependent() const
Determine whether this name involves a template parameter.
static CXXFunctionalCastExpr * Create(const ASTContext &Context, QualType T, ExprValueKind VK, TypeSourceInfo *Written, CastKind Kind, Expr *Op, const CXXCastPath *Path, SourceLocation LPLoc, SourceLocation RPLoc)
Describes the capture of a variable or of this, or of a C++1y init-capture.
Represents a C++ constructor within a class.
bool hasInClassInitializer() const
Determine whether this member has a C++11 default member initializer.
static CXXOperatorCallExpr * Create(const ASTContext &Ctx, OverloadedOperatorKind OpKind, Expr *Fn, ArrayRef< Expr *> Args, QualType Ty, ExprValueKind VK, SourceLocation OperatorLoc, FPOptions FPFeatures, ADLCallKind UsesADL=NotADL)
capture_range implicit_captures() const
Retrieve this lambda's implicit captures.
SourceLocation getBeginLoc() const LLVM_READONLY
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.
CXXRecordDecl * getRecordDecl() const
Retrieve the CXXRecordDecl for the underlying type of the implicit object argument.
Represents a variable declaration or definition.
const T * getAs() const
Member-template getAs<specific type>'.
PseudoDestructorTypeStorage()=default
DecomposedForm getDecomposedForm() const LLVM_READONLY
Decompose this operator into its syntactic form.
static FunctionParmPackExpr * CreateEmpty(const ASTContext &Context, unsigned NumParams)
NamedDecl * getUnderlyingDecl()
Looks through UsingDecls and ObjCCompatibleAliasDecls for the underlying named decl.
SourceLocation getEndLoc() const LLVM_READONLY
Stores a list of template parameters for a TemplateDecl and its derived classes.
void setContainsUnexpandedParameterPack(bool PP=true)
Set the bit that describes whether this expression contains an unexpanded parameter pack...
Represents an expression – generally a full-expression – that introduces cleanups to be run at the ...
FunctionTemplateDecl * getDependentCallOperator() const
Retrieve the function template call operator associated with this lambda expression.
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)
TemplateParameterList * getGenericLambdaTemplateParameterList() const
Retrieve the generic lambda's template parameter list.
Defines the clang::Expr interface and subclasses for C++ expressions.
The collection of all-type qualifiers we support.
CXXRecordDecl * getLambdaClass() const
Retrieve the class that corresponds to the lambda.
A C++ static_cast expression (C++ [expr.static.cast]).
static CXXUnresolvedConstructExpr * Create(const ASTContext &Context, TypeSourceInfo *Type, SourceLocation LParenLoc, ArrayRef< Expr *> Args, SourceLocation RParenLoc)
One of these records is kept for each identifier that is lexed.
Holds long-lived AST nodes (such as types and decls) that can be referred to throughout the semantic ...
A C++ nested-name-specifier augmented with source location information.
FullExpr - Represents a "full-expression" node.
SourceLocation getBeginLoc() const LLVM_READONLY
LambdaCaptureKind
The different capture forms in a lambda introducer.
Represents a member of a struct/union/class.
SourceLocation getEndLoc() const LLVM_READONLY
CompoundStmt * getBody() const
Retrieve the body of the lambda.
SourceLocation getBeginLoc() const LLVM_READONLY
The iterator over UnresolvedSets.
QualType getDestroyedType() const
Retrieve the type being destroyed.
capture_iterator implicit_capture_end() const
Retrieve an iterator pointing past the end of the sequence of implicit lambda captures.
__SIZE_TYPE__ size_t
The unsigned integer type of the result of the sizeof operator.
Represents a C++ member access expression for which lookup produced a set of overloaded functions...
An r-value expression (a pr-value in the C++11 taxonomy) produces a temporary value.
TemplateArgument getArgumentPack() const
Retrieve the template argument pack containing the substituted template arguments.
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.
< Capturing the *this object by copy
bool capturesThis() const
Determine whether this capture handles the C++ this pointer.
A convenient class for passing around template argument information.
SourceLocation getLocation() const
Forward-declares and imports various common LLVM datatypes that clang wants to use unqualified...
An x-value expression is a reference to an object with independent storage but which can be "moved"...
bool containsUnexpandedParameterPack() const
Whether this type is or contains an unexpanded parameter pack, used to support C++0x variadic templat...
bool isRValueReferenceType() const
unsigned getInt() const
Used to serialize this.
QualType getObjectType() const
Retrieve the type of the object argument.
Represents binding an expression to a temporary.
A C++ lambda expression, which produces a function object (of unspecified type) that can be invoked l...
DeclAccessPair * getTrailingResults()
Return the results. Defined after UnresolvedMemberExpr.
bool isTypeDependent() const
isTypeDependent - Determines whether this expression is type-dependent (C++ [temp.dep.expr]), which means that its type could change from one template instantiation to the next.
An ordinary object is located at an address in memory.
Represents a C++ member access expression where the actual member referenced could not be resolved be...
bool containsUnexpandedParameterPack() const
Determine whether this name contains an unexpanded parameter pack.
bool isInitCapture(const LambdaCapture *Capture) const
Determine whether one of this lambda's captures is an init-capture.
static UnresolvedLookupExpr * Create(const ASTContext &Context, CXXRecordDecl *NamingClass, NestedNameSpecifierLoc QualifierLoc, const DeclarationNameInfo &NameInfo, bool RequiresADL, bool Overloaded, UnresolvedSetIterator Begin, UnresolvedSetIterator End)
const IdentifierInfo * getUDSuffix() const
Returns the ud-suffix specified for this literal.
MaterializeTemporaryExpr(QualType T, Expr *Temporary, bool BoundToLvalueReference, LifetimeExtendedTemporaryDecl *MTD=nullptr)
Represents an explicit template argument list in C++, e.g., the "<int>" in "sort<int>".
TypeTrait
Names for traits that operate specifically on types.
bool isInstantiationDependent() const
Whether this nested name specifier involves a template parameter.
ASTTemplateKWAndArgsInfo * getTrailingASTTemplateKWAndArgsInfo()
Return the optional template keyword and arguments info.
CompoundStmt - This represents a group of statements like { stmt stmt }.
CXXRecordDecl * getAsCXXRecordDecl() const
Retrieves the CXXRecordDecl that this type refers to, either because the type is a RecordType or beca...
Represents a prototype with parameter type info, e.g.
CastKind
CastKind - The kind of operation required for a conversion.
SourceRange getLocalSourceRange() const
Get the local source range.
static FunctionParmPackExpr * Create(const ASTContext &Context, QualType T, VarDecl *ParamPack, SourceLocation NameLoc, ArrayRef< VarDecl *> Params)
SourceLocation getBeginLoc() const
Get the begin source location.
SourceLocation getBeginLoc() const LLVM_READONLY
Represent the declaration of a variable (in which case it is an lvalue) a function (in which case it ...
This represents one expression.
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.
ExprValueKind
The categorization of expression values, currently following the C++11 scheme.
static CXXMemberCallExpr * CreateEmpty(const ASTContext &Ctx, unsigned NumArgs, EmptyShell Empty)
bool isImplicitAccess() const
True if this is an implicit access, i.e., one in which the member being accessed was not written in t...
const T * castAs() const
Member-template castAs<specific type>.
Represents a C++ functional cast expression that builds a temporary object.
A C++ const_cast expression (C++ [expr.const.cast]).
Represents a C++ destructor within a class.
const internal::VariadicAllOfMatcher< Decl > decl
Matches declarations.
Defines an enumeration for C++ overloaded operators.
static CXXStaticCastExpr * Create(const ASTContext &Context, QualType T, ExprValueKind VK, CastKind K, Expr *Op, const CXXCastPath *Path, TypeSourceInfo *Written, SourceLocation L, SourceLocation RParenLoc, SourceRange AngleBrackets)
static CXXReinterpretCastExpr * CreateEmpty(const ASTContext &Context, unsigned pathSize)
DeclContext * getDeclContext()
static UserDefinedLiteral * CreateEmpty(const ASTContext &Ctx, unsigned NumArgs, EmptyShell Empty)
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)
Represents an expression that computes the length of a parameter pack.
NonTypeTemplateParmDecl - Declares a non-type template parameter, e.g., "Size" in.
CXXDefaultInitExprBitfields CXXDefaultInitExprBits
Defines the clang::TypeLoc interface and its subclasses.
static LambdaExpr * Create(const ASTContext &C, CXXRecordDecl *Class, SourceRange IntroducerRange, LambdaCaptureDefault CaptureDefault, SourceLocation CaptureDefaultLoc, ArrayRef< LambdaCapture > Captures, bool ExplicitParams, bool ExplicitResultType, ArrayRef< Expr *> CaptureInits, SourceLocation ClosingBrace, bool ContainsUnexpandedParameterPack)
Construct a new lambda expression.
SourceLocation getEnd() const
CXXMethodDecl * getMethodDecl() const
Retrieve the declaration of the called method.
QualType getTypeOperand(ASTContext &Context) const
Retrieves the type operand of this typeid() expression after various required adjustments (removing r...
static UnresolvedLookupExpr * CreateEmpty(const ASTContext &Context, unsigned NumResults, bool HasTemplateKWAndArgsInfo, unsigned NumTemplateArgs)
QualType getTypeDeclType(const TypeDecl *Decl, const TypeDecl *PrevDecl=nullptr) const
Return the unique reference to the type for the specified type declaration.
The result type of a method or function.
QualType getDestroyedType() const
Retrieve the type being destroyed.
CXXMethodDecl * getCallOperator() const
Retrieve the function call operator associated with this lambda expression.
SourceRange getSourceRange() const
SourceLocation getEndLoc() const LLVM_READONLY
bool capturesVariable() const
Determine whether this capture handles a variable.
LiteralOperatorKind getLiteralOperatorKind() const
Returns the kind of literal operator invocation which this expression represents. ...
bool containsUnexpandedParameterPack() const
Whether this nested-name-specifier contains an unexpanded parameter pack (for C++11 variadic template...
A C++ dynamic_cast expression (C++ [expr.dynamic.cast]).
static CXXConstCastExpr * Create(const ASTContext &Context, QualType T, ExprValueKind VK, Expr *Op, TypeSourceInfo *WrittenTy, SourceLocation L, SourceLocation RParenLoc, SourceRange AngleBrackets)
static CXXBindTemporaryExpr * Create(const ASTContext &C, CXXTemporary *Temp, Expr *SubExpr)
A reference to an overloaded function set, either an UnresolvedLookupExpr or an UnresolvedMemberExpr...
capture_iterator implicit_capture_begin() const
Retrieve an iterator pointing to the first implicit lambda capture.
bool isInstantiationDependent() const
Whether this expression is instantiation-dependent, meaning that it depends in some way on a template...
FunctionDecl * getAsFunction() LLVM_READONLY
Returns the function itself, or the templated function if this is a function template.
static CXXDynamicCastExpr * CreateEmpty(const ASTContext &Context, unsigned pathSize)
Encodes a location in the source.
capture_iterator explicit_capture_begin() const
Retrieve an iterator pointing to the first explicit lambda capture.
FunctionTemplateDecl * getDependentLambdaCallOperator() const
Retrieve the dependent lambda call operator of the closure type if this is a templated closure type...
SourceLocation getEndLoc() const LLVM_READONLY
static DependentScopeDeclRefExpr * Create(const ASTContext &Context, NestedNameSpecifierLoc QualifierLoc, SourceLocation TemplateKWLoc, const DeclarationNameInfo &NameInfo, const TemplateArgumentListInfo *TemplateArgs)
static CXXOperatorCallExpr * CreateEmpty(const ASTContext &Ctx, unsigned NumArgs, EmptyShell Empty)
UnresolvedLookupExprBitfields UnresolvedLookupExprBits
Represents a C++ temporary.
bool shouldNullCheckAllocation() const
True if the allocation result needs to be null-checked.
static CXXConstCastExpr * CreateEmpty(const ASTContext &Context)
Represents a new-expression for memory allocation and constructor calls, e.g: "new CXXNewExpr(foo)"...
A call to a literal operator (C++11 [over.literal]) written as a user-defined literal (C++11 [lit...
static SizeOfPackExpr * Create(ASTContext &Context, SourceLocation OperatorLoc, NamedDecl *Pack, SourceLocation PackLoc, SourceLocation RParenLoc, Optional< unsigned > Length=None, ArrayRef< TemplateArgument > PartialArgs=None)
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.
static ExprWithCleanups * Create(const ASTContext &C, EmptyShell empty, unsigned numObjects)
void setExtendingDecl(ValueDecl *ExtendedBy, unsigned ManglingNumber)
ArrayRef< NamedDecl * > getExplicitTemplateParameters() const
Get the template parameters were explicitly specified (as opposed to being invented by use of an auto...
bool isValueDependent() const
isValueDependent - Determines whether this expression is value-dependent (C++ [temp.dep.constexpr]).
bool isAnyPointerType() const
bool isInfixBinaryOp() const
Is this written as an infix binary operator?
bool isExplicit() const
Determine whether this was an explicit capture (written between the square brackets introducing the l...
bool isAnyCharacterType() const
Determine whether this type is any of the built-in character types.
static CXXDependentScopeMemberExpr * CreateEmpty(const ASTContext &Ctx, bool HasTemplateKWAndArgsInfo, unsigned NumTemplateArgs, bool HasFirstQualifierFoundInScope)
__DEVICE__ void * memcpy(void *__a, const void *__b, size_t __c)
static SizeOfPackExpr * CreateDeserialized(ASTContext &Context, unsigned NumPartialArgs)
CXXRecordDecl * getNamingClass()
Retrieve the naming class of this lookup.
SourceLocation getBeginLoc() const LLVM_READONLY
static CXXTemporaryObjectExpr * CreateEmpty(const ASTContext &Ctx, unsigned NumArgs)
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)
bool isInstantiationDependentType() const
Determine whether this type is an instantiation-dependent type, meaning that the type involves a temp...
A placeholder type used to construct an empty shell of a type, that will be filled in later (e...
A qualified reference to a name whose declaration cannot yet be resolved.
static bool hasOnlyNonStaticMemberFunctions(UnresolvedSetIterator begin, UnresolvedSetIterator end)
Defines various enumerations that describe declaration and type specifiers.
A POD class for pairing a NamedDecl* with an access specifier.
void * Allocate(size_t Size, unsigned Align=8) const
Represents a reference to a function parameter pack or init-capture pack that has been substituted bu...
Represents a template argument.
static CXXUnresolvedConstructExpr * CreateEmpty(const ASTContext &Context, unsigned NumArgs)
bool isMutable() const
Determine whether the lambda is mutable, meaning that any captures values can be modified.
Dataflow Directional Tag Classes.
NestedNameSpecifier * getNestedNameSpecifier() const
Retrieve the nested-name-specifier to which this instance refers.
bool isValid() const
Return true if this is a valid SourceLocation object.
CXXMethodDecl * getLambdaCallOperator() const
Retrieve the lambda call operator of the closure type if this is a closure type.
DeducedType * getContainedDeducedType() const
Get the DeducedType whose type will be deduced for a variable with an initializer of this type...
DeclContext - This is used only as base class of specific decl types that can act as declaration cont...
OverloadedOperatorKind getOperator() const
Returns the kind of overloaded operator that this expression refers to.
OverloadedOperatorKind
Enumeration specifying the different kinds of C++ overloaded operators.
A C++ reinterpret_cast expression (C++ [expr.reinterpret.cast]).
LambdaCaptureKind getCaptureKind() const
Determine the kind of capture.
TypeSourceInfo * getTypeSourceInfo() const
bool capturesVLAType() const
Determine whether this captures a variable length array bound expression.
StmtClass getStmtClass() const
static LambdaExpr * CreateDeserialized(const ASTContext &C, unsigned NumCaptures)
Construct a new lambda expression that will be deserialized from an external source.
void setInstantiationDependent(bool ID)
Set whether this expression is instantiation-dependent or not.
DependentScopeDeclRefExprBitfields DependentScopeDeclRefExprBits
bool isInitCapture() const
Whether this variable is the implicit variable for a lambda init-capture.
DeclarationNameInfo - A collector data type for bundling together a DeclarationName and the correspnd...
TemplateParameterList * getTemplateParameterList() const
If this is a generic lambda expression, retrieve the template parameter list associated with it...
CXXNewExprBitfields CXXNewExprBits
SourceLocation getBeginLoc() const LLVM_READONLY
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)
Capturing variable-length array type.
Expr * IgnoreImplicit() LLVM_READONLY
Skip past any implicit AST nodes which might surround this expression until reaching a fixed point...
CXXConstructExprBitfields CXXConstructExprBits
A helper class that allows the use of isa/cast/dyncast to detect TagType objects of structs/unions/cl...
TemplateArgumentLoc * getTrailingTemplateArgumentLoc()
Return the optional template arguments.
Location wrapper for a TemplateArgument.
static CUDAKernelCallExpr * CreateEmpty(const ASTContext &Ctx, unsigned NumArgs, EmptyShell Empty)
bool isIntegerType() const
isIntegerType() does not include complex integers (a GCC extension).
Represents a call to a CUDA kernel function.
TypeTraitExprBitfields TypeTraitExprBits
CanQualType BoundMemberTy
static CXXFunctionalCastExpr * CreateEmpty(const ASTContext &Context, unsigned PathSize)
QualType getNonLValueExprType(const ASTContext &Context) const
Determine the type of a (typically non-lvalue) expression with the specified result type...
Capturing the *this object by reference.
Represents a base class of a C++ class.
Describes an explicit type conversion that uses functional notion but could not be resolved because o...
bool isLValueReferenceType() const
TypeLoc getTypeLoc() const
Return the TypeLoc wrapper for the type source info.
OverloadExprBitfields OverloadExprBits
static CXXMemberCallExpr * Create(const ASTContext &Ctx, Expr *Fn, ArrayRef< Expr *> Args, QualType Ty, ExprValueKind VK, SourceLocation RP, unsigned MinNumArgs=0)
Defines the C++ Decl subclasses, other than those for templates (found in DeclTemplate.h) and friends (in DeclFriend.h).
Defines the clang::SourceLocation class and associated facilities.
void setEnd(SourceLocation e)
Represents a C++ struct/union/class.
static CXXStaticCastExpr * CreateEmpty(const ASTContext &Context, unsigned PathSize)
static CXXTemporary * Create(const ASTContext &C, const CXXDestructorDecl *Destructor)
Represents an explicit C++ type conversion that uses "functional" notation (C++ [expr.type.conv]).
static TypeTraitExpr * CreateDeserialized(const ASTContext &C, unsigned NumArgs)
Expr * IgnoreImplicitAsWritten() LLVM_READONLY
Skip past any implicit AST nodes which might surround this expression until reaching a fixed point...
CXXOperatorCallExprBitfields CXXOperatorCallExprBits
void initializeFrom(SourceLocation TemplateKWLoc, const TemplateArgumentListInfo &List, TemplateArgumentLoc *OutArgArray)
static CXXNewExpr * CreateEmpty(const ASTContext &Ctx, bool IsArray, bool HasInit, unsigned NumPlacementArgs, bool IsParenTypeId)
Create an empty c++ new expression.
bool containsUnexpandedParameterPack() const
Whether this expression contains an unexpanded parameter pack (for C++11 variadic templates)...
capture_range captures() const
Retrieve this lambda's captures.
Implicit declaration of a temporary that was materialized by a MaterializeTemporaryExpr and lifetime-...
CallExpr - Represents a function call (C99 6.5.2.2, C++ [expr.call]).
CXXPseudoDestructorExpr(const ASTContext &Context, Expr *Base, bool isArrow, SourceLocation OperatorLoc, NestedNameSpecifierLoc QualifierLoc, TypeSourceInfo *ScopeType, SourceLocation ColonColonLoc, SourceLocation TildeLoc, PseudoDestructorTypeStorage DestroyedType)
static CUDAKernelCallExpr * Create(const ASTContext &Ctx, Expr *Fn, CallExpr *Config, ArrayRef< Expr *> Args, QualType Ty, ExprValueKind VK, SourceLocation RP, unsigned MinNumArgs=0)
capture_iterator capture_begin() const
Retrieve an iterator pointing to the first lambda capture.
bool isDependentType() const
Whether this type is a dependent type, meaning that its definition somehow depends on a template para...
bool isAlwaysNull() const
isAlwaysNull - Return whether the result of the dynamic_cast is proven to always be null...
bool isPointerType() const
const char * getCastName() const
getCastName - Get the name of the C++ cast being used, e.g., "static_cast", "dynamic_cast", "reinterpret_cast", or "const_cast".
bool isDefaultArgument() const
Determine whether this expression is a default function argument.
static LifetimeExtendedTemporaryDecl * Create(Expr *Temp, ValueDecl *EDec, unsigned Mangling)
An l-value expression is a reference to an object with independent storage.
bool isFloatingType() const
A trivial tuple used to represent a source range.
This represents a decl that may have a name.
bool isPotentiallyEvaluated() const
Determine whether this typeid has a type operand which is potentially evaluated, per C++11 [expr...
static UserDefinedLiteral * Create(const ASTContext &Ctx, Expr *Fn, ArrayRef< Expr *> Args, QualType Ty, ExprValueKind VK, SourceLocation LitEndLoc, SourceLocation SuffixLoc)
capture_range explicit_captures() const
Retrieve this lambda's explicit captures.
SourceLocation getBegin() const
Declaration of a template function.
llvm::iterator_range< capture_iterator > capture_range
An iterator over a range of lambda captures.
QualType getUnqualifiedArrayType(QualType T, Qualifiers &Quals)
Return this type as a completely-unqualified array type, capturing the qualifiers in Quals...
QualType getType() const
Return the type wrapped by this type source info.
Defines the LambdaCapture class.
Expr * getCookedLiteral()
If this is not a raw user-defined literal, get the underlying cooked literal (representing the litera...
static CXXNewExpr * Create(const ASTContext &Ctx, bool IsGlobalNew, FunctionDecl *OperatorNew, FunctionDecl *OperatorDelete, bool ShouldPassAlignment, bool UsualArrayDeleteWantsSize, ArrayRef< Expr *> PlacementArgs, SourceRange TypeIdParens, Optional< Expr *> ArraySize, InitializationStyle InitializationStyle, Expr *Initializer, QualType Ty, TypeSourceInfo *AllocatedTypeInfo, SourceRange Range, SourceRange DirectInitRange)
Create a c++ new expression.
Expr * IgnoreParens() LLVM_READONLY
Skip past any parentheses which might surround this expression until reaching a fixed point...
CanQualType getSizeType() const
Return the unique type for "size_t" (C99 7.17), defined in <stddef.h>.
static UnresolvedMemberExpr * CreateEmpty(const ASTContext &Context, unsigned NumResults, bool HasTemplateKWAndArgsInfo, unsigned NumTemplateArgs)