21 using namespace clang;
37 if (RD->isPolymorphic() && E->
isGLValue())
44 assert(
isTypeOperand() &&
"Cannot call getTypeOperand for typeid(expr)");
51 assert(
isTypeOperand() &&
"Cannot call getTypeOperand for __uuidof(expr)");
59 bool *RDHasMultipleGUIDsPtr) {
76 dyn_cast<ClassTemplateSpecializationDecl>(RD)) {
78 const UuidAttr *UuidForRD =
nullptr;
81 bool SeenMultipleGUIDs =
false;
83 const UuidAttr *UuidForTA =
nullptr;
96 UuidForRD = UuidForTA;
97 else if (UuidForRD != UuidForTA)
98 SeenMultipleGUIDs =
true;
102 if (SeenMultipleGUIDs) {
103 if (RDHasMultipleGUIDsPtr)
104 *RDHasMultipleGUIDsPtr =
true;
125 Uuid =
"00000000-0000-0000-0000-000000000000";
138 bool usualArrayDeleteWantsSize,
146 ty->isDependentType(), ty->isDependentType(),
147 ty->isInstantiationDependentType(),
148 ty->containsUnexpandedParameterPack()),
149 SubExprs(nullptr), OperatorNew(operatorNew), OperatorDelete(operatorDelete),
150 AllocatedTypeInfo(allocatedTypeInfo), TypeIdParens(typeIdParens),
151 Range(Range), DirectInitRange(directInitRange),
152 GlobalNew(globalNew), UsualArrayDeleteWantsSize(usualArrayDeleteWantsSize) {
153 assert((initializer !=
nullptr || initializationStyle ==
NoInit) &&
154 "Only NoInit can have no initializer.");
155 StoredInitializationStyle = initializer ? initializationStyle + 1 : 0;
157 initializer !=
nullptr);
161 ExprBits.InstantiationDependent =
true;
164 ExprBits.ContainsUnexpandedParameterPack =
true;
166 SubExprs[i++] = arraySize;
171 ExprBits.InstantiationDependent =
true;
174 ExprBits.ContainsUnexpandedParameterPack =
true;
176 SubExprs[i++] = initializer;
179 for (
unsigned j = 0; j != placementArgs.size(); ++j) {
181 ExprBits.InstantiationDependent =
true;
183 ExprBits.ContainsUnexpandedParameterPack =
true;
185 SubExprs[i++] = placementArgs[j];
201 unsigned numPlaceArgs,
bool hasInitializer){
202 assert(SubExprs ==
nullptr &&
"SubExprs already allocated");
204 NumPlacementArgs = numPlaceArgs;
206 unsigned TotalSize = Array + hasInitializer + NumPlacementArgs;
207 SubExprs =
new (
C)
Stmt*[TotalSize];
240 :
Expr(CXXPseudoDestructorExprClass,
241 Context.BoundMemberTy,
243 (Base->isTypeDependent() ||
244 (DestroyedType.getTypeSourceInfo() &&
245 DestroyedType.getTypeSourceInfo()->getType()->isDependentType())),
246 Base->isValueDependent(),
247 (Base->isInstantiationDependent() ||
249 QualifierLoc.getNestedNameSpecifier()->isInstantiationDependent()) ||
251 ScopeType->getType()->isInstantiationDependentType()) ||
252 (DestroyedType.getTypeSourceInfo() &&
253 DestroyedType.getTypeSourceInfo()->getType()
254 ->isInstantiationDependentType())),
256 (Base->containsUnexpandedParameterPack() ||
258 QualifierLoc.getNestedNameSpecifier()
259 ->containsUnexpandedParameterPack()) ||
261 ScopeType->getType()->containsUnexpandedParameterPack()) ||
262 (DestroyedType.getTypeSourceInfo() &&
263 DestroyedType.getTypeSourceInfo()->getType()
264 ->containsUnexpandedParameterPack()))),
265 Base(static_cast<
Stmt *>(Base)), IsArrow(isArrow),
266 OperatorLoc(OperatorLoc), QualifierLoc(QualifierLoc),
267 ScopeType(ScopeType), ColonColonLoc(ColonColonLoc), TildeLoc(TildeLoc),
268 DestroyedType(DestroyedType) { }
272 return TInfo->getType();
280 End = TInfo->getTypeLoc().getLocalSourceRange().getEnd();
296 assert(Args || TemplateKWLoc.
isValid());
297 unsigned num_args = Args ? Args->
size() : 0;
301 TemplateKWLoc, NameInfo,
308 bool HasTemplateKWAndArgsInfo,
309 unsigned NumTemplateArgs) {
311 if (HasTemplateKWAndArgsInfo)
314 void *Mem = C.
Allocate(size, llvm::alignOf<UnresolvedLookupExpr>());
328 bool KnownInstantiationDependent,
329 bool KnownContainsUnexpandedParameterPack)
332 (KnownInstantiationDependent ||
333 NameInfo.isInstantiationDependent() ||
335 QualifierLoc.getNestedNameSpecifier()->isInstantiationDependent())),
336 (KnownContainsUnexpandedParameterPack ||
337 NameInfo.containsUnexpandedParameterPack() ||
339 QualifierLoc.getNestedNameSpecifier()
340 ->containsUnexpandedParameterPack()))),
341 NameInfo(NameInfo), QualifierLoc(QualifierLoc),
342 Results(nullptr), NumResults(End - Begin),
343 HasTemplateKWAndArgsInfo(TemplateArgs != nullptr ||
344 TemplateKWLoc.isValid()) {
345 NumResults = End - Begin;
349 if ((*I)->getDeclContext()->isDependentContext() ||
350 isa<UnresolvedUsingValueDecl>(*I)) {
351 ExprBits.TypeDependent =
true;
352 ExprBits.ValueDependent =
true;
353 ExprBits.InstantiationDependent =
true;
359 llvm::alignOf<DeclAccessPair>()));
367 bool Dependent =
false;
368 bool InstantiationDependent =
false;
369 bool ContainsUnexpandedParameterPack =
false;
372 InstantiationDependent,
373 ContainsUnexpandedParameterPack);
376 ExprBits.TypeDependent =
true;
377 ExprBits.ValueDependent =
true;
379 if (InstantiationDependent)
380 ExprBits.InstantiationDependent =
true;
381 if (ContainsUnexpandedParameterPack)
382 ExprBits.ContainsUnexpandedParameterPack =
true;
383 }
else if (TemplateKWLoc.
isValid()) {
394 assert(!Results &&
"Results already initialized!");
395 NumResults = End - Begin;
400 llvm::alignOf<DeclAccessPair>()));
406 if (isa<UnresolvedLookupExpr>(
this))
413 DependentScopeDeclRefExpr::DependentScopeDeclRefExpr(
QualType T,
420 (NameInfo.isInstantiationDependent() ||
422 QualifierLoc.getNestedNameSpecifier()->isInstantiationDependent())),
423 (NameInfo.containsUnexpandedParameterPack() ||
425 QualifierLoc.getNestedNameSpecifier()
426 ->containsUnexpandedParameterPack()))),
427 QualifierLoc(QualifierLoc), NameInfo(NameInfo),
428 HasTemplateKWAndArgsInfo(Args != nullptr || TemplateKWLoc.isValid())
431 bool Dependent =
true;
432 bool InstantiationDependent =
true;
433 bool ContainsUnexpandedParameterPack
434 = ExprBits.ContainsUnexpandedParameterPack;
437 InstantiationDependent,
438 ContainsUnexpandedParameterPack);
439 ExprBits.ContainsUnexpandedParameterPack = ContainsUnexpandedParameterPack;
440 }
else if (TemplateKWLoc.
isValid()) {
451 assert(QualifierLoc &&
"should be created for dependent qualifiers");
455 else if (TemplateKWLoc.
isValid())
459 TemplateKWLoc, NameInfo, Args);
464 bool HasTemplateKWAndArgsInfo,
465 unsigned NumTemplateArgs) {
467 if (HasTemplateKWAndArgsInfo)
474 E->HasTemplateKWAndArgsInfo = HasTemplateKWAndArgsInfo;
479 if (isa<CXXTemporaryObjectExpr>(
this))
480 return cast<CXXTemporaryObjectExpr>(
this)->
getLocStart();
485 if (isa<CXXTemporaryObjectExpr>(
this))
486 return cast<CXXTemporaryObjectExpr>(
this)->
getLocEnd();
488 if (ParenOrBraceRange.
isValid())
489 return ParenOrBraceRange.
getEnd();
506 SourceRange CXXOperatorCallExpr::getSourceRangeImpl()
const {
508 if (Kind == OO_PlusPlus || Kind == OO_MinusMinus) {
515 }
else if (Kind == OO_Arrow) {
516 return getArg(0)->getSourceRange();
517 }
else if (Kind == OO_Call) {
519 }
else if (Kind == OO_Subscript) {
532 if (
const MemberExpr *MemExpr = dyn_cast<MemberExpr>(Callee))
533 return MemExpr->getBase();
545 return cast<CXXMethodDecl>(MemExpr->getMemberDecl());
572 switch (getStmtClass()) {
573 case CXXStaticCastExprClass:
return "static_cast";
574 case CXXDynamicCastExprClass:
return "dynamic_cast";
575 case CXXReinterpretCastExprClass:
return "reinterpret_cast";
576 case CXXConstCastExprClass:
return "const_cast";
577 default:
return "<invalid cast>";
589 unsigned PathSize = (BasePath ? BasePath->size() : 0);
594 RParenLoc, AngleBrackets);
614 unsigned PathSize = (BasePath ? BasePath->size() : 0);
619 RParenLoc, AngleBrackets);
655 if (!SrcRD->
hasAttr<FinalAttr>())
671 unsigned PathSize = (BasePath ? BasePath->size() : 0);
676 RParenLoc, AngleBrackets);
694 return new (
C)
CXXConstCastExpr(T, VK, Op, WrittenTy, L, RParenLoc, AngleBrackets);
706 unsigned PathSize = (BasePath ? BasePath->size() : 0);
737 assert(
getNumArgs() == 1 &&
"unexpected #args in literal operator call");
739 cast<FunctionDecl>(
getCalleeDecl())->getParamDecl(0)->getType();
749 llvm_unreachable(
"unknown kind of literal operator");
761 return cast<FunctionDecl>(
getCalleeDecl())->getLiteralIdentifier();
774 :
Expr(CXXDefaultInitExprClass, T.getNonLValueExprType(C),
775 T->isLValueReferenceType() ?
VK_LValue : T->isRValueReferenceType()
779 Field(Field), Loc(Loc) {
793 "Expression bound to a temporary must have record or array type!");
803 bool HadMultipleCandidates,
804 bool ListInitialization,
805 bool StdInitListInitialization,
806 bool ZeroInitialization)
808 Type->getType().getNonReferenceType(),
809 Type->getTypeLoc().getBeginLoc(),
811 HadMultipleCandidates,
813 StdInitListInitialization,
820 return Type->getTypeLoc().getBeginLoc();
834 bool HadMultipleCandidates,
835 bool ListInitialization,
836 bool StdInitListInitialization,
837 bool ZeroInitialization,
842 HadMultipleCandidates, ListInitialization,
843 StdInitListInitialization,
844 ZeroInitialization, ConstructKind,
852 bool HadMultipleCandidates,
853 bool ListInitialization,
854 bool StdInitListInitialization,
855 bool ZeroInitialization,
859 T->isDependentType(), T->isDependentType(),
860 T->isInstantiationDependentType(),
861 T->containsUnexpandedParameterPack()),
862 Constructor(D), Loc(Loc), ParenOrBraceRange(ParenOrBraceRange),
863 NumArgs(args.size()),
864 Elidable(elidable), HadMultipleCandidates(HadMultipleCandidates),
865 ListInitialization(ListInitialization),
866 StdInitListInitialization(StdInitListInitialization),
867 ZeroInitialization(ZeroInitialization),
868 ConstructKind(ConstructKind), Args(nullptr)
871 Args =
new (
C)
Stmt*[args.size()];
873 for (
unsigned i = 0; i != args.size(); ++i) {
874 assert(args[i] &&
"NULL argument in CXXConstructExpr");
877 ExprBits.ValueDependent =
true;
879 ExprBits.InstantiationDependent =
true;
881 ExprBits.ContainsUnexpandedParameterPack =
true;
891 : DeclAndBits(Var, 0), Loc(Loc), EllipsisLoc(EllipsisLoc)
895 Bits |= Capture_Implicit;
899 assert(!Var &&
"'this' capture cannot have a variable!");
903 Bits |= Capture_ByCopy;
906 assert(Var &&
"capture must have a variable!");
909 assert(!Var &&
"VLA type capture cannot have a variable!");
910 Bits |= Capture_ByCopy;
913 DeclAndBits.setInt(Bits);
917 Decl *D = DeclAndBits.getPointer();
918 bool CapByCopy = DeclAndBits.getInt() & Capture_ByCopy;
931 bool ExplicitResultType,
936 bool ContainsUnexpandedParameterPack)
938 T->isDependentType(), T->isDependentType(), T->isDependentType(),
939 ContainsUnexpandedParameterPack),
940 IntroducerRange(IntroducerRange),
941 CaptureDefaultLoc(CaptureDefaultLoc),
942 NumCaptures(Captures.size()),
943 CaptureDefault(CaptureDefault),
944 ExplicitParams(ExplicitParams),
945 ExplicitResultType(ExplicitResultType),
946 ClosingBrace(ClosingBrace)
948 assert(CaptureInits.size() == Captures.size() &&
"Wrong number of arguments");
950 CXXRecordDecl::LambdaDefinitionData &Data = Class->getLambdaData();
956 Data.NumCaptures = NumCaptures;
957 Data.NumExplicitCaptures = 0;
958 Data.Captures = (Capture *)Context.
Allocate(
sizeof(Capture) * NumCaptures);
959 Capture *ToCapture = Data.Captures;
960 for (
unsigned I = 0, N = Captures.size(); I != N; ++I) {
962 ++Data.NumExplicitCaptures;
964 *ToCapture++ = Captures[I];
968 Stmt **Stored = getStoredStmts();
969 for (
unsigned I = 0, N = CaptureInits.size(); I != N; ++I)
970 *Stored++ = CaptureInits[I];
973 *Stored++ = getCallOperator()->getBody();
976 HasArrayIndexVars = !ArrayIndexVars.empty();
977 if (HasArrayIndexVars) {
978 assert(ArrayIndexStarts.size() == NumCaptures);
979 memcpy(getArrayIndexVars(), ArrayIndexVars.data(),
980 sizeof(
VarDecl *) * ArrayIndexVars.size());
981 memcpy(getArrayIndexStarts(), ArrayIndexStarts.data(),
982 sizeof(
unsigned) * Captures.size());
983 getArrayIndexStarts()[Captures.size()] = ArrayIndexVars.size();
994 bool ExplicitResultType,
999 bool ContainsUnexpandedParameterPack) {
1004 unsigned Size =
sizeof(
LambdaExpr) +
sizeof(
Stmt *) * (Captures.size() + 1);
1005 if (!ArrayIndexVars.empty()) {
1006 Size +=
sizeof(
unsigned) * (Captures.size() + 1);
1008 Size = llvm::RoundUpToAlignment(Size, llvm::alignOf<VarDecl*>());
1009 Size +=
sizeof(
VarDecl *) * ArrayIndexVars.size();
1011 void *Mem = Context.
Allocate(Size);
1012 return new (Mem)
LambdaExpr(T, IntroducerRange,
1013 CaptureDefault, CaptureDefaultLoc, Captures,
1014 ExplicitParams, ExplicitResultType,
1015 CaptureInits, ArrayIndexVars, ArrayIndexStarts,
1016 ClosingBrace, ContainsUnexpandedParameterPack);
1020 unsigned NumCaptures,
1021 unsigned NumArrayIndexVars) {
1022 unsigned Size =
sizeof(
LambdaExpr) +
sizeof(
Stmt *) * (NumCaptures + 1);
1023 if (NumArrayIndexVars)
1024 Size +=
sizeof(
VarDecl) * NumArrayIndexVars
1025 +
sizeof(
unsigned) * (NumCaptures + 1);
1027 return new (Mem)
LambdaExpr(EmptyShell(), NumCaptures, NumArrayIndexVars > 0);
1052 struct CXXRecordDecl::LambdaDefinitionData &Data
1054 return Data.Captures + Data.NumExplicitCaptures;
1075 assert(HasArrayIndexVars &&
"No array index-var data?");
1079 "Capture index out-of-range");
1080 VarDecl **IndexVars = getArrayIndexVars();
1081 unsigned *IndexStarts = getArrayIndexStarts();
1082 return llvm::makeArrayRef(IndexVars + IndexStarts[Index],
1083 IndexVars + IndexStarts[Index + 1]);
1102 if (!getStoredStmts()[NumCaptures])
1105 return reinterpret_cast<CompoundStmt *
>(getStoredStmts()[NumCaptures]);
1112 ExprWithCleanups::ExprWithCleanups(
Expr *subexpr,
1114 :
Expr(ExprWithCleanupsClass, subexpr->getType(),
1115 subexpr->getValueKind(), subexpr->getObjectKind(),
1116 subexpr->isTypeDependent(), subexpr->isValueDependent(),
1117 subexpr->isInstantiationDependent(),
1118 subexpr->containsUnexpandedParameterPack()),
1120 ExprWithCleanupsBits.NumObjects = objects.size();
1121 for (
unsigned i = 0, e = objects.size(); i != e; ++i)
1122 getObjectsBuffer()[i] = objects[i];
1129 void *buffer = C.
Allocate(size, llvm::alignOf<ExprWithCleanups>());
1133 ExprWithCleanups::ExprWithCleanups(EmptyShell empty,
unsigned numObjects)
1134 :
Expr(ExprWithCleanupsClass, empty) {
1135 ExprWithCleanupsBits.NumObjects = numObjects;
1140 unsigned numObjects) {
1142 void *buffer = C.
Allocate(size, llvm::alignOf<ExprWithCleanups>());
1150 :
Expr(CXXUnresolvedConstructExprClass,
1151 Type->getType().getNonReferenceType(),
1152 (Type->getType()->isLValueReferenceType() ?
VK_LValue
1153 :Type->getType()->isRValueReferenceType()?
VK_XValue
1156 Type->getType()->isDependentType(),
true,
true,
1157 Type->getType()->containsUnexpandedParameterPack()),
1159 LParenLoc(LParenLoc),
1160 RParenLoc(RParenLoc),
1161 NumArgs(Args.size()) {
1162 Stmt **StoredArgs =
reinterpret_cast<Stmt **
>(
this + 1);
1163 for (
unsigned I = 0; I != Args.size(); ++I) {
1165 ExprBits.ContainsUnexpandedParameterPack =
true;
1167 StoredArgs[I] = Args[I];
1178 sizeof(
Expr *) * Args.size());
1184 Stmt::EmptyShell Empty;
1186 sizeof(
Expr *) * NumArgs);
1194 CXXDependentScopeMemberExpr::CXXDependentScopeMemberExpr(
const ASTContext &C,
1203 :
Expr(CXXDependentScopeMemberExprClass, C.DependentTy,
1205 ((Base && Base->containsUnexpandedParameterPack()) ||
1207 QualifierLoc.getNestedNameSpecifier()
1208 ->containsUnexpandedParameterPack()) ||
1209 MemberNameInfo.containsUnexpandedParameterPack())),
1210 Base(Base), BaseType(BaseType), IsArrow(IsArrow),
1211 HasTemplateKWAndArgsInfo(TemplateArgs != nullptr ||
1212 TemplateKWLoc.isValid()),
1213 OperatorLoc(OperatorLoc), QualifierLoc(QualifierLoc),
1214 FirstQualifierFoundInScope(FirstQualifierFoundInScope),
1215 MemberNameInfo(MemberNameInfo) {
1217 bool Dependent =
true;
1218 bool InstantiationDependent =
true;
1219 bool ContainsUnexpandedParameterPack =
false;
1220 getTemplateKWAndArgsInfo()->initializeFrom(TemplateKWLoc, *TemplateArgs,
1222 InstantiationDependent,
1223 ContainsUnexpandedParameterPack);
1224 if (ContainsUnexpandedParameterPack)
1225 ExprBits.ContainsUnexpandedParameterPack =
true;
1226 }
else if (TemplateKWLoc.
isValid()) {
1227 getTemplateKWAndArgsInfo()->initializeFrom(TemplateKWLoc);
1231 CXXDependentScopeMemberExpr::CXXDependentScopeMemberExpr(
const ASTContext &C,
1238 :
Expr(CXXDependentScopeMemberExprClass, C.DependentTy,
1240 ((Base && Base->containsUnexpandedParameterPack()) ||
1242 QualifierLoc.getNestedNameSpecifier()->
1243 containsUnexpandedParameterPack()) ||
1244 MemberNameInfo.containsUnexpandedParameterPack())),
1245 Base(Base), BaseType(BaseType), IsArrow(IsArrow),
1246 HasTemplateKWAndArgsInfo(
false),
1247 OperatorLoc(OperatorLoc), QualifierLoc(QualifierLoc),
1248 FirstQualifierFoundInScope(FirstQualifierFoundInScope),
1249 MemberNameInfo(MemberNameInfo) { }
1260 if (!TemplateArgs && !TemplateKWLoc.
isValid())
1262 IsArrow, OperatorLoc,
1264 FirstQualifierFoundInScope,
1267 unsigned NumTemplateArgs = TemplateArgs ? TemplateArgs->
size() : 0;
1271 void *Mem = C.
Allocate(size, llvm::alignOf<CXXDependentScopeMemberExpr>());
1273 IsArrow, OperatorLoc,
1276 FirstQualifierFoundInScope,
1277 MemberNameInfo, TemplateArgs);
1282 bool HasTemplateKWAndArgsInfo,
1283 unsigned NumTemplateArgs) {
1284 if (!HasTemplateKWAndArgsInfo)
1292 void *Mem = C.
Allocate(size, llvm::alignOf<CXXDependentScopeMemberExpr>());
1299 E->HasTemplateKWAndArgsInfo =
true;
1314 if (isa<UnresolvedUsingValueDecl>(decl))
1322 }
while (++begin != end);
1327 UnresolvedMemberExpr::UnresolvedMemberExpr(
const ASTContext &C,
1328 bool HasUnresolvedUsing,
1338 :
OverloadExpr(UnresolvedMemberExprClass, C, QualifierLoc, TemplateKWLoc,
1339 MemberNameInfo, TemplateArgs, Begin, End,
1341 ((Base && Base->isTypeDependent()) ||
1342 BaseType->isDependentType()),
1343 ((Base && Base->isInstantiationDependent()) ||
1344 BaseType->isInstantiationDependentType()),
1346 ((Base && Base->containsUnexpandedParameterPack()) ||
1347 BaseType->containsUnexpandedParameterPack())),
1348 IsArrow(IsArrow), HasUnresolvedUsing(HasUnresolvedUsing),
1349 Base(Base), BaseType(BaseType), OperatorLoc(OperatorLoc) {
1357 bool UnresolvedMemberExpr::isImplicitAccess()
const {
1377 else if (TemplateKWLoc.
isValid())
1380 void *Mem = C.
Allocate(size, llvm::alignOf<UnresolvedMemberExpr>());
1382 HasUnresolvedUsing, Base, BaseType,
1383 IsArrow, OperatorLoc, QualifierLoc, TemplateKWLoc,
1384 MemberNameInfo, TemplateArgs, Begin, End);
1389 bool HasTemplateKWAndArgsInfo,
1390 unsigned NumTemplateArgs) {
1392 if (HasTemplateKWAndArgsInfo)
1395 void *Mem = C.
Allocate(size, llvm::alignOf<UnresolvedMemberExpr>());
1411 assert(T &&
"qualifier in member expression does not name type");
1413 assert(Record &&
"qualifier in member expression does not name record");
1420 assert(PT &&
"base of arrow member access is not pointer");
1425 assert(Record &&
"base of member expression does not name record");
1431 SubstNonTypeTemplateParmPackExpr::
1438 Param(Param), Arguments(ArgPack.pack_begin()),
1439 NumArguments(ArgPack.pack_size()), NameLoc(NameLoc) { }
1448 Decl *
const *Params)
1451 ParamPack(ParamPack), NameLoc(NameLoc), NumParameters(NumParams) {
1453 std::uninitialized_copy(Params, Params + NumParams,
1454 reinterpret_cast<Decl**>(
this+1));
1468 unsigned NumParams) {
1475 unsigned ManglingNumber) {
1482 if (!
State.is<ExtraState *>()) {
1488 auto ES =
State.get<ExtraState *>();
1489 ES->ExtendingDecl = ExtendedBy;
1490 ES->ManglingNumber = ManglingNumber;
1502 Loc(Loc), RParenLoc(RParenLoc)
1504 TypeTraitExprBits.Kind =
Kind;
1505 TypeTraitExprBits.Value =
Value;
1506 TypeTraitExprBits.NumArgs = Args.size();
1510 for (
unsigned I = 0, N = Args.size(); I != N; ++I) {
1518 ToArgs[I] = Args[I];
1530 return new (Mem)
TypeTraitExpr(T, Loc, Kind, Args, RParenLoc, Value);
1540 void ArrayTypeTraitExpr::anchor() { }
Raw form: operator "" X (const char *)
SourceRange getParenOrBraceRange() const
void setCastPath(const CXXCastPath &Path)
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.
operator "" X (long double)
CXXNewExpr(const ASTContext &C, bool globalNew, FunctionDecl *operatorNew, FunctionDecl *operatorDelete, bool usualArrayDeleteWantsSize, ArrayRef< Expr * > placementArgs, SourceRange typeIdParens, Expr *arraySize, InitializationStyle initializationStyle, Expr *initializer, QualType ty, TypeSourceInfo *AllocatedTypeInfo, SourceRange Range, SourceRange directInitRange)
SourceLocation getEnd() const
bool isDerivedFrom(const CXXRecordDecl *Base) const
Determine whether this class is derived from the class Base.
Stores the type being destroyed by a pseudo-destructor expression.
bool containsUnexpandedParameterPack() const
Whether this expression contains an unexpanded parameter pack (for C++11 variadic templates)...
Expr * getArg(unsigned Arg)
getArg - Return the specified argument.
static CXXDependentScopeMemberExpr * Create(const ASTContext &C, Expr *Base, QualType BaseType, bool IsArrow, SourceLocation OperatorLoc, NestedNameSpecifierLoc QualifierLoc, SourceLocation TemplateKWLoc, NamedDecl *FirstQualifierFoundInScope, DeclarationNameInfo MemberNameInfo, const TemplateArgumentListInfo *TemplateArgs)
A type trait used in the implementation of various C++11 and Library TR1 trait templates.
bool isInstantiationDependentType() const
Determine whether this type is an instantiation-dependent type, meaning that the type involves a temp...
static CXXConstructExpr * Create(const ASTContext &C, QualType T, SourceLocation Loc, CXXConstructorDecl *D, bool Elidable, ArrayRef< Expr * > Args, bool HadMultipleCandidates, bool ListInitialization, bool StdInitListInitialization, bool ZeroInitialization, ConstructionKind ConstructKind, SourceRange ParenOrBraceRange)
static UnresolvedLookupExpr * Create(const ASTContext &C, CXXRecordDecl *NamingClass, NestedNameSpecifierLoc QualifierLoc, const DeclarationNameInfo &NameInfo, bool ADL, bool Overloaded, UnresolvedSetIterator Begin, UnresolvedSetIterator End)
StringRef getUuidAsStringRef(ASTContext &Context) const
bool isAnyCharacterType() const
Determine whether this type is any of the built-in character types.
LambdaCapture(SourceLocation Loc, bool Implicit, LambdaCaptureKind Kind, VarDecl *Var=nullptr, SourceLocation EllipsisLoc=SourceLocation())
Create a new capture of a variable or of this.
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)
Microsoft's '__super' specifier, stored as a CXXRecordDecl* of the class it appeared in...
bool isRecordType() const
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.
capture_range captures() const
Retrieve this lambda's captures.
Represents a call to a C++ constructor.
A container of type source information.
SourceLocation getLocStart() const LLVM_READONLY
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.
SourceLocation getLocEnd() const LLVM_READONLY
capture_iterator capture_begin() const
Retrieve an iterator pointing to the first lambda capture.
SourceRange getSourceRange() const LLVM_READONLY
const Expr * getCallee() const
SourceLocation getLocEnd() const LLVM_READONLY
static FunctionParmPackExpr * CreateEmpty(const ASTContext &Context, unsigned NumParams)
static DependentScopeDeclRefExpr * CreateEmpty(const ASTContext &C, bool HasTemplateKWAndArgsInfo, unsigned NumTemplateArgs)
NamedDecl * getUnderlyingDecl()
Looks through UsingDecls and ObjCCompatibleAliasDecls for the underlying named decl.
Stores a list of template parameters for a TemplateDecl and its derived classes.
SourceLocation getOperatorLoc() const
Returns the location of the operator symbol in the expression.
void setContainsUnexpandedParameterPack(bool PP=true)
Set the bit that describes whether this expression contains an unexpanded parameter pack...
void initializeResults(const ASTContext &C, UnresolvedSetIterator Begin, UnresolvedSetIterator End)
bool containsUnexpandedParameterPack() const
Whether this type is or contains an unexpanded parameter pack, used to support C++0x variadic templat...
ParmVarDecl - Represents a parameter to a function.
QualType getBaseType() const
NullPointerConstantKind isNullPointerConstant(ASTContext &Ctx, NullPointerConstantValueDependence NPC) const
Defines the clang::Expr interface and subclasses for C++ expressions.
A C++ static_cast expression (C++ [expr.static.cast]).
static CXXUnresolvedConstructExpr * Create(const ASTContext &C, TypeSourceInfo *Type, SourceLocation LParenLoc, ArrayRef< Expr * > Args, SourceLocation RParenLoc)
void AllocateArgsArray(const ASTContext &C, bool isArray, unsigned numPlaceArgs, bool hasInitializer)
Represents a class template specialization, which refers to a class template with a given set of temp...
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.
bool isReferenceType() const
bool isImplicitCXXThis() const
Whether this expression is an implicit reference to 'this' in C++.
LambdaCaptureKind
The different capture forms in a lambda introducer.
bool isAnyPointerType() const
CXXRecordDecl * getNamingClass() const
Gets the naming class of this lookup, if any.
Expr * getImplicitObjectArgument() const
Retrieves the implicit object argument for the member call.
ASTTemplateKWAndArgsInfo * getTemplateKWAndArgsInfo()
Return the optional template keyword and arguments info.
const internal::VariadicAllOfMatcher< Decl > decl
Matches declarations.
CXXTemporaryObjectExpr(const ASTContext &C, CXXConstructorDecl *Cons, TypeSourceInfo *Type, ArrayRef< Expr * > Args, SourceRange ParenOrBraceRange, bool HadMultipleCandidates, bool ListInitialization, bool StdInitListInitialization, bool ZeroInitialization)
SourceRange getLocalSourceRange() const
Get the local source range.
bool isPotentiallyEvaluated() const
CXXMethodDecl * getCallOperator() const
Retrieve the function call operator associated with this lambda expression.
Represents a C++ member access expression for which lookup produced a set of overloaded functions...
QualType getTypeDeclType(const TypeDecl *Decl, const TypeDecl *PrevDecl=nullptr) const
Return the unique reference to the type for the specified type declaration.
SourceLocation getRParenLoc() const
An r-value expression (a pr-value in the C++11 taxonomy) produces a temporary value.
SourceLocation getBeginLoc() const
Get the begin source location.
bool isAlwaysNull() const
Capturing by copy (a.k.a., by value)
ArrayRef< VarDecl * > getCaptureInitIndexVars(capture_init_iterator Iter) const
Retrieve the set of index variables used in the capture initializer of an array captured by copy...
Expr * getInitializer()
The initializer of this new-expression.
An x-value expression is a reference to an object with independent storage but which can be "moved"...
Expr * getExprOperand() const
capture_iterator capture_end() const
Retrieve an iterator pointing past the end of the sequence of lambda captures.
A builtin binary operation expression such as "x + y" or "x <= y".
bool isValueDependent() const
InitializationStyle getInitializationStyle() const
The kind of initializer this new-expression has.
New-expression has a C++98 paren-delimited initializer.
SourceLocation getLocEnd() const LLVM_READONLY
TypeSourceInfo * getTypeSourceInfo() const
VarDecl * getCapturedVar() const
Retrieve the declaration of the local variable being captured.
QualType getDestroyedType() const
Retrieve the type being destroyed.
Represents binding an expression to a temporary.
CompoundStmt * getBody() const
Retrieve the body of the lambda.
A C++ lambda expression, which produces a function object (of unspecified type) that can be invoked l...
QualType getTypeOperand(ASTContext &Context) const
Retrieves the type operand of this __uuidof() expression after various required adjustments (removing...
TypeSourceInfo * getTypeInfoAsWritten() const
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...
capture_iterator implicit_capture_end() const
Retrieve an iterator pointing past the end of the sequence of implicit lambda captures.
A default argument (C++ [dcl.fct.default]).
New-expression has no initializer as written.
TypeTrait
Names for traits that operate specifically on types.
SourceLocation getLocation() const
static LambdaExpr * CreateDeserialized(const ASTContext &C, unsigned NumCaptures, unsigned NumArrayIndexVars)
Construct a new lambda expression that will be deserialized from an external source.
CXXRecordDecl * getMostRecentDecl()
CXXMethodDecl * getMethodDecl() const
Retrieves the declaration of the called method.
CastKind
CastKind - The kind of operation required for a conversion.
capture_init_iterator capture_init_begin() const
Retrieve the first initialization argument for this lambda expression (which initializes the first ca...
bool isInstantiationDependent() const
Whether this expression is instantiation-dependent, meaning that it depends in some way on a template...
static CXXDefaultArgExpr * Create(const ASTContext &C, SourceLocation Loc, ParmVarDecl *Param)
bool HasTemplateKWAndArgsInfo
Whether the name includes info for explicit template keyword and arguments.
ArrayRef< TemplateArgument > asArray() const
Produce this as an array ref.
QualType getPointeeType() const
PseudoDestructorTypeStorage()
bool isMutable() const
Determine whether the lambda is mutable, meaning that any captures values can be modified.
ExprValueKind
The categorization of expression values, currently following the C++11 scheme.
SourceLocation getLocStart() const LLVM_READONLY
A C++ const_cast expression (C++ [expr.const.cast]).
Represents a C++ destructor within a class.
New-expression has a C++11 list-initializer.
CXXConstructExpr(const ASTContext &C, StmtClass SC, QualType T, SourceLocation Loc, CXXConstructorDecl *d, bool elidable, ArrayRef< Expr * > Args, bool HadMultipleCandidates, bool ListInitialization, bool StdInitListInitialization, bool ZeroInitialization, ConstructionKind ConstructKind, SourceRange ParenOrBraceRange)
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()
bool isFloatingType() const
static DependentScopeDeclRefExpr * Create(const ASTContext &C, NestedNameSpecifierLoc QualifierLoc, SourceLocation TemplateKWLoc, const DeclarationNameInfo &NameInfo, const TemplateArgumentListInfo *TemplateArgs)
Defines the clang::TypeLoc interface and its subclasses.
CXXRecordDecl * getNamingClass() const
Retrieve the naming class of this lookup.
Specifies that a value-dependent expression of integral or dependent type should be considered a null...
bool isExplicit() const
Determine whether this was an explicit capture (written between the square brackets introducing the l...
Defines the clang::IdentifierInfo, clang::IdentifierTable, and clang::Selector interfaces.
bool shouldNullCheckAllocation(const ASTContext &Ctx) const
True if the allocation result needs to be null-checked.
bool isDependentType() const
CXXMethodDecl * getLambdaCallOperator() const
Retrieve the lambda call operator of the closure type if this is a closure type.
const Type * getAsType() const
Retrieve the type stored in this nested name specifier.
capture_iterator implicit_capture_begin() const
Retrieve an iterator pointing to the first implicit lambda capture.
SourceLocation getLocStart() const LLVM_READONLY
LambdaCaptureKind getCaptureKind() const
Determine the kind of capture.
BlockDecl * CleanupObject
Stmt * getBody(const FunctionDecl *&Definition) const
TypeLoc getTypeLoc() const
Return the TypeLoc wrapper for the type source info.
A C++ dynamic_cast expression (C++ [expr.dynamic.cast]).
SourceLocation getLocStart() const LLVM_READONLY
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...
operator "" X (const CharT *, size_t)
FunctionDecl * getAsFunction() LLVM_READONLY
Returns the function itself, or the templated function if this is a function template.
Raw form: operator "" X<cs...> ()
static CXXDynamicCastExpr * CreateEmpty(const ASTContext &Context, unsigned pathSize)
CXXRecordDecl * getRecordDecl() const
Retrieves the CXXRecordDecl for the underlying type of the implicit object argument.
Encodes a location in the source. The SourceManager can decode this to get at the full include stack...
const Type * getTypePtr() const
Represents a C++ temporary.
static CXXDependentScopeMemberExpr * CreateEmpty(const ASTContext &C, bool HasTemplateKWAndArgsInfo, unsigned NumTemplateArgs)
static CXXConstCastExpr * CreateEmpty(const ASTContext &Context)
bool isValid() const
Return true if this is a valid SourceLocation object.
ASTContext & getASTContext() const LLVM_READONLY
static const UuidAttr * GetUuidAttrOfType(QualType QT, bool *HasMultipleGUIDsPtr=nullptr)
OverloadExpr(StmtClass K, const ASTContext &C, NestedNameSpecifierLoc QualifierLoc, SourceLocation TemplateKWLoc, const DeclarationNameInfo &NameInfo, const TemplateArgumentListInfo *TemplateArgs, UnresolvedSetIterator Begin, UnresolvedSetIterator End, bool KnownDependent, bool KnownInstantiationDependent, bool KnownContainsUnexpandedParameterPack)
TemplateParameterList * getTemplateParameterList() const
If this is a generic lambda expression, retrieve the template parameter list associated with it...
TemplateArgument getArgumentPack() const
Retrieve the template argument pack containing the substituted template arguments.
Represents a static or instance method of a struct/union/class.
static ExprWithCleanups * Create(const ASTContext &C, EmptyShell empty, unsigned numObjects)
bool isImplicitAccess() const
True if this is an implicit access, i.e. one in which the member being accessed was not written in th...
SourceLocation getLocStart() const LLVM_READONLY
bool isInitCapture(const LambdaCapture *Capture) const
Determine whether one of this lambda's captures is an init-capture.
const Type * getBaseElementTypeUnsafe() const
LiteralOperatorKind getLiteralOperatorKind() const
Returns the kind of literal operator invocation which this expression represents. ...
capture_iterator explicit_capture_end() const
Retrieve an iterator pointing past the end of the sequence of explicit lambda captures.
SourceLocation getBegin() const
bool isTypeDependent() const
bool isArrow() const
Determine whether this member expression used the '->' operator; otherwise, it used the '...
QualType getType() const
Return the type wrapped by this type source info.
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)
QualType getPointeeType() const
A qualified reference to a name whose declaration cannot yet be resolved.
static bool hasOnlyNonStaticMemberFunctions(UnresolvedSetIterator begin, UnresolvedSetIterator end)
const char * getCastName() const
bool isInitCapture() const
Whether this variable is the implicit variable for a lambda init-capture.
if(T->getSizeExpr()) TRY_TO(TraverseStmt(T-> getSizeExpr()))
Represents a reference to a function parameter pack that has been substituted but not yet expanded...
Represents a template argument.
void setExtendingDecl(const ValueDecl *ExtendedBy, unsigned ManglingNumber)
static std::size_t sizeFor(unsigned NumTemplateArgs)
QualType getTypeOperand(ASTContext &Context) const
Retrieves the type operand of this typeid() expression after various required adjustments (removing r...
OverloadedOperatorKind
Enumeration specifying the different kinds of C++ overloaded operators.
SourceLocation getLocStart() const LLVM_READONLY
bool isDefaultArgument() const
Determine whether this expression is a default function argument.
A C++ reinterpret_cast expression (C++ [expr.reinterpret.cast]).
void setInstantiationDependent(bool ID)
Set whether this expression is instantiation-dependent or not.
bool isTypeOperand() const
unsigned getNumArgs() const
unsigned getNumArgs() const
SourceLocation getLocEnd() const LLVM_READONLY
QualType getNonReferenceType() const
Capturing variable-length array type.
llvm::iterator_range< capture_iterator > capture_range
An iterator over a range of lambda captures.
FunctionDecl * getOperatorNew() const
capture_iterator explicit_capture_begin() const
Retrieve an iterator pointing to the first explicit lambda capture.
static UnresolvedMemberExpr * CreateEmpty(const ASTContext &C, bool HasTemplateKWAndArgsInfo, unsigned NumTemplateArgs)
Expr * getArg(unsigned Arg)
Return the specified argument.
CanQualType BoundMemberTy
CXXRecordDecl * getAsCXXRecordDecl() const
Retrieves the CXXRecordDecl that this type refers to, either because the type is a RecordType or beca...
Expr * getExprOperand() const
The template argument is a type.
static CXXFunctionalCastExpr * CreateEmpty(const ASTContext &Context, unsigned PathSize)
static LambdaExpr * Create(const ASTContext &C, CXXRecordDecl *Class, SourceRange IntroducerRange, LambdaCaptureDefault CaptureDefault, SourceLocation CaptureDefaultLoc, ArrayRef< Capture > Captures, bool ExplicitParams, bool ExplicitResultType, ArrayRef< Expr * > CaptureInits, ArrayRef< VarDecl * > ArrayIndexVars, ArrayRef< unsigned > ArrayIndexStarts, SourceLocation ClosingBrace, bool ContainsUnexpandedParameterPack)
Construct a new lambda expression.
Capturing the this pointer.
Represents a base class of a C++ class.
TemplateParameterList * getGenericLambdaTemplateParameterList() const
Retrieve the generic lambda's template parameter list. Returns null if the class does not represent a...
Describes an explicit type conversion that uses functional notion but could not be resolved because o...
A template argument list.
static FunctionParmPackExpr * Create(const ASTContext &Context, QualType T, ParmVarDecl *ParamPack, SourceLocation NameLoc, ArrayRef< Decl * > Params)
static UnresolvedMemberExpr * Create(const ASTContext &C, bool HasUnresolvedUsing, Expr *Base, QualType BaseType, bool IsArrow, SourceLocation OperatorLoc, NestedNameSpecifierLoc QualifierLoc, SourceLocation TemplateKWLoc, const DeclarationNameInfo &MemberNameInfo, const TemplateArgumentListInfo *TemplateArgs, UnresolvedSetIterator Begin, UnresolvedSetIterator End)
static UnresolvedLookupExpr * CreateEmpty(const ASTContext &C, bool HasTemplateKWAndArgsInfo, unsigned NumTemplateArgs)
capture_range explicit_captures() const
Retrieve this lambda's explicit captures.
Defines the C++ Decl subclasses, other than those for templates (found in DeclTemplate.h) and friends (in DeclFriend.h).
OverloadedOperatorKind getOperator() const
Returns the kind of overloaded operator that this expression refers to.
const IdentifierInfo * getUDSuffix() const
Returns the ud-suffix specified for this literal.
void setEnd(SourceLocation e)
Represents a C++ struct/union/class.
static CXXStaticCastExpr * CreateEmpty(const ASTContext &Context, unsigned PathSize)
void initializeFrom(SourceLocation TemplateKWLoc, const TemplateArgumentListInfo &List)
SourceLocation getLocStart() const LLVM_READONLY
capture_range implicit_captures() const
Retrieve this lambda's implicit captures.
static CXXTemporary * Create(const ASTContext &C, const CXXDestructorDecl *Destructor)
static CXXUnresolvedConstructExpr * CreateEmpty(const ASTContext &C, unsigned NumArgs)
Represents an explicit C++ type conversion that uses "functional" notation (C++ [expr.type.conv]).
static TypeTraitExpr * Create(const ASTContext &C, QualType T, SourceLocation Loc, TypeTrait Kind, ArrayRef< TypeSourceInfo * > Args, SourceLocation RParenLoc, bool Value)
Create a new type trait expression.
static TypeTraitExpr * CreateDeserialized(const ASTContext &C, unsigned NumArgs)
void * Allocate(size_t Size, unsigned Align=8) const
bool isReservedGlobalPlacementOperator() const
Determines whether this operator new or delete is one of the reserved global placement operators: voi...
SourceLocation getLocEnd() const LLVM_READONLY
CXXPseudoDestructorExpr(const ASTContext &Context, Expr *Base, bool isArrow, SourceLocation OperatorLoc, NestedNameSpecifierLoc QualifierLoc, TypeSourceInfo *ScopeType, SourceLocation ColonColonLoc, SourceLocation TildeLoc, PseudoDestructorTypeStorage DestroyedType)
An l-value expression is a reference to an object with independent storage.
A trivial tuple used to represent a source range.
NestedNameSpecifier * getQualifier() const
Fetches the nested-name qualifier, if one was given.
QualType getDestroyedType() const
Retrieve the type being destroyed.
bool isTypeOperand() const
CXXRecordDecl * getLambdaClass() const
Retrieve the class that corresponds to the lambda.
QualType getUnqualifiedArrayType(QualType T, Qualifiers &Quals)
Return this type as a completely-unqualified array type, capturing the qualifiers in Quals...
operator "" X (unsigned long long)
bool isIntegerType() const
Expr * getCookedLiteral()
If this is not a raw user-defined literal, get the underlying cooked literal (representing the litera...
Expr * IgnoreParens() LLVM_READONLY
bool capturesVariable() const
Determine whether this capture handles a variable.
bool hasInClassInitializer() const
bool isPointerType() const