34 #include "llvm/ADT/ArrayRef.h"
35 #include "llvm/Support/Casting.h"
36 #include "llvm/Support/ErrorHandling.h"
42 using namespace clang;
57 case OO_Call:
case OO_Subscript:
70 bool SkippedNot =
false;
71 if (
auto *NotEq = dyn_cast<UnaryOperator>(E)) {
72 assert(NotEq->getOpcode() == UO_LNot);
78 if (
auto *BO = dyn_cast<BinaryOperator>(E)) {
79 assert(!SkippedNot || BO->getOpcode() == BO_EQ);
80 Result.Opcode = SkippedNot ? BO_NE : BO->getOpcode();
81 Result.LHS = BO->getLHS();
82 Result.RHS = BO->getRHS();
83 Result.InnerBinOp = BO;
84 }
else if (
auto *BO = dyn_cast<CXXOperatorCallExpr>(E)) {
85 assert(!SkippedNot || BO->getOperator() == OO_EqualEqual);
86 assert(BO->isInfixBinaryOp());
87 switch (BO->getOperator()) {
88 case OO_Less: Result.Opcode = BO_LT;
break;
89 case OO_LessEqual: Result.Opcode = BO_LE;
break;
90 case OO_Greater: Result.Opcode = BO_GT;
break;
91 case OO_GreaterEqual: Result.Opcode = BO_GE;
break;
92 case OO_Spaceship: Result.Opcode = BO_Cmp;
break;
93 case OO_EqualEqual: Result.Opcode = SkippedNot ? BO_NE : BO_EQ;
break;
94 default: llvm_unreachable(
"unexpected binop in rewritten operator expr");
96 Result.LHS = BO->getArg(0);
97 Result.RHS = BO->getArg(1);
98 Result.InnerBinOp = BO;
100 llvm_unreachable(
"unexpected rewritten operator form");
106 std::swap(Result.LHS, Result.RHS);
109 if (Result.Opcode == BO_EQ || Result.Opcode == BO_NE)
113 E = Result.LHS->IgnoreImplicitAsWritten();
114 if (
auto *BO = dyn_cast<BinaryOperator>(E)) {
115 assert(BO->getOpcode() == BO_Cmp);
116 Result.LHS = BO->getLHS();
117 Result.RHS = BO->getRHS();
118 Result.InnerBinOp = BO;
119 }
else if (
auto *BO = dyn_cast<CXXOperatorCallExpr>(E)) {
120 assert(BO->getOperator() == OO_Spaceship);
121 Result.LHS = BO->getArg(0);
122 Result.RHS = BO->getArg(1);
123 Result.InnerBinOp = BO;
125 llvm_unreachable(
"unexpected rewritten operator form");
130 std::swap(Result.LHS, Result.RHS);
143 if (RD->isPolymorphic() && E->
isGLValue())
150 assert(!
isTypeOperand() &&
"Cannot call isMostDerived for typeid(type)");
152 if (
const auto *DRE = dyn_cast<DeclRefExpr>(E)) {
153 QualType Ty = DRE->getDecl()->getType();
162 assert(
isTypeOperand() &&
"Cannot call getTypeOperand for typeid(expr)");
169 assert(
isTypeOperand() &&
"Cannot call getTypeOperand for __uuidof(expr)");
181 CXXNewExpr::CXXNewExpr(
bool IsGlobalNew,
FunctionDecl *OperatorNew,
183 bool UsualArrayDeleteWantsSize,
186 InitializationStyle InitializationStyle,
191 OperatorNew(OperatorNew), OperatorDelete(OperatorDelete),
192 AllocatedTypeInfo(AllocatedTypeInfo), Range(Range),
193 DirectInitRange(DirectInitRange) {
195 assert((Initializer !=
nullptr || InitializationStyle == NoInit) &&
196 "Only NoInit can have no initializer!");
201 CXXNewExprBits.UsualArrayDeleteWantsSize = UsualArrayDeleteWantsSize;
204 bool IsParenTypeId = TypeIdParens.
isValid();
209 getTrailingObjects<Stmt *>()[arraySizeOffset()] = *ArraySize;
211 getTrailingObjects<Stmt *>()[initExprOffset()] =
Initializer;
212 for (
unsigned I = 0; I != PlacementArgs.size(); ++I)
213 getTrailingObjects<Stmt *>()[placementNewArgsOffset() + I] =
216 getTrailingObjects<SourceRange>()[0] = TypeIdParens;
218 switch (getInitializationStyle()) {
234 CXXNewExpr::CXXNewExpr(EmptyShell Empty,
bool IsArray,
235 unsigned NumPlacementArgs,
bool IsParenTypeId)
236 :
Expr(CXXNewExprClass, Empty) {
245 bool ShouldPassAlignment,
bool UsualArrayDeleteWantsSize,
251 bool IsArray = ArraySize.hasValue();
253 unsigned NumPlacementArgs = PlacementArgs.size();
254 bool IsParenTypeId = TypeIdParens.
isValid();
256 Ctx.
Allocate(totalSizeToAlloc<Stmt *, SourceRange>(
257 IsArray + HasInit + NumPlacementArgs, IsParenTypeId),
260 CXXNewExpr(IsGlobalNew, OperatorNew, OperatorDelete, ShouldPassAlignment,
261 UsualArrayDeleteWantsSize, PlacementArgs, TypeIdParens,
263 AllocatedTypeInfo, Range, DirectInitRange);
267 bool HasInit,
unsigned NumPlacementArgs,
268 bool IsParenTypeId) {
270 Ctx.
Allocate(totalSizeToAlloc<Stmt *, SourceRange>(
271 IsArray + HasInit + NumPlacementArgs, IsParenTypeId),
293 while (
const auto *ICE = dyn_cast<ImplicitCastExpr>(Arg)) {
294 if (ICE->getCastKind() == CK_DerivedToBase ||
295 ICE->getCastKind() == CK_UncheckedDerivedToBase ||
296 ICE->getCastKind() == CK_NoOp) {
297 assert((ICE->getCastKind() == CK_NoOp ||
299 "only a destroying operator delete can have a converted arg");
300 Arg = ICE->getSubExpr();
325 :
Expr(CXXPseudoDestructorExprClass, Context.BoundMemberTy,
VK_PRValue,
328 OperatorLoc(OperatorLoc), QualifierLoc(QualifierLoc),
329 ScopeType(ScopeType), ColonColonLoc(ColonColonLoc), TildeLoc(TildeLoc),
330 DestroyedType(DestroyedType) {
336 return TInfo->getType();
344 End = TInfo->getTypeLoc().getLocalSourceRange().getEnd();
349 UnresolvedLookupExpr::UnresolvedLookupExpr(
355 :
OverloadExpr(UnresolvedLookupExprClass, Context, QualifierLoc,
358 NamingClass(NamingClass) {
363 UnresolvedLookupExpr::UnresolvedLookupExpr(EmptyShell Empty,
365 bool HasTemplateKWAndArgsInfo)
366 :
OverloadExpr(UnresolvedLookupExprClass, Empty, NumResults,
367 HasTemplateKWAndArgsInfo) {}
389 assert(Args || TemplateKWLoc.
isValid());
391 unsigned NumTemplateArgs = Args ? Args->
size() : 0;
397 TemplateKWLoc, NameInfo, RequiresADL,
402 const ASTContext &Context,
unsigned NumResults,
403 bool HasTemplateKWAndArgsInfo,
unsigned NumTemplateArgs) {
404 assert(NumTemplateArgs == 0 || HasTemplateKWAndArgsInfo);
407 NumResults, HasTemplateKWAndArgsInfo, NumTemplateArgs);
420 bool KnownInstantiationDependent,
421 bool KnownContainsUnexpandedParameterPack)
423 QualifierLoc(QualifierLoc) {
427 (TemplateArgs != nullptr ) || TemplateKWLoc.
isValid();
440 }
else if (TemplateKWLoc.
isValid()) {
445 KnownInstantiationDependent,
446 KnownContainsUnexpandedParameterPack));
452 bool HasTemplateKWAndArgsInfo)
459 DependentScopeDeclRefExpr::DependentScopeDeclRefExpr(
464 QualifierLoc(QualifierLoc), NameInfo(NameInfo) {
466 (Args !=
nullptr) || TemplateKWLoc.
isValid();
469 getTrailingObjects<ASTTemplateKWAndArgsInfo>()->initializeFrom(
470 TemplateKWLoc, *Args, getTrailingObjects<TemplateArgumentLoc>(), Deps);
471 }
else if (TemplateKWLoc.
isValid()) {
472 getTrailingObjects<ASTTemplateKWAndArgsInfo>()->initializeFrom(
482 assert(QualifierLoc &&
"should be created for dependent qualifiers");
483 bool HasTemplateKWAndArgsInfo = Args || TemplateKWLoc.
isValid();
485 totalSizeToAlloc<ASTTemplateKWAndArgsInfo, TemplateArgumentLoc>(
486 HasTemplateKWAndArgsInfo, Args ? Args->
size() : 0);
489 TemplateKWLoc, NameInfo, Args);
494 bool HasTemplateKWAndArgsInfo,
495 unsigned NumTemplateArgs) {
496 assert(NumTemplateArgs == 0 || HasTemplateKWAndArgsInfo);
498 totalSizeToAlloc<ASTTemplateKWAndArgsInfo, TemplateArgumentLoc>(
499 HasTemplateKWAndArgsInfo, NumTemplateArgs);
505 HasTemplateKWAndArgsInfo;
510 if (isa<CXXTemporaryObjectExpr>(
this))
511 return cast<CXXTemporaryObjectExpr>(
this)->getBeginLoc();
516 if (isa<CXXTemporaryObjectExpr>(
this))
517 return cast<CXXTemporaryObjectExpr>(
this)->getEndLoc();
519 if (ParenOrBraceRange.
isValid())
520 return ParenOrBraceRange.
getEnd();
543 :
CallExpr(CXXOperatorCallExprClass, Fn, {}, Args, Ty, VK,
544 OperatorLoc, FPFeatures, 0, UsesADL) {
545 CXXOperatorCallExprBits.OperatorKind = OpKind;
547 (CXXOperatorCallExprBits.OperatorKind ==
static_cast<unsigned>(OpKind)) &&
548 "OperatorKind overflow!");
549 Range = getSourceRangeImpl();
552 CXXOperatorCallExpr::CXXOperatorCallExpr(
unsigned NumArgs,
bool HasFPFeatures,
554 :
CallExpr(CXXOperatorCallExprClass, 0, NumArgs,
555 HasFPFeatures, Empty) {}
564 unsigned NumArgs = Args.size();
578 unsigned SizeOfTrailingObjects =
585 SourceRange CXXOperatorCallExpr::getSourceRangeImpl()
const {
587 if (
Kind == OO_PlusPlus ||
Kind == OO_MinusMinus) {
594 }
else if (
Kind == OO_Arrow) {
596 }
else if (
Kind == OO_Call) {
598 }
else if (
Kind == OO_Subscript) {
614 :
CallExpr(CXXMemberCallExprClass, Fn, {}, Args, Ty, VK, RP,
617 CXXMemberCallExpr::CXXMemberCallExpr(
unsigned NumArgs,
bool HasFPFeatures,
619 :
CallExpr(CXXMemberCallExprClass, 0, NumArgs, HasFPFeatures,
627 unsigned MinNumArgs) {
629 unsigned NumArgs = std::max<unsigned>(Args.size(), MinNumArgs);
643 unsigned SizeOfTrailingObjects =
652 if (
const auto *MemExpr = dyn_cast<MemberExpr>(Callee))
653 return MemExpr->getBase();
654 if (
const auto *BO = dyn_cast<BinaryOperator>(Callee))
655 if (BO->getOpcode() == BO_PtrMemD || BO->getOpcode() == BO_PtrMemI)
671 return cast<CXXMethodDecl>(MemExpr->getMemberDecl());
698 case CXXStaticCastExprClass:
return "static_cast";
699 case CXXDynamicCastExprClass:
return "dynamic_cast";
700 case CXXReinterpretCastExprClass:
return "reinterpret_cast";
701 case CXXConstCastExprClass:
return "const_cast";
702 case CXXAddrspaceCastExprClass:
return "addrspace_cast";
703 default:
return "<invalid cast>";
713 unsigned PathSize = (BasePath ? BasePath->size() : 0);
715 C.Allocate(totalSizeToAlloc<CXXBaseSpecifier *, FPOptionsOverride>(
718 FPO, L, RParenLoc, AngleBrackets);
720 std::uninitialized_copy_n(BasePath->data(), BasePath->size(),
727 bool HasFPFeatures) {
729 C.Allocate(totalSizeToAlloc<CXXBaseSpecifier *, FPOptionsOverride>(
730 PathSize, HasFPFeatures));
742 unsigned PathSize = (BasePath ? BasePath->size() : 0);
743 void *Buffer = C.Allocate(totalSizeToAlloc<CXXBaseSpecifier *>(PathSize));
746 RParenLoc, AngleBrackets);
748 std::uninitialized_copy_n(BasePath->data(), BasePath->size(),
755 void *Buffer = C.Allocate(totalSizeToAlloc<CXXBaseSpecifier *>(PathSize));
783 if (!SrcRD->hasAttr<FinalAttr>())
789 return !DestRD->isDerivedFrom(SrcRD);
799 unsigned PathSize = (BasePath ? BasePath->size() : 0);
800 void *Buffer = C.Allocate(totalSizeToAlloc<CXXBaseSpecifier *>(PathSize));
803 RParenLoc, AngleBrackets);
805 std::uninitialized_copy_n(BasePath->data(), BasePath->size(),
812 void *Buffer = C.Allocate(totalSizeToAlloc<CXXBaseSpecifier *>(PathSize));
822 return new (C)
CXXConstCastExpr(T, VK, Op, WrittenTy, L, RParenLoc, AngleBrackets);
846 unsigned PathSize = (BasePath ? BasePath->size() : 0);
848 C.Allocate(totalSizeToAlloc<CXXBaseSpecifier *, FPOptionsOverride>(
850 auto *E =
new (Buffer)
853 std::uninitialized_copy_n(BasePath->data(), BasePath->size(),
860 bool HasFPFeatures) {
862 C.Allocate(totalSizeToAlloc<CXXBaseSpecifier *, FPOptionsOverride>(
863 PathSize, HasFPFeatures));
881 :
CallExpr(UserDefinedLiteralClass, Fn, {}, Args, Ty, VK,
882 LitEndLoc, FPFeatures, 0, NotADL),
883 UDSuffixLoc(SuffixLoc) {}
885 UserDefinedLiteral::UserDefinedLiteral(
unsigned NumArgs,
bool HasFPFeatures,
887 :
CallExpr(UserDefinedLiteralClass, 0, NumArgs,
888 HasFPFeatures, Empty) {}
897 unsigned NumArgs = Args.size();
911 unsigned SizeOfTrailingObjects =
925 assert(
getNumArgs() == 1 &&
"unexpected #args in literal operator call");
927 cast<FunctionDecl>(
getCalleeDecl())->getParamDecl(0)->getType();
937 llvm_unreachable(
"unknown kind of literal operator");
949 return cast<FunctionDecl>(
getCalleeDecl())->getLiteralIdentifier();
952 CXXDefaultInitExpr::CXXDefaultInitExpr(
const ASTContext &Ctx,
955 :
Expr(CXXDefaultInitExprClass, Ty.getNonLValueExprType(Ctx),
957 : Ty->isRValueReferenceType() ?
VK_XValue
960 Field(Field), UsedContext(UsedContext) {
962 assert(Field->hasInClassInitializer());
977 "Expression bound to a temporary must have record or array type!");
982 CXXTemporaryObjectExpr::CXXTemporaryObjectExpr(
985 bool HadMultipleCandidates,
bool ListInitialization,
986 bool StdInitListInitialization,
bool ZeroInitialization)
988 CXXTemporaryObjectExprClass, Ty, TSI->getTypeLoc().getBeginLoc(),
989 Cons,
false, Args, HadMultipleCandidates,
990 ListInitialization, StdInitListInitialization, ZeroInitialization,
996 CXXTemporaryObjectExpr::CXXTemporaryObjectExpr(EmptyShell Empty,
1003 bool HadMultipleCandidates,
bool ListInitialization,
1004 bool StdInitListInitialization,
bool ZeroInitialization) {
1010 Cons, Ty, TSI, Args, ParenOrBraceRange, HadMultipleCandidates,
1011 ListInitialization, StdInitListInitialization, ZeroInitialization);
1037 bool HadMultipleCandidates,
bool ListInitialization,
1038 bool StdInitListInitialization,
bool ZeroInitialization,
1044 CXXConstructExprClass, Ty, Loc, Ctor, Elidable, Args,
1045 HadMultipleCandidates, ListInitialization, StdInitListInitialization,
1046 ZeroInitialization, ConstructKind, ParenOrBraceRange);
1061 bool ListInitialization,
bool StdInitListInitialization,
1065 ParenOrBraceRange(ParenOrBraceRange), NumArgs(Args.size()) {
1074 Stmt **TrailingArgs = getTrailingArgs();
1075 for (
unsigned I = 0, N = Args.size(); I != N; ++I) {
1076 assert(Args[I] &&
"NULL argument in CXXConstructExpr!");
1077 TrailingArgs[I] = Args[I];
1081 if (SC == CXXConstructExprClass)
1087 :
Expr(SC, Empty), NumArgs(NumArgs) {}
1092 : DeclAndBits(Var, 0), Loc(Loc), EllipsisLoc(EllipsisLoc) {
1095 Bits |= Capture_Implicit;
1099 Bits |= Capture_ByCopy;
1102 assert(!Var &&
"'this' capture cannot have a variable!");
1103 Bits |= Capture_This;
1107 Bits |= Capture_ByCopy;
1110 assert(Var &&
"capture must have a variable!");
1113 assert(!Var &&
"VLA type capture cannot have a variable!");
1116 DeclAndBits.setInt(Bits);
1122 bool CapByCopy = DeclAndBits.getInt() & Capture_ByCopy;
1133 bool ContainsUnexpandedParameterPack)
1135 IntroducerRange(IntroducerRange), CaptureDefaultLoc(CaptureDefaultLoc),
1136 ClosingBrace(ClosingBrace) {
1137 LambdaExprBits.NumCaptures = CaptureInits.size();
1138 LambdaExprBits.CaptureDefault = CaptureDefault;
1139 LambdaExprBits.ExplicitParams = ExplicitParams;
1140 LambdaExprBits.ExplicitResultType = ExplicitResultType;
1144 assert(capture_size() == Class->capture_size() &&
"Wrong number of captures");
1145 assert(getCaptureDefault() == Class->getLambdaCaptureDefault());
1148 Stmt **Stored = getStoredStmts();
1149 for (
unsigned I = 0, N = CaptureInits.size(); I != N; ++I)
1150 *Stored++ = CaptureInits[I];
1153 *Stored++ = getCallOperator()->getBody();
1158 LambdaExpr::LambdaExpr(EmptyShell Empty,
unsigned NumCaptures)
1159 :
Expr(LambdaExprClass, Empty) {
1160 LambdaExprBits.NumCaptures = NumCaptures;
1164 getStoredStmts()[NumCaptures] =
nullptr;
1171 bool ExplicitParams,
bool ExplicitResultType,
1174 bool ContainsUnexpandedParameterPack) {
1179 unsigned Size = totalSizeToAlloc<Stmt *>(CaptureInits.size() + 1);
1180 void *Mem = Context.
Allocate(Size);
1182 LambdaExpr(T, IntroducerRange, CaptureDefault, CaptureDefaultLoc,
1183 ExplicitParams, ExplicitResultType, CaptureInits, ClosingBrace,
1184 ContainsUnexpandedParameterPack);
1188 unsigned NumCaptures) {
1189 unsigned Size = totalSizeToAlloc<Stmt *>(NumCaptures + 1);
1190 void *Mem = C.Allocate(Size);
1194 void LambdaExpr::initBodyIfNeeded()
const {
1208 if (
const auto *CoroBody = dyn_cast<CoroutineBodyStmt>(Body))
1209 return cast<CompoundStmt>(CoroBody->getBody());
1210 return cast<CompoundStmt>(Body);
1214 return (C->capturesVariable() && C->getCapturedVar()->isInitCapture() &&
1235 struct CXXRecordDecl::LambdaDefinitionData &Data
1237 return Data.Captures + Data.NumExplicitCaptures;
1297 ExprWithCleanups::ExprWithCleanups(
Expr *subexpr,
1298 bool CleanupsHaveSideEffects,
1300 :
FullExpr(ExprWithCleanupsClass, subexpr) {
1303 for (
unsigned i = 0, e = objects.size(); i != e; ++i)
1304 getTrailingObjects<CleanupObject>()[i] = objects[i];
1308 bool CleanupsHaveSideEffects,
1310 void *buffer =
C.Allocate(totalSizeToAlloc<CleanupObject>(objects.size()),
1316 ExprWithCleanups::ExprWithCleanups(EmptyShell empty,
unsigned numObjects)
1317 :
FullExpr(ExprWithCleanupsClass, empty) {
1323 unsigned numObjects) {
1324 void *buffer =
C.Allocate(totalSizeToAlloc<CleanupObject>(numObjects),
1329 CXXUnresolvedConstructExpr::CXXUnresolvedConstructExpr(
QualType T,
1334 :
Expr(CXXUnresolvedConstructExprClass, T,
1335 (TSI->getType()->isLValueReferenceType() ?
VK_LValue
1336 : TSI->getType()->isRValueReferenceType() ?
VK_XValue
1339 TSI(TSI), LParenLoc(LParenLoc), RParenLoc(RParenLoc) {
1341 auto **StoredArgs = getTrailingObjects<Expr *>();
1342 for (
unsigned I = 0; I != Args.size(); ++I)
1343 StoredArgs[I] = Args[I];
1350 void *Mem = Context.
Allocate(totalSizeToAlloc<Expr *>(Args.size()));
1358 void *Mem = Context.
Allocate(totalSizeToAlloc<Expr *>(NumArgs));
1366 CXXDependentScopeMemberExpr::CXXDependentScopeMemberExpr(
1372 :
Expr(CXXDependentScopeMemberExprClass, Ctx.DependentTy,
VK_LValue,
1374 Base(
Base), BaseType(BaseType), QualifierLoc(QualifierLoc),
1375 MemberNameInfo(MemberNameInfo) {
1378 (TemplateArgs !=
nullptr) || TemplateKWLoc.
isValid();
1380 FirstQualifierFoundInScope !=
nullptr;
1385 getTrailingObjects<ASTTemplateKWAndArgsInfo>()->initializeFrom(
1386 TemplateKWLoc, *TemplateArgs, getTrailingObjects<TemplateArgumentLoc>(),
1388 }
else if (TemplateKWLoc.
isValid()) {
1389 getTrailingObjects<ASTTemplateKWAndArgsInfo>()->initializeFrom(
1393 if (hasFirstQualifierFoundInScope())
1394 *getTrailingObjects<NamedDecl *>() = FirstQualifierFoundInScope;
1398 CXXDependentScopeMemberExpr::CXXDependentScopeMemberExpr(
1399 EmptyShell Empty,
bool HasTemplateKWAndArgsInfo,
1400 bool HasFirstQualifierFoundInScope)
1401 :
Expr(CXXDependentScopeMemberExprClass, Empty) {
1403 HasTemplateKWAndArgsInfo;
1405 HasFirstQualifierFoundInScope;
1414 bool HasTemplateKWAndArgsInfo =
1415 (TemplateArgs !=
nullptr) || TemplateKWLoc.
isValid();
1416 unsigned NumTemplateArgs = TemplateArgs ? TemplateArgs->
size() : 0;
1417 bool HasFirstQualifierFoundInScope = FirstQualifierFoundInScope !=
nullptr;
1421 HasTemplateKWAndArgsInfo, NumTemplateArgs, HasFirstQualifierFoundInScope);
1425 Ctx,
Base, BaseType, IsArrow, OperatorLoc, QualifierLoc, TemplateKWLoc,
1426 FirstQualifierFoundInScope, MemberNameInfo, TemplateArgs);
1430 const ASTContext &Ctx,
bool HasTemplateKWAndArgsInfo,
1431 unsigned NumTemplateArgs,
bool HasFirstQualifierFoundInScope) {
1432 assert(NumTemplateArgs == 0 || HasTemplateKWAndArgsInfo);
1436 HasTemplateKWAndArgsInfo, NumTemplateArgs, HasFirstQualifierFoundInScope);
1440 EmptyShell(), HasTemplateKWAndArgsInfo, HasFirstQualifierFoundInScope);
1447 if (isa<UnresolvedUsingValueDecl>(
decl))
1452 if (cast<CXXMethodDecl>(
decl->getUnderlyingDecl()->getAsFunction())
1455 }
while (++begin != end);
1460 UnresolvedMemberExpr::UnresolvedMemberExpr(
1468 UnresolvedMemberExprClass, Context, QualifierLoc, TemplateKWLoc,
1469 MemberNameInfo, TemplateArgs,
Begin,
End,
1471 ((
Base &&
Base->isTypeDependent()) || BaseType->isDependentType()),
1472 ((
Base &&
Base->isInstantiationDependent()) ||
1473 BaseType->isInstantiationDependentType()),
1475 ((
Base &&
Base->containsUnexpandedParameterPack()) ||
1476 BaseType->containsUnexpandedParameterPack())),
1477 Base(
Base), BaseType(BaseType), OperatorLoc(OperatorLoc) {
1478 UnresolvedMemberExprBits.IsArrow = IsArrow;
1479 UnresolvedMemberExprBits.HasUnresolvedUsing = HasUnresolvedUsing;
1487 UnresolvedMemberExpr::UnresolvedMemberExpr(EmptyShell Empty,
1488 unsigned NumResults,
1489 bool HasTemplateKWAndArgsInfo)
1490 :
OverloadExpr(UnresolvedMemberExprClass, Empty, NumResults,
1491 HasTemplateKWAndArgsInfo) {}
1493 bool UnresolvedMemberExpr::isImplicitAccess()
const {
1508 bool HasTemplateKWAndArgsInfo = TemplateArgs || TemplateKWLoc.
isValid();
1509 unsigned NumTemplateArgs = TemplateArgs ? TemplateArgs->
size() : 0;
1512 NumResults, HasTemplateKWAndArgsInfo, NumTemplateArgs);
1515 Context, HasUnresolvedUsing,
Base, BaseType, IsArrow, OperatorLoc,
1516 QualifierLoc, TemplateKWLoc, MemberNameInfo, TemplateArgs,
Begin,
End);
1520 const ASTContext &Context,
unsigned NumResults,
1521 bool HasTemplateKWAndArgsInfo,
unsigned NumTemplateArgs) {
1522 assert(NumTemplateArgs == 0 || HasTemplateKWAndArgsInfo);
1525 NumResults, HasTemplateKWAndArgsInfo, NumTemplateArgs);
1541 assert(T &&
"qualifier in member expression does not name type");
1543 assert(Record &&
"qualifier in member expression does not name record");
1552 assert(Record &&
"base of member expression does not name record");
1565 Context.
Allocate(totalSizeToAlloc<TemplateArgument>(PartialArgs.size()));
1567 PackLoc, RParenLoc, Length, PartialArgs);
1571 unsigned NumPartialArgs) {
1573 Context.
Allocate(totalSizeToAlloc<TemplateArgument>(NumPartialArgs));
1586 SubstNonTypeTemplateParmPackExpr::SubstNonTypeTemplateParmPackExpr(
1589 :
Expr(SubstNonTypeTemplateParmPackExprClass, T, ValueKind,
OK_Ordinary),
1590 Param(Param), Arguments(ArgPack.pack_begin()),
1591 NumArguments(ArgPack.pack_size()), NameLoc(NameLoc) {
1593 ExprDependence::UnexpandedPack);
1600 FunctionParmPackExpr::FunctionParmPackExpr(
QualType T,
VarDecl *ParamPack,
1605 ParamPack(ParamPack), NameLoc(NameLoc), NumParameters(NumParams) {
1607 std::uninitialized_copy(Params, Params + NumParams,
1608 getTrailingObjects<VarDecl *>());
1610 ExprDependence::UnexpandedPack);
1617 return new (Context.
Allocate(totalSizeToAlloc<VarDecl *>(Params.size())))
1623 unsigned NumParams) {
1624 return new (Context.
Allocate(totalSizeToAlloc<VarDecl *>(NumParams)))
1629 QualType T,
Expr *Temporary,
bool BoundToLvalueReference,
1631 :
Expr(MaterializeTemporaryExprClass, T,
1635 MTD->ExprWithTemporary = Temporary;
1643 unsigned ManglingNumber) {
1652 cast<Expr>(
State.get<
Stmt *>()), ExtendedBy, ManglingNumber);
1655 ES->ExtendingDecl = ExtendedBy;
1656 ES->ManglingNumber = ManglingNumber;
1670 VD->isUsableInConstantExpressions(Context);
1677 RParenLoc(RParenLoc) {
1681 "TypeTraitExprBits.Kind overflow!");
1685 "TypeTraitExprBits.NumArgs overflow!");
1687 auto **ToArgs = getTrailingObjects<TypeSourceInfo *>();
1688 for (
unsigned I = 0, N = Args.size(); I != N; ++I)
1689 ToArgs[I] = Args[I];
1700 void *Mem =
C.Allocate(totalSizeToAlloc<TypeSourceInfo *>(Args.size()));
1706 void *Mem =
C.Allocate(totalSizeToAlloc<TypeSourceInfo *>(NumArgs));
1710 CUDAKernelCallExpr::CUDAKernelCallExpr(
Expr *Fn,
CallExpr *Config,
1714 unsigned MinNumArgs)
1715 :
CallExpr(CUDAKernelCallExprClass, Fn, Config, Args, Ty, VK,
1716 RP, FPFeatures, MinNumArgs, NotADL) {}
1718 CUDAKernelCallExpr::CUDAKernelCallExpr(
unsigned NumArgs,
bool HasFPFeatures,
1720 :
CallExpr(CUDAKernelCallExprClass, END_PREARG, NumArgs,
1721 HasFPFeatures, Empty) {}
1727 unsigned MinNumArgs) {
1729 unsigned NumArgs = std::max<unsigned>(Args.size(), MinNumArgs);
1744 END_PREARG, NumArgs, HasFPFeatures);