31 #include "llvm/ADT/ArrayRef.h" 32 #include "llvm/Support/Casting.h" 33 #include "llvm/Support/ErrorHandling.h" 39 using namespace clang;
54 case OO_Call:
case OO_Subscript:
67 bool SkippedNot =
false;
68 if (
auto *NotEq = dyn_cast<UnaryOperator>(E)) {
69 assert(NotEq->getOpcode() == UO_LNot);
75 if (
auto *BO = dyn_cast<BinaryOperator>(E)) {
76 assert(!SkippedNot || BO->getOpcode() == BO_EQ);
77 Result.
Opcode = SkippedNot ? BO_NE : BO->getOpcode();
78 Result.
LHS = BO->getLHS();
79 Result.
RHS = BO->getRHS();
81 }
else if (
auto *BO = dyn_cast<CXXOperatorCallExpr>(E)) {
82 assert(!SkippedNot || BO->getOperator() == OO_EqualEqual);
83 assert(BO->isInfixBinaryOp());
84 switch (BO->getOperator()) {
85 case OO_Less: Result.
Opcode = BO_LT;
break;
86 case OO_LessEqual: Result.
Opcode = BO_LE;
break;
87 case OO_Greater: Result.
Opcode = BO_GT;
break;
88 case OO_GreaterEqual: Result.
Opcode = BO_GE;
break;
89 case OO_Spaceship: Result.
Opcode = BO_Cmp;
break;
90 case OO_EqualEqual: Result.
Opcode = SkippedNot ? BO_NE : BO_EQ;
break;
91 default: llvm_unreachable(
"unexpected binop in rewritten operator expr");
93 Result.
LHS = BO->getArg(0);
94 Result.
RHS = BO->getArg(1);
97 llvm_unreachable(
"unexpected rewritten operator form");
103 std::swap(Result.
LHS, Result.
RHS);
111 if (
auto *BO = dyn_cast<BinaryOperator>(E)) {
112 assert(BO->getOpcode() == BO_Cmp);
113 Result.
LHS = BO->getLHS();
114 Result.
RHS = BO->getRHS();
116 }
else if (
auto *BO = dyn_cast<CXXOperatorCallExpr>(E)) {
117 assert(BO->getOperator() == OO_Spaceship);
118 Result.
LHS = BO->getArg(0);
119 Result.
RHS = BO->getArg(1);
122 llvm_unreachable(
"unexpected rewritten operator form");
127 std::swap(Result.
LHS, Result.
RHS);
138 const Expr *E = getExprOperand();
140 if (RD->isPolymorphic() && E->
isGLValue())
147 assert(isTypeOperand() &&
"Cannot call getTypeOperand for typeid(expr)");
154 assert(isTypeOperand() &&
"Cannot call getTypeOperand for __uuidof(expr)");
166 CXXNewExpr::CXXNewExpr(
bool IsGlobalNew,
FunctionDecl *OperatorNew,
168 bool UsualArrayDeleteWantsSize,
171 InitializationStyle InitializationStyle,
178 OperatorNew(OperatorNew), OperatorDelete(OperatorDelete),
179 AllocatedTypeInfo(AllocatedTypeInfo), Range(Range),
180 DirectInitRange(DirectInitRange) {
182 assert((Initializer !=
nullptr || InitializationStyle ==
NoInit) &&
183 "Only NoInit can have no initializer!");
188 CXXNewExprBits.UsualArrayDeleteWantsSize = UsualArrayDeleteWantsSize;
190 Initializer ? InitializationStyle + 1 : 0;
191 bool IsParenTypeId = TypeIdParens.
isValid();
196 if (
Expr *SizeExpr = *ArraySize) {
197 if (SizeExpr->isValueDependent())
199 if (SizeExpr->isInstantiationDependent())
200 ExprBits.InstantiationDependent =
true;
201 if (SizeExpr->containsUnexpandedParameterPack())
202 ExprBits.ContainsUnexpandedParameterPack =
true;
205 getTrailingObjects<Stmt *>()[arraySizeOffset()] = *ArraySize;
212 ExprBits.InstantiationDependent =
true;
214 ExprBits.ContainsUnexpandedParameterPack =
true;
216 getTrailingObjects<Stmt *>()[initExprOffset()] =
Initializer;
219 for (
unsigned I = 0; I != PlacementArgs.size(); ++I) {
223 ExprBits.InstantiationDependent =
true;
225 ExprBits.ContainsUnexpandedParameterPack =
true;
227 getTrailingObjects<Stmt *>()[placementNewArgsOffset() + I] =
232 getTrailingObjects<SourceRange>()[0] = TypeIdParens;
234 switch (getInitializationStyle()) {
248 CXXNewExpr::CXXNewExpr(
EmptyShell Empty,
bool IsArray,
249 unsigned NumPlacementArgs,
bool IsParenTypeId)
250 :
Expr(CXXNewExprClass, Empty) {
259 bool ShouldPassAlignment,
bool UsualArrayDeleteWantsSize,
265 bool IsArray = ArraySize.hasValue();
266 bool HasInit = Initializer !=
nullptr;
267 unsigned NumPlacementArgs = PlacementArgs.size();
268 bool IsParenTypeId = TypeIdParens.
isValid();
270 Ctx.
Allocate(totalSizeToAlloc<Stmt *, SourceRange>(
271 IsArray + HasInit + NumPlacementArgs, IsParenTypeId),
274 CXXNewExpr(IsGlobalNew, OperatorNew, OperatorDelete, ShouldPassAlignment,
275 UsualArrayDeleteWantsSize, PlacementArgs, TypeIdParens,
276 ArraySize, InitializationStyle, Initializer, Ty,
277 AllocatedTypeInfo, Range, DirectInitRange);
281 bool HasInit,
unsigned NumPlacementArgs,
282 bool IsParenTypeId) {
284 Ctx.
Allocate(totalSizeToAlloc<Stmt *, SourceRange>(
285 IsArray + HasInit + NumPlacementArgs, IsParenTypeId),
292 return getOperatorNew()
296 !getOperatorNew()->isReservedGlobalPlacementOperator();
306 while (
const auto *ICE = dyn_cast<ImplicitCastExpr>(Arg)) {
307 if (ICE->getCastKind() == CK_DerivedToBase ||
308 ICE->getCastKind() == CK_UncheckedDerivedToBase ||
309 ICE->getCastKind() == CK_NoOp) {
310 assert((ICE->getCastKind() == CK_NoOp ||
311 getOperatorDelete()->isDestroyingOperatorDelete()) &&
312 "only a destroying operator delete can have a converted arg");
313 Arg = ICE->getSubExpr();
338 :
Expr(CXXPseudoDestructorExprClass,
339 Context.BoundMemberTy,
341 (Base->isTypeDependent() ||
344 Base->isValueDependent(),
345 (Base->isInstantiationDependent() ||
347 QualifierLoc.getNestedNameSpecifier()->isInstantiationDependent()) ||
349 ScopeType->getType()->isInstantiationDependentType()) ||
352 ->isInstantiationDependentType())),
354 (Base->containsUnexpandedParameterPack() ||
356 QualifierLoc.getNestedNameSpecifier()
357 ->containsUnexpandedParameterPack()) ||
359 ScopeType->getType()->containsUnexpandedParameterPack()) ||
362 ->containsUnexpandedParameterPack()))),
363 Base(static_cast<
Stmt *>(Base)), IsArrow(isArrow),
364 OperatorLoc(OperatorLoc), QualifierLoc(QualifierLoc),
365 ScopeType(ScopeType), ColonColonLoc(ColonColonLoc), TildeLoc(TildeLoc),
366 DestroyedType(DestroyedType) {}
370 return TInfo->getType();
378 End = TInfo->getTypeLoc().getLocalSourceRange().getEnd();
383 UnresolvedLookupExpr::UnresolvedLookupExpr(
389 :
OverloadExpr(UnresolvedLookupExprClass, Context, QualifierLoc,
390 TemplateKWLoc, NameInfo, TemplateArgs, Begin, End,
false,
392 NamingClass(NamingClass) {
397 UnresolvedLookupExpr::UnresolvedLookupExpr(
EmptyShell Empty,
399 bool HasTemplateKWAndArgsInfo)
400 :
OverloadExpr(UnresolvedLookupExprClass, Empty, NumResults,
401 HasTemplateKWAndArgsInfo) {}
408 unsigned NumResults = End -
Begin;
423 assert(Args || TemplateKWLoc.
isValid());
424 unsigned NumResults = End -
Begin;
425 unsigned NumTemplateArgs = Args ? Args->
size() : 0;
431 TemplateKWLoc, NameInfo, RequiresADL,
432 true, Args, Begin, End);
436 const ASTContext &Context,
unsigned NumResults,
437 bool HasTemplateKWAndArgsInfo,
unsigned NumTemplateArgs) {
438 assert(NumTemplateArgs == 0 || HasTemplateKWAndArgsInfo);
441 NumResults, HasTemplateKWAndArgsInfo, NumTemplateArgs);
454 bool KnownInstantiationDependent,
455 bool KnownContainsUnexpandedParameterPack)
462 (KnownContainsUnexpandedParameterPack ||
464 (QualifierLoc && QualifierLoc.getNestedNameSpecifier()
466 NameInfo(NameInfo), QualifierLoc(QualifierLoc) {
467 unsigned NumResults = End -
Begin;
470 (TemplateArgs != nullptr ) || TemplateKWLoc.
isValid();
475 if ((*I)->getDeclContext()->isDependentContext() ||
476 isa<UnresolvedUsingValueDecl>(*I)) {
479 ExprBits.InstantiationDependent =
true;
493 bool Dependent =
false;
494 bool InstantiationDependent =
false;
495 bool ContainsUnexpandedParameterPack =
false;
498 Dependent, InstantiationDependent, ContainsUnexpandedParameterPack);
504 if (InstantiationDependent)
505 ExprBits.InstantiationDependent =
true;
506 if (ContainsUnexpandedParameterPack)
507 ExprBits.ContainsUnexpandedParameterPack =
true;
508 }
else if (TemplateKWLoc.
isValid()) {
517 bool HasTemplateKWAndArgsInfo)
524 DependentScopeDeclRefExpr::DependentScopeDeclRefExpr(
537 QualifierLoc(QualifierLoc), NameInfo(NameInfo) {
539 (Args !=
nullptr) || TemplateKWLoc.
isValid();
541 bool Dependent =
true;
542 bool InstantiationDependent =
true;
543 bool ContainsUnexpandedParameterPack
544 =
ExprBits.ContainsUnexpandedParameterPack;
545 getTrailingObjects<ASTTemplateKWAndArgsInfo>()->initializeFrom(
546 TemplateKWLoc, *Args, getTrailingObjects<TemplateArgumentLoc>(),
547 Dependent, InstantiationDependent, ContainsUnexpandedParameterPack);
548 ExprBits.ContainsUnexpandedParameterPack = ContainsUnexpandedParameterPack;
549 }
else if (TemplateKWLoc.
isValid()) {
550 getTrailingObjects<ASTTemplateKWAndArgsInfo>()->initializeFrom(
559 assert(QualifierLoc &&
"should be created for dependent qualifiers");
560 bool HasTemplateKWAndArgsInfo = Args || TemplateKWLoc.
isValid();
562 totalSizeToAlloc<ASTTemplateKWAndArgsInfo, TemplateArgumentLoc>(
563 HasTemplateKWAndArgsInfo, Args ? Args->
size() : 0);
566 TemplateKWLoc, NameInfo, Args);
571 bool HasTemplateKWAndArgsInfo,
572 unsigned NumTemplateArgs) {
573 assert(NumTemplateArgs == 0 || HasTemplateKWAndArgsInfo);
575 totalSizeToAlloc<ASTTemplateKWAndArgsInfo, TemplateArgumentLoc>(
576 HasTemplateKWAndArgsInfo, NumTemplateArgs);
582 HasTemplateKWAndArgsInfo;
587 if (isa<CXXTemporaryObjectExpr>(
this))
588 return cast<CXXTemporaryObjectExpr>(
this)->
getBeginLoc();
589 return getLocation();
593 if (isa<CXXTemporaryObjectExpr>(
this))
594 return cast<CXXTemporaryObjectExpr>(
this)->
getEndLoc();
596 if (ParenOrBraceRange.isValid())
597 return ParenOrBraceRange.getEnd();
600 for (
unsigned I = getNumArgs(); I > 0; --I) {
601 const Expr *Arg = getArg(I-1);
620 :
CallExpr(CXXOperatorCallExprClass, Fn, {}, Args, Ty, VK,
621 OperatorLoc, 0, UsesADL) {
626 "OperatorKind overflow!");
628 "FPFeatures overflow!");
629 Range = getSourceRangeImpl();
632 CXXOperatorCallExpr::CXXOperatorCallExpr(
unsigned NumArgs,
EmptyShell Empty)
633 :
CallExpr(CXXOperatorCallExprClass, 0, NumArgs, Empty) {}
640 unsigned NumArgs = Args.size();
641 unsigned SizeOfTrailingObjects =
646 FPFeatures, UsesADL);
653 unsigned SizeOfTrailingObjects =
660 SourceRange CXXOperatorCallExpr::getSourceRangeImpl()
const {
662 if (Kind == OO_PlusPlus || Kind == OO_MinusMinus) {
663 if (getNumArgs() == 1)
669 }
else if (Kind == OO_Arrow) {
670 return getArg(0)->getSourceRange();
671 }
else if (Kind == OO_Call) {
673 }
else if (Kind == OO_Subscript) {
675 }
else if (getNumArgs() == 1) {
677 }
else if (getNumArgs() == 2) {
680 return getOperatorLoc();
687 :
CallExpr(CXXMemberCallExprClass, Fn, {}, Args, Ty, VK, RP,
688 MinNumArgs, NotADL) {}
690 CXXMemberCallExpr::CXXMemberCallExpr(
unsigned NumArgs,
EmptyShell Empty)
691 :
CallExpr(CXXMemberCallExprClass, 0, NumArgs, Empty) {}
697 unsigned MinNumArgs) {
699 unsigned NumArgs = std::max<unsigned>(Args.size(), MinNumArgs);
700 unsigned SizeOfTrailingObjects =
711 unsigned SizeOfTrailingObjects =
720 if (
const auto *MemExpr = dyn_cast<MemberExpr>(Callee))
721 return MemExpr->getBase();
722 if (
const auto *BO = dyn_cast<BinaryOperator>(Callee))
723 if (BO->getOpcode() == BO_PtrMemD || BO->getOpcode() == BO_PtrMemI)
731 QualType Ty = getImplicitObjectArgument()->getType();
738 if (
const auto *MemExpr = dyn_cast<MemberExpr>(getCallee()->
IgnoreParens()))
739 return cast<CXXMethodDecl>(MemExpr->getMemberDecl());
746 Expr* ThisArg = getImplicitObjectArgument();
765 case CXXStaticCastExprClass:
return "static_cast";
766 case CXXDynamicCastExprClass:
return "dynamic_cast";
767 case CXXReinterpretCastExprClass:
return "reinterpret_cast";
768 case CXXConstCastExprClass:
return "const_cast";
769 default:
return "<invalid cast>";
781 unsigned PathSize = (BasePath ? BasePath->size() : 0);
782 void *Buffer = C.
Allocate(totalSizeToAlloc<CXXBaseSpecifier *>(PathSize));
785 RParenLoc, AngleBrackets);
787 std::uninitialized_copy_n(BasePath->data(), BasePath->size(),
794 void *Buffer = C.
Allocate(totalSizeToAlloc<CXXBaseSpecifier *>(PathSize));
806 unsigned PathSize = (BasePath ? BasePath->size() : 0);
807 void *Buffer = C.
Allocate(totalSizeToAlloc<CXXBaseSpecifier *>(PathSize));
810 RParenLoc, AngleBrackets);
812 std::uninitialized_copy_n(BasePath->data(), BasePath->size(),
819 void *Buffer = C.
Allocate(totalSizeToAlloc<CXXBaseSpecifier *>(PathSize));
833 QualType SrcType = getSubExpr()->getType();
847 if (!SrcRD->hasAttr<FinalAttr>())
853 return !DestRD->isDerivedFrom(SrcRD);
863 unsigned PathSize = (BasePath ? BasePath->size() : 0);
864 void *Buffer = C.
Allocate(totalSizeToAlloc<CXXBaseSpecifier *>(PathSize));
867 RParenLoc, AngleBrackets);
869 std::uninitialized_copy_n(BasePath->data(), BasePath->size(),
876 void *Buffer = C.
Allocate(totalSizeToAlloc<CXXBaseSpecifier *>(PathSize));
886 return new (
C)
CXXConstCastExpr(T, VK, Op, WrittenTy, L, RParenLoc, AngleBrackets);
898 unsigned PathSize = (BasePath ? BasePath->size() : 0);
899 void *Buffer = C.
Allocate(totalSizeToAlloc<CXXBaseSpecifier *>(PathSize));
903 std::uninitialized_copy_n(BasePath->data(), BasePath->size(),
910 void *Buffer = C.
Allocate(totalSizeToAlloc<CXXBaseSpecifier *>(PathSize));
915 return getTypeInfoAsWritten()->getTypeLoc().getBeginLoc();
919 return RParenLoc.
isValid() ? RParenLoc : getSubExpr()->getEndLoc();
926 :
CallExpr(UserDefinedLiteralClass, Fn, {}, Args, Ty, VK,
927 LitEndLoc, 0, NotADL),
928 UDSuffixLoc(SuffixLoc) {}
930 UserDefinedLiteral::UserDefinedLiteral(
unsigned NumArgs,
EmptyShell Empty)
931 :
CallExpr(UserDefinedLiteralClass, 0, NumArgs, Empty) {}
939 unsigned NumArgs = Args.size();
940 unsigned SizeOfTrailingObjects =
951 unsigned SizeOfTrailingObjects =
960 if (getNumArgs() == 0)
962 if (getNumArgs() == 2)
965 assert(getNumArgs() == 1 &&
"unexpected #args in literal operator call");
967 cast<FunctionDecl>(getCalleeDecl())->getParamDecl(0)->getType();
971 return LOK_Character;
977 llvm_unreachable(
"unknown kind of literal operator");
983 assert(LOK != LOK_Template && LOK != LOK_Raw &&
"not a cooked literal");
989 return cast<FunctionDecl>(getCalleeDecl())->getLiteralIdentifier();
1000 Field(Field), UsedContext(UsedContext) {
1015 "Expression bound to a temporary must have record or array type!");
1020 CXXTemporaryObjectExpr::CXXTemporaryObjectExpr(
1023 bool HadMultipleCandidates,
bool ListInitialization,
1024 bool StdInitListInitialization,
bool ZeroInitialization)
1027 Cons,
false, Args, HadMultipleCandidates,
1028 ListInitialization, StdInitListInitialization, ZeroInitialization,
1032 CXXTemporaryObjectExpr::CXXTemporaryObjectExpr(
EmptyShell Empty,
1039 bool HadMultipleCandidates,
bool ListInitialization,
1040 bool StdInitListInitialization,
bool ZeroInitialization) {
1041 unsigned SizeOfTrailingObjects = sizeOfTrailingObjects(Args.size());
1046 Cons, Ty, TSI, Args, ParenOrBraceRange, HadMultipleCandidates,
1047 ListInitialization, StdInitListInitialization, ZeroInitialization);
1052 unsigned SizeOfTrailingObjects = sizeOfTrailingObjects(NumArgs);
1060 return getTypeSourceInfo()->getTypeLoc().getBeginLoc();
1066 Loc = getArg(getNumArgs() - 1)->
getEndLoc();
1073 bool HadMultipleCandidates,
bool ListInitialization,
1074 bool StdInitListInitialization,
bool ZeroInitialization,
1076 unsigned SizeOfTrailingObjects = sizeOfTrailingObjects(Args.size());
1080 CXXConstructExprClass, Ty, Loc, Ctor, Elidable, Args,
1081 HadMultipleCandidates, ListInitialization, StdInitListInitialization,
1082 ZeroInitialization, ConstructKind, ParenOrBraceRange);
1087 unsigned SizeOfTrailingObjects = sizeOfTrailingObjects(NumArgs);
1097 bool ListInitialization,
bool StdInitListInitialization,
1101 Ty->isDependentType(), Ty->isInstantiationDependentType(),
1103 Constructor(Ctor), ParenOrBraceRange(ParenOrBraceRange),
1104 NumArgs(Args.size()) {
1113 Stmt **TrailingArgs = getTrailingArgs();
1114 for (
unsigned I = 0, N = Args.size(); I != N; ++I) {
1115 assert(Args[I] &&
"NULL argument in CXXConstructExpr!");
1120 ExprBits.InstantiationDependent =
true;
1122 ExprBits.ContainsUnexpandedParameterPack =
true;
1124 TrailingArgs[I] = Args[I];
1130 :
Expr(SC, Empty), NumArgs(NumArgs) {}
1135 : DeclAndBits(Var, 0), Loc(Loc), EllipsisLoc(EllipsisLoc) {
1138 Bits |= Capture_Implicit;
1142 Bits |= Capture_ByCopy;
1145 assert(!Var &&
"'this' capture cannot have a variable!");
1146 Bits |= Capture_This;
1150 Bits |= Capture_ByCopy;
1153 assert(Var &&
"capture must have a variable!");
1156 assert(!Var &&
"VLA type capture cannot have a variable!");
1159 DeclAndBits.setInt(Bits);
1165 bool CapByCopy = DeclAndBits.getInt() & Capture_ByCopy;
1177 bool ContainsUnexpandedParameterPack)
1180 ContainsUnexpandedParameterPack),
1181 IntroducerRange(IntroducerRange), CaptureDefaultLoc(CaptureDefaultLoc),
1182 NumCaptures(Captures.size()), CaptureDefault(CaptureDefault),
1183 ExplicitParams(ExplicitParams), ExplicitResultType(ExplicitResultType),
1184 ClosingBrace(ClosingBrace) {
1185 assert(CaptureInits.size() == Captures.size() &&
"Wrong number of arguments");
1187 CXXRecordDecl::LambdaDefinitionData &Data = Class->getLambdaData();
1192 const ASTContext &Context = Class->getASTContext();
1193 Data.NumCaptures = NumCaptures;
1194 Data.NumExplicitCaptures = 0;
1198 for (
unsigned I = 0, N = Captures.size(); I != N; ++I) {
1200 ++Data.NumExplicitCaptures;
1202 *ToCapture++ = Captures[I];
1206 Stmt **Stored = getStoredStmts();
1207 for (
unsigned I = 0, N = CaptureInits.size(); I != N; ++I)
1208 *Stored++ = CaptureInits[I];
1211 *Stored++ = getCallOperator()->getBody();
1218 bool ExplicitParams,
bool ExplicitResultType,
ArrayRef<Expr *> CaptureInits,
1219 SourceLocation ClosingBrace,
bool ContainsUnexpandedParameterPack) {
1224 unsigned Size = totalSizeToAlloc<Stmt *>(Captures.size() + 1);
1225 void *Mem = Context.
Allocate(Size);
1227 LambdaExpr(T, IntroducerRange, CaptureDefault, CaptureDefaultLoc,
1228 Captures, ExplicitParams, ExplicitResultType, CaptureInits,
1229 ClosingBrace, ContainsUnexpandedParameterPack);
1233 unsigned NumCaptures) {
1234 unsigned Size = totalSizeToAlloc<Stmt *>(NumCaptures + 1);
1245 return getLambdaClass()->getLambdaData().Captures;
1249 return capture_begin() + NumCaptures;
1257 return capture_begin();
1261 struct CXXRecordDecl::LambdaDefinitionData &Data
1262 = getLambdaClass()->getLambdaData();
1263 return Data.Captures + Data.NumExplicitCaptures;
1267 return capture_range(explicit_capture_begin(), explicit_capture_end());
1271 return explicit_capture_end();
1275 return capture_end();
1279 return capture_range(implicit_capture_begin(), implicit_capture_end());
1283 return getType()->getAsCXXRecordDecl();
1310 if (!getStoredStmts()[NumCaptures])
1311 *
const_cast<Stmt **
>(&getStoredStmts()[NumCaptures]) =
1312 getCallOperator()->getBody();
1314 return static_cast<CompoundStmt *
>(getStoredStmts()[NumCaptures]);
1318 return !getCallOperator()->isConst();
1321 ExprWithCleanups::ExprWithCleanups(
Expr *subexpr,
1322 bool CleanupsHaveSideEffects,
1324 :
FullExpr(ExprWithCleanupsClass, subexpr) {
1325 ExprWithCleanupsBits.CleanupsHaveSideEffects = CleanupsHaveSideEffects;
1326 ExprWithCleanupsBits.NumObjects = objects.size();
1327 for (
unsigned i = 0, e = objects.size(); i != e; ++i)
1328 getTrailingObjects<CleanupObject>()[i] = objects[i];
1332 bool CleanupsHaveSideEffects,
1334 void *buffer = C.
Allocate(totalSizeToAlloc<CleanupObject>(objects.size()),
1340 ExprWithCleanups::ExprWithCleanups(
EmptyShell empty,
unsigned numObjects)
1341 :
FullExpr(ExprWithCleanupsClass, empty) {
1342 ExprWithCleanupsBits.NumObjects = numObjects;
1347 unsigned numObjects) {
1348 void *buffer = C.
Allocate(totalSizeToAlloc<CleanupObject>(numObjects),
1353 CXXUnresolvedConstructExpr::CXXUnresolvedConstructExpr(
TypeSourceInfo *TSI,
1357 :
Expr(CXXUnresolvedConstructExprClass,
1367 TSI(TSI), LParenLoc(LParenLoc), RParenLoc(RParenLoc) {
1368 CXXUnresolvedConstructExprBits.NumArgs = Args.size();
1369 auto **StoredArgs = getTrailingObjects<Expr *>();
1370 for (
unsigned I = 0; I != Args.size(); ++I) {
1371 if (Args[I]->containsUnexpandedParameterPack())
1372 ExprBits.ContainsUnexpandedParameterPack =
true;
1374 StoredArgs[I] = Args[I];
1381 void *Mem = Context.
Allocate(totalSizeToAlloc<Expr *>(Args.size()));
1388 void *Mem = Context.
Allocate(totalSizeToAlloc<Expr *>(NumArgs));
1396 CXXDependentScopeMemberExpr::CXXDependentScopeMemberExpr(
1408 Base(Base), BaseType(BaseType), QualifierLoc(QualifierLoc),
1409 MemberNameInfo(MemberNameInfo) {
1410 CXXDependentScopeMemberExprBits.IsArrow = IsArrow;
1411 CXXDependentScopeMemberExprBits.HasTemplateKWAndArgsInfo =
1412 (TemplateArgs !=
nullptr) || TemplateKWLoc.
isValid();
1413 CXXDependentScopeMemberExprBits.HasFirstQualifierFoundInScope =
1414 FirstQualifierFoundInScope !=
nullptr;
1415 CXXDependentScopeMemberExprBits.OperatorLoc = OperatorLoc;
1418 bool Dependent =
true;
1419 bool InstantiationDependent =
true;
1420 bool ContainsUnexpandedParameterPack =
false;
1421 getTrailingObjects<ASTTemplateKWAndArgsInfo>()->initializeFrom(
1422 TemplateKWLoc, *TemplateArgs, getTrailingObjects<TemplateArgumentLoc>(),
1423 Dependent, InstantiationDependent, ContainsUnexpandedParameterPack);
1424 if (ContainsUnexpandedParameterPack)
1425 ExprBits.ContainsUnexpandedParameterPack =
true;
1426 }
else if (TemplateKWLoc.
isValid()) {
1427 getTrailingObjects<ASTTemplateKWAndArgsInfo>()->initializeFrom(
1431 if (hasFirstQualifierFoundInScope())
1432 *getTrailingObjects<NamedDecl *>() = FirstQualifierFoundInScope;
1435 CXXDependentScopeMemberExpr::CXXDependentScopeMemberExpr(
1436 EmptyShell Empty,
bool HasTemplateKWAndArgsInfo,
1437 bool HasFirstQualifierFoundInScope)
1438 :
Expr(CXXDependentScopeMemberExprClass, Empty) {
1439 CXXDependentScopeMemberExprBits.HasTemplateKWAndArgsInfo =
1440 HasTemplateKWAndArgsInfo;
1441 CXXDependentScopeMemberExprBits.HasFirstQualifierFoundInScope =
1442 HasFirstQualifierFoundInScope;
1451 bool HasTemplateKWAndArgsInfo =
1452 (TemplateArgs !=
nullptr) || TemplateKWLoc.
isValid();
1453 unsigned NumTemplateArgs = TemplateArgs ? TemplateArgs->
size() : 0;
1454 bool HasFirstQualifierFoundInScope = FirstQualifierFoundInScope !=
nullptr;
1458 HasTemplateKWAndArgsInfo, NumTemplateArgs, HasFirstQualifierFoundInScope);
1462 Ctx, Base, BaseType, IsArrow, OperatorLoc, QualifierLoc, TemplateKWLoc,
1463 FirstQualifierFoundInScope, MemberNameInfo, TemplateArgs);
1467 const ASTContext &Ctx,
bool HasTemplateKWAndArgsInfo,
1468 unsigned NumTemplateArgs,
bool HasFirstQualifierFoundInScope) {
1469 assert(NumTemplateArgs == 0 || HasTemplateKWAndArgsInfo);
1473 HasTemplateKWAndArgsInfo, NumTemplateArgs, HasFirstQualifierFoundInScope);
1477 EmptyShell(), HasTemplateKWAndArgsInfo, HasFirstQualifierFoundInScope);
1484 if (isa<UnresolvedUsingValueDecl>(decl))
1492 }
while (++begin != end);
1497 UnresolvedMemberExpr::UnresolvedMemberExpr(
1505 UnresolvedMemberExprClass, Context, QualifierLoc, TemplateKWLoc,
1506 MemberNameInfo, TemplateArgs, Begin, End,
1514 Base(Base), BaseType(BaseType), OperatorLoc(OperatorLoc) {
1515 UnresolvedMemberExprBits.IsArrow = IsArrow;
1516 UnresolvedMemberExprBits.HasUnresolvedUsing = HasUnresolvedUsing;
1524 UnresolvedMemberExpr::UnresolvedMemberExpr(EmptyShell Empty,
1525 unsigned NumResults,
1526 bool HasTemplateKWAndArgsInfo)
1527 :
OverloadExpr(UnresolvedMemberExprClass, Empty, NumResults,
1528 HasTemplateKWAndArgsInfo) {}
1534 return cast<Expr>(Base)->isImplicitCXXThis();
1544 unsigned NumResults = End -
Begin;
1545 bool HasTemplateKWAndArgsInfo = TemplateArgs || TemplateKWLoc.
isValid();
1546 unsigned NumTemplateArgs = TemplateArgs ? TemplateArgs->
size() : 0;
1549 NumResults, HasTemplateKWAndArgsInfo, NumTemplateArgs);
1552 Context, HasUnresolvedUsing, Base, BaseType, IsArrow, OperatorLoc,
1553 QualifierLoc, TemplateKWLoc, MemberNameInfo, TemplateArgs, Begin, End);
1557 const ASTContext &Context,
unsigned NumResults,
1558 bool HasTemplateKWAndArgsInfo,
unsigned NumTemplateArgs) {
1559 assert(NumTemplateArgs == 0 || HasTemplateKWAndArgsInfo);
1562 NumResults, HasTemplateKWAndArgsInfo, NumTemplateArgs);
1575 auto *NNS = getQualifier();
1577 const Type *T = getQualifier()->getAsType();
1578 assert(T &&
"qualifier in member expression does not name type");
1580 assert(Record &&
"qualifier in member expression does not name record");
1589 assert(Record &&
"base of member expression does not name record");
1602 Context.
Allocate(totalSizeToAlloc<TemplateArgument>(PartialArgs.size()));
1604 PackLoc, RParenLoc, Length, PartialArgs);
1608 unsigned NumPartialArgs) {
1610 Context.
Allocate(totalSizeToAlloc<TemplateArgument>(NumPartialArgs));
1614 SubstNonTypeTemplateParmPackExpr::
1620 :
Expr(SubstNonTypeTemplateParmPackExprClass, T, ValueKind,
OK_Ordinary,
1622 Param(Param), Arguments(ArgPack.pack_begin()),
1623 NumArguments(ArgPack.pack_size()), NameLoc(NameLoc) {}
1629 FunctionParmPackExpr::FunctionParmPackExpr(
QualType T,
VarDecl *ParamPack,
1635 ParamPack(ParamPack), NameLoc(NameLoc), NumParameters(NumParams) {
1637 std::uninitialized_copy(Params, Params + NumParams,
1638 getTrailingObjects<VarDecl *>());
1645 return new (Context.
Allocate(totalSizeToAlloc<VarDecl *>(Params.size())))
1651 unsigned NumParams) {
1652 return new (Context.
Allocate(totalSizeToAlloc<VarDecl *>(NumParams)))
1657 unsigned ManglingNumber) {
1664 if (!
State.is<ExtraState *>()) {
1670 auto ES =
State.get<ExtraState *>();
1671 ES->ExtendingDecl = ExtendedBy;
1672 ES->ManglingNumber = ManglingNumber;
1684 Loc(Loc), RParenLoc(RParenLoc) {
1689 auto **ToArgs = getTrailingObjects<TypeSourceInfo *>();
1691 for (
unsigned I = 0, N = Args.size(); I != N; ++I) {
1699 ToArgs[I] = Args[I];
1709 void *Mem = C.
Allocate(totalSizeToAlloc<TypeSourceInfo *>(Args.size()));
1710 return new (Mem)
TypeTraitExpr(T, Loc, Kind, Args, RParenLoc, Value);
1715 void *Mem = C.
Allocate(totalSizeToAlloc<TypeSourceInfo *>(NumArgs));
1719 CUDAKernelCallExpr::CUDAKernelCallExpr(
Expr *Fn,
CallExpr *Config,
1722 unsigned MinNumArgs)
1723 :
CallExpr(CUDAKernelCallExprClass, Fn, Config, Args, Ty, VK,
1724 RP, MinNumArgs, NotADL) {}
1726 CUDAKernelCallExpr::CUDAKernelCallExpr(
unsigned NumArgs,
EmptyShell Empty)
1727 :
CallExpr(CUDAKernelCallExprClass, END_PREARG, NumArgs,
1735 unsigned NumArgs = std::max<unsigned>(Args.size(), MinNumArgs);
1736 unsigned SizeOfTrailingObjects =
1747 unsigned SizeOfTrailingObjects =
1754 ConceptSpecializationExpr::ConceptSpecializationExpr(
ASTContext &
C,
1762 !IsSatisfied.hasValue(),
1765 NestedNameSpec(NNS), TemplateKWLoc(TemplateKWLoc),
1766 ConceptNameLoc(ConceptNameLoc), FoundDecl(FoundDecl),
1767 NamedConcept(NamedConcept, IsSatisfied ? *IsSatisfied :
true),
1768 NumTemplateArgs(ConvertedArgs.size()) {
1770 setTemplateArguments(ArgsAsWritten, ConvertedArgs);
1773 ConceptSpecializationExpr::ConceptSpecializationExpr(
EmptyShell Empty,
1774 unsigned NumTemplateArgs)
1775 :
Expr(ConceptSpecializationExprClass, Empty),
1776 NumTemplateArgs(NumTemplateArgs) { }
1781 assert(Converted.size() == NumTemplateArgs);
1782 assert(!this->ArgsAsWritten &&
"setTemplateArguments can only be used once");
1783 this->ArgsAsWritten = ArgsAsWritten;
1784 std::uninitialized_copy(Converted.begin(), Converted.end(),
1785 getTrailingObjects<TemplateArgument>());
1786 bool IsInstantiationDependent =
false;
1787 bool ContainsUnexpandedParameterPack =
false;
1789 if (LocInfo.getArgument().isInstantiationDependent())
1790 IsInstantiationDependent =
true;
1791 if (LocInfo.getArgument().containsUnexpandedParameterPack())
1792 ContainsUnexpandedParameterPack =
true;
1793 if (ContainsUnexpandedParameterPack && IsInstantiationDependent)
1798 assert(!NestedNameSpec ||
1799 (!NestedNameSpec.getNestedNameSpecifier()->isInstantiationDependent() &&
1800 !NestedNameSpec.getNestedNameSpecifier()
1801 ->containsUnexpandedParameterPack()));
1805 "should not be value-dependent");
1817 void *Buffer = C.
Allocate(totalSizeToAlloc<TemplateArgument>(
1818 ConvertedArgs.size()));
1820 ConceptNameLoc, FoundDecl,
1821 NamedConcept, ArgsAsWritten,
1822 ConvertedArgs, IsSatisfied);
1827 unsigned NumTemplateArgs) {
1828 void *Buffer = C.
Allocate(totalSizeToAlloc<TemplateArgument>(
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.
void setTemplateArguments(const ASTTemplateArgumentListInfo *ArgsAsWritten, ArrayRef< TemplateArgument > Converted)
Set new template arguments for this concept specialization.
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...
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
Represents an explicit template argument list in C++, e.g., the "<int>" in "sort<int>".
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...
llvm::ArrayRef< TemplateArgumentLoc > arguments() const
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.
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...
ASTContext & getASTContext() const LLVM_READONLY
Represents a static or instance method of a struct/union/class.
static ExprWithCleanups * Create(const ASTContext &C, EmptyShell empty, unsigned numObjects)
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.
void setExtendingDecl(const ValueDecl *ExtendedBy, unsigned ManglingNumber)
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)
CXXOperatorCallExprBitfields CXXOperatorCallExprBits
Represents the specialization of a concept - evaluates to a prvalue of type bool. ...
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.
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.
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.
static ConceptSpecializationExpr * Create(ASTContext &C, NestedNameSpecifierLoc NNS, SourceLocation TemplateKWLoc, SourceLocation ConceptNameLoc, NamedDecl *FoundDecl, ConceptDecl *NamedConcept, const ASTTemplateArgumentListInfo *ArgsAsWritten, ArrayRef< TemplateArgument > ConvertedArgs, Optional< bool > IsSatisfied)
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)