clang 22.0.0git
ExprCXX.h
Go to the documentation of this file.
1//===- ExprCXX.h - Classes for representing expressions ---------*- C++ -*-===//
2//
3// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4// See https://llvm.org/LICENSE.txt for license information.
5// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
6//
7//===----------------------------------------------------------------------===//
8//
9/// \file
10/// Defines the clang::Expr interface and subclasses for C++ expressions.
11//
12//===----------------------------------------------------------------------===//
13
14#ifndef LLVM_CLANG_AST_EXPRCXX_H
15#define LLVM_CLANG_AST_EXPRCXX_H
16
19#include "clang/AST/Decl.h"
20#include "clang/AST/DeclBase.h"
21#include "clang/AST/DeclCXX.h"
25#include "clang/AST/Expr.h"
28#include "clang/AST/Stmt.h"
29#include "clang/AST/StmtCXX.h"
31#include "clang/AST/Type.h"
35#include "clang/Basic/LLVM.h"
36#include "clang/Basic/Lambda.h"
43#include "llvm/ADT/ArrayRef.h"
44#include "llvm/ADT/PointerUnion.h"
45#include "llvm/ADT/STLExtras.h"
46#include "llvm/ADT/StringRef.h"
47#include "llvm/ADT/iterator_range.h"
48#include "llvm/Support/Casting.h"
49#include "llvm/Support/Compiler.h"
50#include "llvm/Support/TrailingObjects.h"
51#include <cassert>
52#include <cstddef>
53#include <cstdint>
54#include <memory>
55#include <optional>
56#include <variant>
57
58namespace clang {
59
60class ASTContext;
61class DeclAccessPair;
62class IdentifierInfo;
63class LambdaCapture;
66
67//===--------------------------------------------------------------------===//
68// C++ Expressions.
69//===--------------------------------------------------------------------===//
70
71/// A call to an overloaded operator written using operator
72/// syntax.
73///
74/// Represents a call to an overloaded operator written using operator
75/// syntax, e.g., "x + y" or "*p". While semantically equivalent to a
76/// normal call, this AST node provides better information about the
77/// syntactic representation of the call.
78///
79/// In a C++ template, this expression node kind will be used whenever
80/// any of the arguments are type-dependent. In this case, the
81/// function itself will be a (possibly empty) set of functions and
82/// function templates that were found by name lookup at template
83/// definition time.
84class CXXOperatorCallExpr final : public CallExpr {
85 friend class ASTStmtReader;
86 friend class ASTStmtWriter;
87
88 SourceLocation BeginLoc;
89
90 // CXXOperatorCallExpr has some trailing objects belonging
91 // to CallExpr. See CallExpr for the details.
92
93 SourceRange getSourceRangeImpl() const LLVM_READONLY;
94
95 CXXOperatorCallExpr(OverloadedOperatorKind OpKind, Expr *Fn,
97 SourceLocation OperatorLoc, FPOptionsOverride FPFeatures,
99
100 CXXOperatorCallExpr(unsigned NumArgs, bool HasFPFeatures, EmptyShell Empty);
101
102public:
103 static CXXOperatorCallExpr *
104 Create(const ASTContext &Ctx, OverloadedOperatorKind OpKind, Expr *Fn,
106 SourceLocation OperatorLoc, FPOptionsOverride FPFeatures,
108
109 static CXXOperatorCallExpr *CreateEmpty(const ASTContext &Ctx,
110 unsigned NumArgs, bool HasFPFeatures,
112
113 /// Returns the kind of overloaded operator that this expression refers to.
115 return static_cast<OverloadedOperatorKind>(
116 CXXOperatorCallExprBits.OperatorKind);
117 }
118
120 return Opc == OO_Equal || Opc == OO_StarEqual || Opc == OO_SlashEqual ||
121 Opc == OO_PercentEqual || Opc == OO_PlusEqual ||
122 Opc == OO_MinusEqual || Opc == OO_LessLessEqual ||
123 Opc == OO_GreaterGreaterEqual || Opc == OO_AmpEqual ||
124 Opc == OO_CaretEqual || Opc == OO_PipeEqual;
125 }
126 bool isAssignmentOp() const { return isAssignmentOp(getOperator()); }
127
129 switch (Opc) {
130 case OO_EqualEqual:
131 case OO_ExclaimEqual:
132 case OO_Greater:
133 case OO_GreaterEqual:
134 case OO_Less:
135 case OO_LessEqual:
136 case OO_Spaceship:
137 return true;
138 default:
139 return false;
140 }
141 }
142 bool isComparisonOp() const { return isComparisonOp(getOperator()); }
143
144 /// Is this written as an infix binary operator?
145 bool isInfixBinaryOp() const;
146
147 /// Returns the location of the operator symbol in the expression.
148 ///
149 /// When \c getOperator()==OO_Call, this is the location of the right
150 /// parentheses; when \c getOperator()==OO_Subscript, this is the location
151 /// of the right bracket.
153
154 SourceLocation getExprLoc() const LLVM_READONLY {
156 return (Operator < OO_Plus || Operator >= OO_Arrow ||
157 Operator == OO_PlusPlus || Operator == OO_MinusMinus)
158 ? getBeginLoc()
159 : getOperatorLoc();
160 }
161
162 SourceLocation getBeginLoc() const { return BeginLoc; }
163 SourceLocation getEndLoc() const { return getSourceRangeImpl().getEnd(); }
164 SourceRange getSourceRange() const { return getSourceRangeImpl(); }
165
166 static bool classof(const Stmt *T) {
167 return T->getStmtClass() == CXXOperatorCallExprClass;
168 }
169};
170
171/// Represents a call to a member function that
172/// may be written either with member call syntax (e.g., "obj.func()"
173/// or "objptr->func()") or with normal function-call syntax
174/// ("func()") within a member function that ends up calling a member
175/// function. The callee in either case is a MemberExpr that contains
176/// both the object argument and the member function, while the
177/// arguments are the arguments within the parentheses (not including
178/// the object argument).
179class CXXMemberCallExpr final : public CallExpr {
180 // CXXMemberCallExpr has some trailing objects belonging
181 // to CallExpr. See CallExpr for the details.
182
183 CXXMemberCallExpr(Expr *Fn, ArrayRef<Expr *> Args, QualType Ty,
185 FPOptionsOverride FPOptions, unsigned MinNumArgs);
186
187 CXXMemberCallExpr(unsigned NumArgs, bool HasFPFeatures, EmptyShell Empty);
188
189public:
190 static CXXMemberCallExpr *Create(const ASTContext &Ctx, Expr *Fn,
191 ArrayRef<Expr *> Args, QualType Ty,
193 FPOptionsOverride FPFeatures,
194 unsigned MinNumArgs = 0);
195
196 static CXXMemberCallExpr *CreateEmpty(const ASTContext &Ctx, unsigned NumArgs,
197 bool HasFPFeatures, EmptyShell Empty);
198
199 /// Retrieve the implicit object argument for the member call.
200 ///
201 /// For example, in "x.f(5)", this returns the sub-expression "x".
203
204 /// Retrieve the type of the object argument.
205 ///
206 /// Note that this always returns a non-pointer type.
207 QualType getObjectType() const;
208
209 /// Retrieve the declaration of the called method.
211
212 /// Retrieve the CXXRecordDecl for the underlying type of
213 /// the implicit object argument.
214 ///
215 /// Note that this is may not be the same declaration as that of the class
216 /// context of the CXXMethodDecl which this function is calling.
217 /// FIXME: Returns 0 for member pointer call exprs.
219
220 SourceLocation getExprLoc() const LLVM_READONLY {
222 if (CLoc.isValid())
223 return CLoc;
224
225 return getBeginLoc();
226 }
227
228 static bool classof(const Stmt *T) {
229 return T->getStmtClass() == CXXMemberCallExprClass;
230 }
231};
232
233/// Represents a call to a CUDA kernel function.
234class CUDAKernelCallExpr final : public CallExpr {
235 friend class ASTStmtReader;
236
237 enum { CONFIG, END_PREARG };
238
239 // CUDAKernelCallExpr has some trailing objects belonging
240 // to CallExpr. See CallExpr for the details.
241
244 FPOptionsOverride FPFeatures, unsigned MinNumArgs);
245
246 CUDAKernelCallExpr(unsigned NumArgs, bool HasFPFeatures, EmptyShell Empty);
247
248public:
249 static CUDAKernelCallExpr *Create(const ASTContext &Ctx, Expr *Fn,
250 CallExpr *Config, ArrayRef<Expr *> Args,
253 FPOptionsOverride FPFeatures,
254 unsigned MinNumArgs = 0);
255
256 static CUDAKernelCallExpr *CreateEmpty(const ASTContext &Ctx,
257 unsigned NumArgs, bool HasFPFeatures,
258 EmptyShell Empty);
259
260 const CallExpr *getConfig() const {
261 return cast_or_null<CallExpr>(getPreArg(CONFIG));
262 }
263 CallExpr *getConfig() { return cast_or_null<CallExpr>(getPreArg(CONFIG)); }
264
265 static bool classof(const Stmt *T) {
266 return T->getStmtClass() == CUDAKernelCallExprClass;
267 }
268};
269
270/// A rewritten comparison expression that was originally written using
271/// operator syntax.
272///
273/// In C++20, the following rewrites are performed:
274/// - <tt>a == b</tt> -> <tt>b == a</tt>
275/// - <tt>a != b</tt> -> <tt>!(a == b)</tt>
276/// - <tt>a != b</tt> -> <tt>!(b == a)</tt>
277/// - For \c \@ in \c <, \c <=, \c >, \c >=, \c <=>:
278/// - <tt>a @ b</tt> -> <tt>(a <=> b) @ 0</tt>
279/// - <tt>a @ b</tt> -> <tt>0 @ (b <=> a)</tt>
280///
281/// This expression provides access to both the original syntax and the
282/// rewritten expression.
283///
284/// Note that the rewritten calls to \c ==, \c <=>, and \c \@ are typically
285/// \c CXXOperatorCallExprs, but could theoretically be \c BinaryOperators.
287 friend class ASTStmtReader;
288
289 /// The rewritten semantic form.
290 Stmt *SemanticForm;
291
292public:
293 CXXRewrittenBinaryOperator(Expr *SemanticForm, bool IsReversed)
294 : Expr(CXXRewrittenBinaryOperatorClass, SemanticForm->getType(),
295 SemanticForm->getValueKind(), SemanticForm->getObjectKind()),
296 SemanticForm(SemanticForm) {
297 CXXRewrittenBinaryOperatorBits.IsReversed = IsReversed;
299 }
301 : Expr(CXXRewrittenBinaryOperatorClass, Empty), SemanticForm() {}
302
303 /// Get an equivalent semantic form for this expression.
304 Expr *getSemanticForm() { return cast<Expr>(SemanticForm); }
305 const Expr *getSemanticForm() const { return cast<Expr>(SemanticForm); }
306
308 /// The original opcode, prior to rewriting.
310 /// The original left-hand side.
311 const Expr *LHS;
312 /// The original right-hand side.
313 const Expr *RHS;
314 /// The inner \c == or \c <=> operator expression.
316 };
317
318 /// Decompose this operator into its syntactic form.
319 DecomposedForm getDecomposedForm() const LLVM_READONLY;
320
321 /// Determine whether this expression was rewritten in reverse form.
322 bool isReversed() const { return CXXRewrittenBinaryOperatorBits.IsReversed; }
323
326 static StringRef getOpcodeStr(BinaryOperatorKind Op) {
328 }
329 StringRef getOpcodeStr() const {
331 }
332 bool isComparisonOp() const { return true; }
333 bool isAssignmentOp() const { return false; }
334
335 const Expr *getLHS() const { return getDecomposedForm().LHS; }
336 const Expr *getRHS() const { return getDecomposedForm().RHS; }
337
338 SourceLocation getOperatorLoc() const LLVM_READONLY {
340 }
341 SourceLocation getExprLoc() const LLVM_READONLY { return getOperatorLoc(); }
342
343 /// Compute the begin and end locations from the decomposed form.
344 /// The locations of the semantic form are not reliable if this is
345 /// a reversed expression.
346 //@{
347 SourceLocation getBeginLoc() const LLVM_READONLY {
349 }
350 SourceLocation getEndLoc() const LLVM_READONLY {
351 return getDecomposedForm().RHS->getEndLoc();
352 }
353 SourceRange getSourceRange() const LLVM_READONLY {
355 return SourceRange(DF.LHS->getBeginLoc(), DF.RHS->getEndLoc());
356 }
357 //@}
358
360 return child_range(&SemanticForm, &SemanticForm + 1);
361 }
362
363 static bool classof(const Stmt *T) {
364 return T->getStmtClass() == CXXRewrittenBinaryOperatorClass;
365 }
366};
367
368/// Abstract class common to all of the C++ "named"/"keyword" casts.
369///
370/// This abstract class is inherited by all of the classes
371/// representing "named" casts: CXXStaticCastExpr for \c static_cast,
372/// CXXDynamicCastExpr for \c dynamic_cast, CXXReinterpretCastExpr for
373/// reinterpret_cast, CXXConstCastExpr for \c const_cast and
374/// CXXAddrspaceCastExpr for addrspace_cast (in OpenCL).
376private:
377 // the location of the casting op
378 SourceLocation Loc;
379
380 // the location of the right parenthesis
381 SourceLocation RParenLoc;
382
383 // range for '<' '>'
384 SourceRange AngleBrackets;
385
386protected:
387 friend class ASTStmtReader;
388
390 Expr *op, unsigned PathSize, bool HasFPFeatures,
391 TypeSourceInfo *writtenTy, SourceLocation l,
392 SourceLocation RParenLoc, SourceRange AngleBrackets)
393 : ExplicitCastExpr(SC, ty, VK, kind, op, PathSize, HasFPFeatures,
394 writtenTy),
395 Loc(l), RParenLoc(RParenLoc), AngleBrackets(AngleBrackets) {}
396
397 explicit CXXNamedCastExpr(StmtClass SC, EmptyShell Shell, unsigned PathSize,
398 bool HasFPFeatures)
399 : ExplicitCastExpr(SC, Shell, PathSize, HasFPFeatures) {}
400
401public:
402 const char *getCastName() const;
403
404 /// Retrieve the location of the cast operator keyword, e.g.,
405 /// \c static_cast.
406 SourceLocation getOperatorLoc() const { return Loc; }
407
408 /// Retrieve the location of the closing parenthesis.
409 SourceLocation getRParenLoc() const { return RParenLoc; }
410
411 SourceLocation getBeginLoc() const LLVM_READONLY { return Loc; }
412 SourceLocation getEndLoc() const LLVM_READONLY { return RParenLoc; }
413 SourceRange getAngleBrackets() const LLVM_READONLY { return AngleBrackets; }
414
415 static bool classof(const Stmt *T) {
416 switch (T->getStmtClass()) {
417 case CXXStaticCastExprClass:
418 case CXXDynamicCastExprClass:
419 case CXXReinterpretCastExprClass:
420 case CXXConstCastExprClass:
421 case CXXAddrspaceCastExprClass:
422 return true;
423 default:
424 return false;
425 }
426 }
427};
428
429/// A C++ \c static_cast expression (C++ [expr.static.cast]).
430///
431/// This expression node represents a C++ static cast, e.g.,
432/// \c static_cast<int>(1.0).
433class CXXStaticCastExpr final
434 : public CXXNamedCastExpr,
435 private llvm::TrailingObjects<CXXStaticCastExpr, CXXBaseSpecifier *,
436 FPOptionsOverride> {
437 CXXStaticCastExpr(QualType ty, ExprValueKind vk, CastKind kind, Expr *op,
438 unsigned pathSize, TypeSourceInfo *writtenTy,
440 SourceLocation RParenLoc, SourceRange AngleBrackets)
441 : CXXNamedCastExpr(CXXStaticCastExprClass, ty, vk, kind, op, pathSize,
442 FPO.requiresTrailingStorage(), writtenTy, l, RParenLoc,
443 AngleBrackets) {
445 *getTrailingFPFeatures() = FPO;
446 }
447
448 explicit CXXStaticCastExpr(EmptyShell Empty, unsigned PathSize,
449 bool HasFPFeatures)
450 : CXXNamedCastExpr(CXXStaticCastExprClass, Empty, PathSize,
451 HasFPFeatures) {}
452
453 unsigned numTrailingObjects(OverloadToken<CXXBaseSpecifier *>) const {
454 return path_size();
455 }
456
457public:
458 friend class CastExpr;
460
461 static CXXStaticCastExpr *
462 Create(const ASTContext &Context, QualType T, ExprValueKind VK, CastKind K,
463 Expr *Op, const CXXCastPath *Path, TypeSourceInfo *Written,
465 SourceRange AngleBrackets);
466 static CXXStaticCastExpr *CreateEmpty(const ASTContext &Context,
467 unsigned PathSize, bool hasFPFeatures);
468
469 static bool classof(const Stmt *T) {
470 return T->getStmtClass() == CXXStaticCastExprClass;
471 }
472};
473
474/// A C++ @c dynamic_cast expression (C++ [expr.dynamic.cast]).
475///
476/// This expression node represents a dynamic cast, e.g.,
477/// \c dynamic_cast<Derived*>(BasePtr). Such a cast may perform a run-time
478/// check to determine how to perform the type conversion.
479class CXXDynamicCastExpr final
480 : public CXXNamedCastExpr,
481 private llvm::TrailingObjects<CXXDynamicCastExpr, CXXBaseSpecifier *> {
482 CXXDynamicCastExpr(QualType ty, ExprValueKind VK, CastKind kind, Expr *op,
483 unsigned pathSize, TypeSourceInfo *writtenTy,
484 SourceLocation l, SourceLocation RParenLoc,
485 SourceRange AngleBrackets)
486 : CXXNamedCastExpr(CXXDynamicCastExprClass, ty, VK, kind, op, pathSize,
487 /*HasFPFeatures*/ false, writtenTy, l, RParenLoc,
488 AngleBrackets) {}
489
490 explicit CXXDynamicCastExpr(EmptyShell Empty, unsigned pathSize)
491 : CXXNamedCastExpr(CXXDynamicCastExprClass, Empty, pathSize,
492 /*HasFPFeatures*/ false) {}
493
494public:
495 friend class CastExpr;
497
498 static CXXDynamicCastExpr *Create(const ASTContext &Context, QualType T,
499 ExprValueKind VK, CastKind Kind, Expr *Op,
500 const CXXCastPath *Path,
501 TypeSourceInfo *Written, SourceLocation L,
502 SourceLocation RParenLoc,
503 SourceRange AngleBrackets);
504
505 static CXXDynamicCastExpr *CreateEmpty(const ASTContext &Context,
506 unsigned pathSize);
507
508 bool isAlwaysNull() const;
509
510 static bool classof(const Stmt *T) {
511 return T->getStmtClass() == CXXDynamicCastExprClass;
512 }
513};
514
515/// A C++ @c reinterpret_cast expression (C++ [expr.reinterpret.cast]).
516///
517/// This expression node represents a reinterpret cast, e.g.,
518/// @c reinterpret_cast<int>(VoidPtr).
519///
520/// A reinterpret_cast provides a differently-typed view of a value but
521/// (in Clang, as in most C++ implementations) performs no actual work at
522/// run time.
523class CXXReinterpretCastExpr final
524 : public CXXNamedCastExpr,
525 private llvm::TrailingObjects<CXXReinterpretCastExpr,
526 CXXBaseSpecifier *> {
527 CXXReinterpretCastExpr(QualType ty, ExprValueKind vk, CastKind kind, Expr *op,
528 unsigned pathSize, TypeSourceInfo *writtenTy,
529 SourceLocation l, SourceLocation RParenLoc,
530 SourceRange AngleBrackets)
531 : CXXNamedCastExpr(CXXReinterpretCastExprClass, ty, vk, kind, op,
532 pathSize, /*HasFPFeatures*/ false, writtenTy, l,
533 RParenLoc, AngleBrackets) {}
534
535 CXXReinterpretCastExpr(EmptyShell Empty, unsigned pathSize)
536 : CXXNamedCastExpr(CXXReinterpretCastExprClass, Empty, pathSize,
537 /*HasFPFeatures*/ false) {}
538
539public:
540 friend class CastExpr;
542
543 static CXXReinterpretCastExpr *Create(const ASTContext &Context, QualType T,
545 Expr *Op, const CXXCastPath *Path,
546 TypeSourceInfo *WrittenTy, SourceLocation L,
547 SourceLocation RParenLoc,
548 SourceRange AngleBrackets);
549 static CXXReinterpretCastExpr *CreateEmpty(const ASTContext &Context,
550 unsigned pathSize);
551
552 static bool classof(const Stmt *T) {
553 return T->getStmtClass() == CXXReinterpretCastExprClass;
554 }
555};
556
557/// A C++ \c const_cast expression (C++ [expr.const.cast]).
558///
559/// This expression node represents a const cast, e.g.,
560/// \c const_cast<char*>(PtrToConstChar).
561///
562/// A const_cast can remove type qualifiers but does not change the underlying
563/// value.
564class CXXConstCastExpr final
565 : public CXXNamedCastExpr,
566 private llvm::TrailingObjects<CXXConstCastExpr, CXXBaseSpecifier *> {
567 CXXConstCastExpr(QualType ty, ExprValueKind VK, Expr *op,
568 TypeSourceInfo *writtenTy, SourceLocation l,
569 SourceLocation RParenLoc, SourceRange AngleBrackets)
570 : CXXNamedCastExpr(CXXConstCastExprClass, ty, VK, CK_NoOp, op, 0,
571 /*HasFPFeatures*/ false, writtenTy, l, RParenLoc,
572 AngleBrackets) {}
573
574 explicit CXXConstCastExpr(EmptyShell Empty)
575 : CXXNamedCastExpr(CXXConstCastExprClass, Empty, 0,
576 /*HasFPFeatures*/ false) {}
577
578public:
579 friend class CastExpr;
581
582 static CXXConstCastExpr *Create(const ASTContext &Context, QualType T,
583 ExprValueKind VK, Expr *Op,
584 TypeSourceInfo *WrittenTy, SourceLocation L,
585 SourceLocation RParenLoc,
586 SourceRange AngleBrackets);
587 static CXXConstCastExpr *CreateEmpty(const ASTContext &Context);
588
589 static bool classof(const Stmt *T) {
590 return T->getStmtClass() == CXXConstCastExprClass;
591 }
592};
593
594/// A C++ addrspace_cast expression (currently only enabled for OpenCL).
595///
596/// This expression node represents a cast between pointers to objects in
597/// different address spaces e.g.,
598/// \c addrspace_cast<global int*>(PtrToGenericInt).
599///
600/// A addrspace_cast can cast address space type qualifiers but does not change
601/// the underlying value.
602class CXXAddrspaceCastExpr final
603 : public CXXNamedCastExpr,
604 private llvm::TrailingObjects<CXXAddrspaceCastExpr, CXXBaseSpecifier *> {
605 CXXAddrspaceCastExpr(QualType ty, ExprValueKind VK, CastKind Kind, Expr *op,
606 TypeSourceInfo *writtenTy, SourceLocation l,
607 SourceLocation RParenLoc, SourceRange AngleBrackets)
608 : CXXNamedCastExpr(CXXAddrspaceCastExprClass, ty, VK, Kind, op, 0,
609 /*HasFPFeatures*/ false, writtenTy, l, RParenLoc,
610 AngleBrackets) {}
611
612 explicit CXXAddrspaceCastExpr(EmptyShell Empty)
613 : CXXNamedCastExpr(CXXAddrspaceCastExprClass, Empty, 0,
614 /*HasFPFeatures*/ false) {}
615
616public:
617 friend class CastExpr;
619
620 static CXXAddrspaceCastExpr *
621 Create(const ASTContext &Context, QualType T, ExprValueKind VK, CastKind Kind,
622 Expr *Op, TypeSourceInfo *WrittenTy, SourceLocation L,
623 SourceLocation RParenLoc, SourceRange AngleBrackets);
624 static CXXAddrspaceCastExpr *CreateEmpty(const ASTContext &Context);
625
626 static bool classof(const Stmt *T) {
627 return T->getStmtClass() == CXXAddrspaceCastExprClass;
628 }
629};
630
631/// A call to a literal operator (C++11 [over.literal])
632/// written as a user-defined literal (C++11 [lit.ext]).
633///
634/// Represents a user-defined literal, e.g. "foo"_bar or 1.23_xyz. While this
635/// is semantically equivalent to a normal call, this AST node provides better
636/// information about the syntactic representation of the literal.
637///
638/// Since literal operators are never found by ADL and can only be declared at
639/// namespace scope, a user-defined literal is never dependent.
640class UserDefinedLiteral final : public CallExpr {
641 friend class ASTStmtReader;
642 friend class ASTStmtWriter;
643
644 /// The location of a ud-suffix within the literal.
645 SourceLocation UDSuffixLoc;
646
647 // UserDefinedLiteral has some trailing objects belonging
648 // to CallExpr. See CallExpr for the details.
649
650 UserDefinedLiteral(Expr *Fn, ArrayRef<Expr *> Args, QualType Ty,
652 SourceLocation SuffixLoc, FPOptionsOverride FPFeatures);
653
654 UserDefinedLiteral(unsigned NumArgs, bool HasFPFeatures, EmptyShell Empty);
655
656public:
657 static UserDefinedLiteral *Create(const ASTContext &Ctx, Expr *Fn,
658 ArrayRef<Expr *> Args, QualType Ty,
660 SourceLocation SuffixLoc,
661 FPOptionsOverride FPFeatures);
662
663 static UserDefinedLiteral *CreateEmpty(const ASTContext &Ctx,
664 unsigned NumArgs, bool HasFPOptions,
666
667 /// The kind of literal operator which is invoked.
669 /// Raw form: operator "" X (const char *)
671
672 /// Raw form: operator "" X<cs...> ()
674
675 /// operator "" X (unsigned long long)
677
678 /// operator "" X (long double)
680
681 /// operator "" X (const CharT *, size_t)
683
684 /// operator "" X (CharT)
686 };
687
688 /// Returns the kind of literal operator invocation
689 /// which this expression represents.
691
692 /// If this is not a raw user-defined literal, get the
693 /// underlying cooked literal (representing the literal with the suffix
694 /// removed).
696 const Expr *getCookedLiteral() const {
697 return const_cast<UserDefinedLiteral*>(this)->getCookedLiteral();
698 }
699
702 return getRParenLoc();
703 return getArg(0)->getBeginLoc();
704 }
705
707
708 /// Returns the location of a ud-suffix in the expression.
709 ///
710 /// For a string literal, there may be multiple identical suffixes. This
711 /// returns the first.
712 SourceLocation getUDSuffixLoc() const { return UDSuffixLoc; }
713
714 /// Returns the ud-suffix specified for this literal.
715 const IdentifierInfo *getUDSuffix() const;
716
717 static bool classof(const Stmt *S) {
718 return S->getStmtClass() == UserDefinedLiteralClass;
719 }
720};
721
722/// A boolean literal, per ([C++ lex.bool] Boolean literals).
723class CXXBoolLiteralExpr : public Expr {
724public:
726 : Expr(CXXBoolLiteralExprClass, Ty, VK_PRValue, OK_Ordinary) {
727 CXXBoolLiteralExprBits.Value = Val;
728 CXXBoolLiteralExprBits.Loc = Loc;
729 setDependence(ExprDependence::None);
730 }
731
733 : Expr(CXXBoolLiteralExprClass, Empty) {}
734
735 static CXXBoolLiteralExpr *Create(const ASTContext &C, bool Val, QualType Ty,
736 SourceLocation Loc) {
737 return new (C) CXXBoolLiteralExpr(Val, Ty, Loc);
738 }
739
740 bool getValue() const { return CXXBoolLiteralExprBits.Value; }
741 void setValue(bool V) { CXXBoolLiteralExprBits.Value = V; }
742
745
748
749 static bool classof(const Stmt *T) {
750 return T->getStmtClass() == CXXBoolLiteralExprClass;
751 }
752
753 // Iterators
757
761};
762
763/// The null pointer literal (C++11 [lex.nullptr])
764///
765/// Introduced in C++11, the only literal of type \c nullptr_t is \c nullptr.
766/// This also implements the null pointer literal in C23 (C23 6.4.1) which is
767/// intended to have the same semantics as the feature in C++.
769public:
771 : Expr(CXXNullPtrLiteralExprClass, Ty, VK_PRValue, OK_Ordinary) {
773 setDependence(ExprDependence::None);
774 }
775
777 : Expr(CXXNullPtrLiteralExprClass, Empty) {}
778
781
784
785 static bool classof(const Stmt *T) {
786 return T->getStmtClass() == CXXNullPtrLiteralExprClass;
787 }
788
792
796};
797
798/// Implicit construction of a std::initializer_list<T> object from an
799/// array temporary within list-initialization (C++11 [dcl.init.list]p5).
800class CXXStdInitializerListExpr : public Expr {
801 Stmt *SubExpr = nullptr;
802
803 CXXStdInitializerListExpr(EmptyShell Empty)
804 : Expr(CXXStdInitializerListExprClass, Empty) {}
805
806public:
807 friend class ASTReader;
808 friend class ASTStmtReader;
809
811 : Expr(CXXStdInitializerListExprClass, Ty, VK_PRValue, OK_Ordinary),
812 SubExpr(SubExpr) {
814 }
815
816 Expr *getSubExpr() { return static_cast<Expr*>(SubExpr); }
817 const Expr *getSubExpr() const { return static_cast<const Expr*>(SubExpr); }
818
819 SourceLocation getBeginLoc() const LLVM_READONLY {
820 return SubExpr->getBeginLoc();
821 }
822
823 SourceLocation getEndLoc() const LLVM_READONLY {
824 return SubExpr->getEndLoc();
825 }
826
827 /// Retrieve the source range of the expression.
828 SourceRange getSourceRange() const LLVM_READONLY {
829 return SubExpr->getSourceRange();
830 }
831
832 static bool classof(const Stmt *S) {
833 return S->getStmtClass() == CXXStdInitializerListExprClass;
834 }
835
836 child_range children() { return child_range(&SubExpr, &SubExpr + 1); }
837
839 return const_child_range(&SubExpr, &SubExpr + 1);
840 }
841};
842
843/// A C++ \c typeid expression (C++ [expr.typeid]), which gets
844/// the \c type_info that corresponds to the supplied type, or the (possibly
845/// dynamic) type of the supplied expression.
846///
847/// This represents code like \c typeid(int) or \c typeid(*objPtr)
848class CXXTypeidExpr : public Expr {
849 friend class ASTStmtReader;
850
851private:
852 llvm::PointerUnion<Stmt *, TypeSourceInfo *> Operand;
853 SourceRange Range;
854
855public:
857 : Expr(CXXTypeidExprClass, Ty, VK_LValue, OK_Ordinary), Operand(Operand),
858 Range(R) {
860 }
861
863 : Expr(CXXTypeidExprClass, Ty, VK_LValue, OK_Ordinary), Operand(Operand),
864 Range(R) {
866 }
867
869 : Expr(CXXTypeidExprClass, Empty) {
870 if (isExpr)
871 Operand = (Expr*)nullptr;
872 else
873 Operand = (TypeSourceInfo*)nullptr;
874 }
875
876 /// Determine whether this typeid has a type operand which is potentially
877 /// evaluated, per C++11 [expr.typeid]p3.
878 bool isPotentiallyEvaluated() const;
879
880 /// Best-effort check if the expression operand refers to a most derived
881 /// object. This is not a strong guarantee.
882 bool isMostDerived(const ASTContext &Context) const;
883
884 bool isTypeOperand() const { return isa<TypeSourceInfo *>(Operand); }
885
886 /// Retrieves the type operand of this typeid() expression after
887 /// various required adjustments (removing reference types, cv-qualifiers).
888 QualType getTypeOperand(const ASTContext &Context) const;
889
890 /// Retrieve source information for the type operand.
892 assert(isTypeOperand() && "Cannot call getTypeOperand for typeid(expr)");
893 return cast<TypeSourceInfo *>(Operand);
894 }
896 assert(!isTypeOperand() && "Cannot call getExprOperand for typeid(type)");
897 return static_cast<Expr *>(cast<Stmt *>(Operand));
898 }
899
900 SourceLocation getBeginLoc() const LLVM_READONLY { return Range.getBegin(); }
901 SourceLocation getEndLoc() const LLVM_READONLY { return Range.getEnd(); }
902 SourceRange getSourceRange() const LLVM_READONLY { return Range; }
903 void setSourceRange(SourceRange R) { Range = R; }
904
905 static bool classof(const Stmt *T) {
906 return T->getStmtClass() == CXXTypeidExprClass;
907 }
908
909 // Iterators
911 if (isTypeOperand())
913 auto **begin = reinterpret_cast<Stmt **>(&Operand);
914 return child_range(begin, begin + 1);
915 }
916
918 if (isTypeOperand())
920
921 auto **begin =
922 reinterpret_cast<Stmt **>(&const_cast<CXXTypeidExpr *>(this)->Operand);
923 return const_child_range(begin, begin + 1);
924 }
925
926 /// Whether this is of a form like "typeid(*ptr)" that can throw a
927 /// std::bad_typeid if a pointer is a null pointer ([expr.typeid]p2)
928 bool hasNullCheck() const;
929};
930
931/// A member reference to an MSPropertyDecl.
932///
933/// This expression always has pseudo-object type, and therefore it is
934/// typically not encountered in a fully-typechecked expression except
935/// within the syntactic form of a PseudoObjectExpr.
936class MSPropertyRefExpr : public Expr {
937 Expr *BaseExpr;
938 MSPropertyDecl *TheDecl;
939 SourceLocation MemberLoc;
940 bool IsArrow;
941 NestedNameSpecifierLoc QualifierLoc;
942
943public:
944 friend class ASTStmtReader;
945
948 NestedNameSpecifierLoc qualifierLoc, SourceLocation nameLoc)
949 : Expr(MSPropertyRefExprClass, ty, VK, OK_Ordinary), BaseExpr(baseExpr),
950 TheDecl(decl), MemberLoc(nameLoc), IsArrow(isArrow),
951 QualifierLoc(qualifierLoc) {
953 }
954
955 MSPropertyRefExpr(EmptyShell Empty) : Expr(MSPropertyRefExprClass, Empty) {}
956
957 SourceRange getSourceRange() const LLVM_READONLY {
958 return SourceRange(getBeginLoc(), getEndLoc());
959 }
960
961 bool isImplicitAccess() const {
963 }
964
966 if (!isImplicitAccess())
967 return BaseExpr->getBeginLoc();
968 else if (QualifierLoc)
969 return QualifierLoc.getBeginLoc();
970 else
971 return MemberLoc;
972 }
973
975
977 return child_range((Stmt**)&BaseExpr, (Stmt**)&BaseExpr + 1);
978 }
979
981 return const_cast<MSPropertyRefExpr *>(this)->children();
982 }
983
984 static bool classof(const Stmt *T) {
985 return T->getStmtClass() == MSPropertyRefExprClass;
986 }
987
988 Expr *getBaseExpr() const { return BaseExpr; }
989 MSPropertyDecl *getPropertyDecl() const { return TheDecl; }
990 bool isArrow() const { return IsArrow; }
991 SourceLocation getMemberLoc() const { return MemberLoc; }
992 NestedNameSpecifierLoc getQualifierLoc() const { return QualifierLoc; }
993};
994
995/// MS property subscript expression.
996/// MSVC supports 'property' attribute and allows to apply it to the
997/// declaration of an empty array in a class or structure definition.
998/// For example:
999/// \code
1000/// __declspec(property(get=GetX, put=PutX)) int x[];
1001/// \endcode
1002/// The above statement indicates that x[] can be used with one or more array
1003/// indices. In this case, i=p->x[a][b] will be turned into i=p->GetX(a, b), and
1004/// p->x[a][b] = i will be turned into p->PutX(a, b, i).
1005/// This is a syntactic pseudo-object expression.
1007 friend class ASTStmtReader;
1008
1009 enum { BASE_EXPR, IDX_EXPR, NUM_SUBEXPRS = 2 };
1010
1011 Stmt *SubExprs[NUM_SUBEXPRS];
1012 SourceLocation RBracketLoc;
1013
1014 void setBase(Expr *Base) { SubExprs[BASE_EXPR] = Base; }
1015 void setIdx(Expr *Idx) { SubExprs[IDX_EXPR] = Idx; }
1016
1017public:
1019 ExprObjectKind OK, SourceLocation RBracketLoc)
1020 : Expr(MSPropertySubscriptExprClass, Ty, VK, OK),
1021 RBracketLoc(RBracketLoc) {
1022 SubExprs[BASE_EXPR] = Base;
1023 SubExprs[IDX_EXPR] = Idx;
1025 }
1026
1027 /// Create an empty array subscript expression.
1029 : Expr(MSPropertySubscriptExprClass, Shell) {}
1030
1031 Expr *getBase() { return cast<Expr>(SubExprs[BASE_EXPR]); }
1032 const Expr *getBase() const { return cast<Expr>(SubExprs[BASE_EXPR]); }
1033
1034 Expr *getIdx() { return cast<Expr>(SubExprs[IDX_EXPR]); }
1035 const Expr *getIdx() const { return cast<Expr>(SubExprs[IDX_EXPR]); }
1036
1037 SourceLocation getBeginLoc() const LLVM_READONLY {
1038 return getBase()->getBeginLoc();
1039 }
1040
1041 SourceLocation getEndLoc() const LLVM_READONLY { return RBracketLoc; }
1042
1043 SourceLocation getRBracketLoc() const { return RBracketLoc; }
1044 void setRBracketLoc(SourceLocation L) { RBracketLoc = L; }
1045
1046 SourceLocation getExprLoc() const LLVM_READONLY {
1047 return getBase()->getExprLoc();
1048 }
1049
1050 static bool classof(const Stmt *T) {
1051 return T->getStmtClass() == MSPropertySubscriptExprClass;
1052 }
1053
1054 // Iterators
1056 return child_range(&SubExprs[0], &SubExprs[0] + NUM_SUBEXPRS);
1057 }
1058
1060 return const_child_range(&SubExprs[0], &SubExprs[0] + NUM_SUBEXPRS);
1061 }
1062};
1063
1064/// A Microsoft C++ @c __uuidof expression, which gets
1065/// the _GUID that corresponds to the supplied type or expression.
1066///
1067/// This represents code like @c __uuidof(COMTYPE) or @c __uuidof(*comPtr)
1068class CXXUuidofExpr : public Expr {
1069 friend class ASTStmtReader;
1070
1071private:
1072 llvm::PointerUnion<Stmt *, TypeSourceInfo *> Operand;
1073 MSGuidDecl *Guid;
1074 SourceRange Range;
1075
1076public:
1078 SourceRange R)
1079 : Expr(CXXUuidofExprClass, Ty, VK_LValue, OK_Ordinary), Operand(Operand),
1080 Guid(Guid), Range(R) {
1082 }
1083
1085 : Expr(CXXUuidofExprClass, Ty, VK_LValue, OK_Ordinary), Operand(Operand),
1086 Guid(Guid), Range(R) {
1088 }
1089
1091 : Expr(CXXUuidofExprClass, Empty) {
1092 if (isExpr)
1093 Operand = (Expr*)nullptr;
1094 else
1095 Operand = (TypeSourceInfo*)nullptr;
1096 }
1097
1098 bool isTypeOperand() const { return isa<TypeSourceInfo *>(Operand); }
1099
1100 /// Retrieves the type operand of this __uuidof() expression after
1101 /// various required adjustments (removing reference types, cv-qualifiers).
1102 QualType getTypeOperand(ASTContext &Context) const;
1103
1104 /// Retrieve source information for the type operand.
1106 assert(isTypeOperand() && "Cannot call getTypeOperand for __uuidof(expr)");
1107 return cast<TypeSourceInfo *>(Operand);
1108 }
1110 assert(!isTypeOperand() && "Cannot call getExprOperand for __uuidof(type)");
1111 return static_cast<Expr *>(cast<Stmt *>(Operand));
1112 }
1113
1114 MSGuidDecl *getGuidDecl() const { return Guid; }
1115
1116 SourceLocation getBeginLoc() const LLVM_READONLY { return Range.getBegin(); }
1117 SourceLocation getEndLoc() const LLVM_READONLY { return Range.getEnd(); }
1118 SourceRange getSourceRange() const LLVM_READONLY { return Range; }
1119 void setSourceRange(SourceRange R) { Range = R; }
1120
1121 static bool classof(const Stmt *T) {
1122 return T->getStmtClass() == CXXUuidofExprClass;
1123 }
1124
1125 // Iterators
1127 if (isTypeOperand())
1129 auto **begin = reinterpret_cast<Stmt **>(&Operand);
1130 return child_range(begin, begin + 1);
1131 }
1132
1134 if (isTypeOperand())
1136 auto **begin =
1137 reinterpret_cast<Stmt **>(&const_cast<CXXUuidofExpr *>(this)->Operand);
1138 return const_child_range(begin, begin + 1);
1139 }
1140};
1141
1142/// Represents the \c this expression in C++.
1143///
1144/// This is a pointer to the object on which the current member function is
1145/// executing (C++ [expr.prim]p3). Example:
1146///
1147/// \code
1148/// class Foo {
1149/// public:
1150/// void bar();
1151/// void test() { this->bar(); }
1152/// };
1153/// \endcode
1154class CXXThisExpr : public Expr {
1155 CXXThisExpr(SourceLocation L, QualType Ty, bool IsImplicit, ExprValueKind VK)
1156 : Expr(CXXThisExprClass, Ty, VK, OK_Ordinary) {
1157 CXXThisExprBits.IsImplicit = IsImplicit;
1158 CXXThisExprBits.CapturedByCopyInLambdaWithExplicitObjectParameter = false;
1159 CXXThisExprBits.Loc = L;
1161 }
1162
1163 CXXThisExpr(EmptyShell Empty) : Expr(CXXThisExprClass, Empty) {}
1164
1165public:
1166 static CXXThisExpr *Create(const ASTContext &Ctx, SourceLocation L,
1167 QualType Ty, bool IsImplicit);
1168
1169 static CXXThisExpr *CreateEmpty(const ASTContext &Ctx);
1170
1173
1176
1177 bool isImplicit() const { return CXXThisExprBits.IsImplicit; }
1178 void setImplicit(bool I) { CXXThisExprBits.IsImplicit = I; }
1179
1181 return CXXThisExprBits.CapturedByCopyInLambdaWithExplicitObjectParameter;
1182 }
1183
1185 CXXThisExprBits.CapturedByCopyInLambdaWithExplicitObjectParameter = Set;
1187 }
1188
1189 static bool classof(const Stmt *T) {
1190 return T->getStmtClass() == CXXThisExprClass;
1191 }
1192
1193 // Iterators
1197
1201};
1202
1203/// A C++ throw-expression (C++ [except.throw]).
1204///
1205/// This handles 'throw' (for re-throwing the current exception) and
1206/// 'throw' assignment-expression. When assignment-expression isn't
1207/// present, Op will be null.
1208class CXXThrowExpr : public Expr {
1209 friend class ASTStmtReader;
1210
1211 /// The optional expression in the throw statement.
1212 Stmt *Operand;
1213
1214public:
1215 // \p Ty is the void type which is used as the result type of the
1216 // expression. The \p Loc is the location of the throw keyword.
1217 // \p Operand is the expression in the throw statement, and can be
1218 // null if not present.
1220 bool IsThrownVariableInScope)
1221 : Expr(CXXThrowExprClass, Ty, VK_PRValue, OK_Ordinary), Operand(Operand) {
1222 CXXThrowExprBits.ThrowLoc = Loc;
1223 CXXThrowExprBits.IsThrownVariableInScope = IsThrownVariableInScope;
1225 }
1226 CXXThrowExpr(EmptyShell Empty) : Expr(CXXThrowExprClass, Empty) {}
1227
1228 const Expr *getSubExpr() const { return cast_or_null<Expr>(Operand); }
1229 Expr *getSubExpr() { return cast_or_null<Expr>(Operand); }
1230
1231 SourceLocation getThrowLoc() const { return CXXThrowExprBits.ThrowLoc; }
1232
1233 /// Determines whether the variable thrown by this expression (if any!)
1234 /// is within the innermost try block.
1235 ///
1236 /// This information is required to determine whether the NRVO can apply to
1237 /// this variable.
1239 return CXXThrowExprBits.IsThrownVariableInScope;
1240 }
1241
1243 SourceLocation getEndLoc() const LLVM_READONLY {
1244 if (!getSubExpr())
1245 return getThrowLoc();
1246 return getSubExpr()->getEndLoc();
1247 }
1248
1249 static bool classof(const Stmt *T) {
1250 return T->getStmtClass() == CXXThrowExprClass;
1251 }
1252
1253 // Iterators
1255 return child_range(&Operand, Operand ? &Operand + 1 : &Operand);
1256 }
1257
1259 return const_child_range(&Operand, Operand ? &Operand + 1 : &Operand);
1260 }
1261};
1262
1263/// A default argument (C++ [dcl.fct.default]).
1264///
1265/// This wraps up a function call argument that was created from the
1266/// corresponding parameter's default argument, when the call did not
1267/// explicitly supply arguments for all of the parameters.
1268class CXXDefaultArgExpr final
1269 : public Expr,
1270 private llvm::TrailingObjects<CXXDefaultArgExpr, Expr *> {
1271 friend class ASTStmtReader;
1272 friend class ASTReader;
1273 friend TrailingObjects;
1274
1275 /// The parameter whose default is being used.
1276 ParmVarDecl *Param;
1277
1278 /// The context where the default argument expression was used.
1279 DeclContext *UsedContext;
1280
1281 CXXDefaultArgExpr(StmtClass SC, SourceLocation Loc, ParmVarDecl *Param,
1282 Expr *RewrittenExpr, DeclContext *UsedContext)
1283 : Expr(SC,
1284 Param->hasUnparsedDefaultArg()
1285 ? Param->getType().getNonReferenceType()
1286 : Param->getDefaultArg()->getType(),
1287 Param->getDefaultArg()->getValueKind(),
1288 Param->getDefaultArg()->getObjectKind()),
1289 Param(Param), UsedContext(UsedContext) {
1290 CXXDefaultArgExprBits.Loc = Loc;
1291 CXXDefaultArgExprBits.HasRewrittenInit = RewrittenExpr != nullptr;
1292 if (RewrittenExpr)
1293 *getTrailingObjects() = RewrittenExpr;
1295 }
1296
1297 CXXDefaultArgExpr(EmptyShell Empty, bool HasRewrittenInit)
1298 : Expr(CXXDefaultArgExprClass, Empty) {
1299 CXXDefaultArgExprBits.HasRewrittenInit = HasRewrittenInit;
1300 }
1301
1302public:
1303 static CXXDefaultArgExpr *CreateEmpty(const ASTContext &C,
1304 bool HasRewrittenInit);
1305
1306 // \p Param is the parameter whose default argument is used by this
1307 // expression.
1308 static CXXDefaultArgExpr *Create(const ASTContext &C, SourceLocation Loc,
1309 ParmVarDecl *Param, Expr *RewrittenExpr,
1310 DeclContext *UsedContext);
1311 // Retrieve the parameter that the argument was created from.
1312 const ParmVarDecl *getParam() const { return Param; }
1313 ParmVarDecl *getParam() { return Param; }
1314
1315 bool hasRewrittenInit() const {
1316 return CXXDefaultArgExprBits.HasRewrittenInit;
1317 }
1318
1319 // Retrieve the argument to the function call.
1320 Expr *getExpr();
1321 const Expr *getExpr() const {
1322 return const_cast<CXXDefaultArgExpr *>(this)->getExpr();
1323 }
1324
1326 return hasRewrittenInit() ? *getTrailingObjects() : nullptr;
1327 }
1328
1329 const Expr *getRewrittenExpr() const {
1330 return const_cast<CXXDefaultArgExpr *>(this)->getRewrittenExpr();
1331 }
1332
1333 // Retrieve the rewritten init expression (for an init expression containing
1334 // immediate calls) with the top level FullExpr and ConstantExpr stripped off.
1337 return const_cast<CXXDefaultArgExpr *>(this)->getAdjustedRewrittenExpr();
1338 }
1339
1340 const DeclContext *getUsedContext() const { return UsedContext; }
1341 DeclContext *getUsedContext() { return UsedContext; }
1342
1343 /// Retrieve the location where this default argument was actually used.
1345
1346 /// Default argument expressions have no representation in the
1347 /// source, so they have an empty source range.
1350
1352
1353 static bool classof(const Stmt *T) {
1354 return T->getStmtClass() == CXXDefaultArgExprClass;
1355 }
1356
1357 // Iterators
1361
1365};
1366
1367/// A use of a default initializer in a constructor or in aggregate
1368/// initialization.
1369///
1370/// This wraps a use of a C++ default initializer (technically,
1371/// a brace-or-equal-initializer for a non-static data member) when it
1372/// is implicitly used in a mem-initializer-list in a constructor
1373/// (C++11 [class.base.init]p8) or in aggregate initialization
1374/// (C++1y [dcl.init.aggr]p7).
1375class CXXDefaultInitExpr final
1376 : public Expr,
1377 private llvm::TrailingObjects<CXXDefaultInitExpr, Expr *> {
1378
1379 friend class ASTStmtReader;
1380 friend class ASTReader;
1381 friend TrailingObjects;
1382 /// The field whose default is being used.
1383 FieldDecl *Field;
1384
1385 /// The context where the default initializer expression was used.
1386 DeclContext *UsedContext;
1387
1388 CXXDefaultInitExpr(const ASTContext &Ctx, SourceLocation Loc,
1389 FieldDecl *Field, QualType Ty, DeclContext *UsedContext,
1390 Expr *RewrittenInitExpr);
1391
1392 CXXDefaultInitExpr(EmptyShell Empty, bool HasRewrittenInit)
1393 : Expr(CXXDefaultInitExprClass, Empty) {
1394 CXXDefaultInitExprBits.HasRewrittenInit = HasRewrittenInit;
1395 }
1396
1397public:
1399 bool HasRewrittenInit);
1400 /// \p Field is the non-static data member whose default initializer is used
1401 /// by this expression.
1402 static CXXDefaultInitExpr *Create(const ASTContext &Ctx, SourceLocation Loc,
1403 FieldDecl *Field, DeclContext *UsedContext,
1404 Expr *RewrittenInitExpr);
1405
1406 bool hasRewrittenInit() const {
1407 return CXXDefaultInitExprBits.HasRewrittenInit;
1408 }
1409
1410 /// Get the field whose initializer will be used.
1411 FieldDecl *getField() { return Field; }
1412 const FieldDecl *getField() const { return Field; }
1413
1414 /// Get the initialization expression that will be used.
1415 Expr *getExpr();
1416 const Expr *getExpr() const {
1417 return const_cast<CXXDefaultInitExpr *>(this)->getExpr();
1418 }
1419
1420 /// Retrieve the initializing expression with evaluated immediate calls, if
1421 /// any.
1422 const Expr *getRewrittenExpr() const {
1423 assert(hasRewrittenInit() && "expected a rewritten init expression");
1424 return *getTrailingObjects();
1425 }
1426
1427 /// Retrieve the initializing expression with evaluated immediate calls, if
1428 /// any.
1430 assert(hasRewrittenInit() && "expected a rewritten init expression");
1431 return *getTrailingObjects();
1432 }
1433
1434 const DeclContext *getUsedContext() const { return UsedContext; }
1435 DeclContext *getUsedContext() { return UsedContext; }
1436
1437 /// Retrieve the location where this default initializer expression was
1438 /// actually used.
1440
1443
1444 static bool classof(const Stmt *T) {
1445 return T->getStmtClass() == CXXDefaultInitExprClass;
1446 }
1447
1448 // Iterators
1452
1456};
1457
1458/// Represents a C++ temporary.
1459class CXXTemporary {
1460 /// The destructor that needs to be called.
1461 const CXXDestructorDecl *Destructor;
1462
1463 explicit CXXTemporary(const CXXDestructorDecl *destructor)
1464 : Destructor(destructor) {}
1465
1466public:
1467 static CXXTemporary *Create(const ASTContext &C,
1468 const CXXDestructorDecl *Destructor);
1469
1470 const CXXDestructorDecl *getDestructor() const { return Destructor; }
1471
1473 Destructor = Dtor;
1474 }
1475};
1476
1477/// Represents binding an expression to a temporary.
1478///
1479/// This ensures the destructor is called for the temporary. It should only be
1480/// needed for non-POD, non-trivially destructable class types. For example:
1481///
1482/// \code
1483/// struct S {
1484/// S() { } // User defined constructor makes S non-POD.
1485/// ~S() { } // User defined destructor makes it non-trivial.
1486/// };
1487/// void test() {
1488/// const S &s_ref = S(); // Requires a CXXBindTemporaryExpr.
1489/// }
1490/// \endcode
1491///
1492/// Destructor might be null if destructor declaration is not valid.
1493class CXXBindTemporaryExpr : public Expr {
1494 CXXTemporary *Temp = nullptr;
1495 Stmt *SubExpr = nullptr;
1496
1497 CXXBindTemporaryExpr(CXXTemporary *temp, Expr *SubExpr)
1498 : Expr(CXXBindTemporaryExprClass, SubExpr->getType(), VK_PRValue,
1499 OK_Ordinary),
1500 Temp(temp), SubExpr(SubExpr) {
1502 }
1503
1504public:
1506 : Expr(CXXBindTemporaryExprClass, Empty) {}
1507
1508 static CXXBindTemporaryExpr *Create(const ASTContext &C, CXXTemporary *Temp,
1509 Expr* SubExpr);
1510
1511 CXXTemporary *getTemporary() { return Temp; }
1512 const CXXTemporary *getTemporary() const { return Temp; }
1513 void setTemporary(CXXTemporary *T) { Temp = T; }
1514
1515 const Expr *getSubExpr() const { return cast<Expr>(SubExpr); }
1516 Expr *getSubExpr() { return cast<Expr>(SubExpr); }
1517 void setSubExpr(Expr *E) { SubExpr = E; }
1518
1519 SourceLocation getBeginLoc() const LLVM_READONLY {
1520 return SubExpr->getBeginLoc();
1521 }
1522
1523 SourceLocation getEndLoc() const LLVM_READONLY {
1524 return SubExpr->getEndLoc();
1525 }
1526
1527 // Implement isa/cast/dyncast/etc.
1528 static bool classof(const Stmt *T) {
1529 return T->getStmtClass() == CXXBindTemporaryExprClass;
1530 }
1531
1532 // Iterators
1533 child_range children() { return child_range(&SubExpr, &SubExpr + 1); }
1534
1536 return const_child_range(&SubExpr, &SubExpr + 1);
1537 }
1538};
1539
1546
1547/// Represents a call to a C++ constructor.
1548class CXXConstructExpr : public Expr {
1549 friend class ASTStmtReader;
1550
1551 /// A pointer to the constructor which will be ultimately called.
1552 CXXConstructorDecl *Constructor;
1553
1554 SourceRange ParenOrBraceRange;
1555
1556 /// The number of arguments.
1557 unsigned NumArgs;
1558
1559 // We would like to stash the arguments of the constructor call after
1560 // CXXConstructExpr. However CXXConstructExpr is used as a base class of
1561 // CXXTemporaryObjectExpr which makes the use of llvm::TrailingObjects
1562 // impossible.
1563 //
1564 // Instead we manually stash the trailing object after the full object
1565 // containing CXXConstructExpr (that is either CXXConstructExpr or
1566 // CXXTemporaryObjectExpr).
1567 //
1568 // The trailing objects are:
1569 //
1570 // * An array of getNumArgs() "Stmt *" for the arguments of the
1571 // constructor call.
1572
1573 /// Return a pointer to the start of the trailing arguments.
1574 /// Defined just after CXXTemporaryObjectExpr.
1575 inline Stmt **getTrailingArgs();
1576 const Stmt *const *getTrailingArgs() const {
1577 return const_cast<CXXConstructExpr *>(this)->getTrailingArgs();
1578 }
1579
1580protected:
1581 /// Build a C++ construction expression.
1583 CXXConstructorDecl *Ctor, bool Elidable,
1584 ArrayRef<Expr *> Args, bool HadMultipleCandidates,
1585 bool ListInitialization, bool StdInitListInitialization,
1586 bool ZeroInitialization, CXXConstructionKind ConstructKind,
1587 SourceRange ParenOrBraceRange);
1588
1589 /// Build an empty C++ construction expression.
1590 CXXConstructExpr(StmtClass SC, EmptyShell Empty, unsigned NumArgs);
1591
1592 /// Return the size in bytes of the trailing objects. Used by
1593 /// CXXTemporaryObjectExpr to allocate the right amount of storage.
1594 static unsigned sizeOfTrailingObjects(unsigned NumArgs) {
1595 return NumArgs * sizeof(Stmt *);
1596 }
1597
1598public:
1599 /// Create a C++ construction expression.
1600 static CXXConstructExpr *
1601 Create(const ASTContext &Ctx, QualType Ty, SourceLocation Loc,
1602 CXXConstructorDecl *Ctor, bool Elidable, ArrayRef<Expr *> Args,
1603 bool HadMultipleCandidates, bool ListInitialization,
1604 bool StdInitListInitialization, bool ZeroInitialization,
1605 CXXConstructionKind ConstructKind, SourceRange ParenOrBraceRange);
1606
1607 /// Create an empty C++ construction expression.
1608 static CXXConstructExpr *CreateEmpty(const ASTContext &Ctx, unsigned NumArgs);
1609
1610 /// Get the constructor that this expression will (ultimately) call.
1611 CXXConstructorDecl *getConstructor() const { return Constructor; }
1612
1615
1616 /// Whether this construction is elidable.
1617 bool isElidable() const { return CXXConstructExprBits.Elidable; }
1618 void setElidable(bool E) { CXXConstructExprBits.Elidable = E; }
1619
1620 /// Whether the referred constructor was resolved from
1621 /// an overloaded set having size greater than 1.
1623 return CXXConstructExprBits.HadMultipleCandidates;
1624 }
1626 CXXConstructExprBits.HadMultipleCandidates = V;
1627 }
1628
1629 /// Whether this constructor call was written as list-initialization.
1631 return CXXConstructExprBits.ListInitialization;
1632 }
1634 CXXConstructExprBits.ListInitialization = V;
1635 }
1636
1637 /// Whether this constructor call was written as list-initialization,
1638 /// but was interpreted as forming a std::initializer_list<T> from the list
1639 /// and passing that as a single constructor argument.
1640 /// See C++11 [over.match.list]p1 bullet 1.
1642 return CXXConstructExprBits.StdInitListInitialization;
1643 }
1645 CXXConstructExprBits.StdInitListInitialization = V;
1646 }
1647
1648 /// Whether this construction first requires
1649 /// zero-initialization before the initializer is called.
1651 return CXXConstructExprBits.ZeroInitialization;
1652 }
1653 void setRequiresZeroInitialization(bool ZeroInit) {
1654 CXXConstructExprBits.ZeroInitialization = ZeroInit;
1655 }
1656
1657 /// Determine whether this constructor is actually constructing
1658 /// a base class (rather than a complete object).
1660 return static_cast<CXXConstructionKind>(
1661 CXXConstructExprBits.ConstructionKind);
1662 }
1664 CXXConstructExprBits.ConstructionKind = llvm::to_underlying(CK);
1665 }
1666
1669 using arg_range = llvm::iterator_range<arg_iterator>;
1670 using const_arg_range = llvm::iterator_range<const_arg_iterator>;
1671
1674 return const_arg_range(arg_begin(), arg_end());
1675 }
1676
1677 arg_iterator arg_begin() { return getTrailingArgs(); }
1679 const_arg_iterator arg_begin() const { return getTrailingArgs(); }
1681
1682 Expr **getArgs() { return reinterpret_cast<Expr **>(getTrailingArgs()); }
1683 const Expr *const *getArgs() const {
1684 return reinterpret_cast<const Expr *const *>(getTrailingArgs());
1685 }
1686
1687 /// Return the number of arguments to the constructor call.
1688 unsigned getNumArgs() const { return NumArgs; }
1689
1690 /// Return the specified argument.
1691 Expr *getArg(unsigned Arg) {
1692 assert(Arg < getNumArgs() && "Arg access out of range!");
1693 return getArgs()[Arg];
1694 }
1695 const Expr *getArg(unsigned Arg) const {
1696 assert(Arg < getNumArgs() && "Arg access out of range!");
1697 return getArgs()[Arg];
1698 }
1699
1700 /// Set the specified argument.
1701 void setArg(unsigned Arg, Expr *ArgExpr) {
1702 assert(Arg < getNumArgs() && "Arg access out of range!");
1703 getArgs()[Arg] = ArgExpr;
1704 }
1705
1707 return CXXConstructExprBits.IsImmediateEscalating;
1708 }
1709
1711 CXXConstructExprBits.IsImmediateEscalating = Set;
1712 }
1713
1714 /// Returns the WarnUnusedResultAttr that is declared on the callee
1715 /// or its return type declaration, together with a NamedDecl that
1716 /// refers to the declaration the attribute is attached to.
1717 std::pair<const NamedDecl *, const WarnUnusedResultAttr *>
1720 }
1721
1722 /// Returns true if this call expression should warn on unused results.
1723 bool hasUnusedResultAttr(const ASTContext &Ctx) const {
1724 return getUnusedResultAttr(Ctx).second != nullptr;
1725 }
1726
1727 SourceLocation getBeginLoc() const LLVM_READONLY;
1728 SourceLocation getEndLoc() const LLVM_READONLY;
1729 SourceRange getParenOrBraceRange() const { return ParenOrBraceRange; }
1730 void setParenOrBraceRange(SourceRange Range) { ParenOrBraceRange = Range; }
1731
1732 static bool classof(const Stmt *T) {
1733 return T->getStmtClass() == CXXConstructExprClass ||
1734 T->getStmtClass() == CXXTemporaryObjectExprClass;
1735 }
1736
1737 // Iterators
1739 return child_range(getTrailingArgs(), getTrailingArgs() + getNumArgs());
1740 }
1741
1743 return const_cast<CXXConstructExpr *>(this)->children();
1744 }
1745};
1746
1747/// Represents a call to an inherited base class constructor from an
1748/// inheriting constructor. This call implicitly forwards the arguments from
1749/// the enclosing context (an inheriting constructor) to the specified inherited
1750/// base class constructor.
1752private:
1753 CXXConstructorDecl *Constructor = nullptr;
1754
1755 /// The location of the using declaration.
1756 SourceLocation Loc;
1757
1758 /// Whether this is the construction of a virtual base.
1759 LLVM_PREFERRED_TYPE(bool)
1760 unsigned ConstructsVirtualBase : 1;
1761
1762 /// Whether the constructor is inherited from a virtual base class of the
1763 /// class that we construct.
1764 LLVM_PREFERRED_TYPE(bool)
1765 unsigned InheritedFromVirtualBase : 1;
1766
1767public:
1768 friend class ASTStmtReader;
1769
1770 /// Construct a C++ inheriting construction expression.
1772 CXXConstructorDecl *Ctor, bool ConstructsVirtualBase,
1773 bool InheritedFromVirtualBase)
1774 : Expr(CXXInheritedCtorInitExprClass, T, VK_PRValue, OK_Ordinary),
1775 Constructor(Ctor), Loc(Loc),
1776 ConstructsVirtualBase(ConstructsVirtualBase),
1777 InheritedFromVirtualBase(InheritedFromVirtualBase) {
1778 assert(!T->isDependentType());
1779 setDependence(ExprDependence::None);
1780 }
1781
1782 /// Construct an empty C++ inheriting construction expression.
1784 : Expr(CXXInheritedCtorInitExprClass, Empty),
1785 ConstructsVirtualBase(false), InheritedFromVirtualBase(false) {}
1786
1787 /// Get the constructor that this expression will call.
1788 CXXConstructorDecl *getConstructor() const { return Constructor; }
1789
1790 /// Determine whether this constructor is actually constructing
1791 /// a base class (rather than a complete object).
1792 bool constructsVBase() const { return ConstructsVirtualBase; }
1797
1798 /// Determine whether the inherited constructor is inherited from a
1799 /// virtual base of the object we construct. If so, we are not responsible
1800 /// for calling the inherited constructor (the complete object constructor
1801 /// does that), and so we don't need to pass any arguments.
1802 bool inheritedFromVBase() const { return InheritedFromVirtualBase; }
1803
1804 SourceLocation getLocation() const LLVM_READONLY { return Loc; }
1805 SourceLocation getBeginLoc() const LLVM_READONLY { return Loc; }
1806 SourceLocation getEndLoc() const LLVM_READONLY { return Loc; }
1807
1808 static bool classof(const Stmt *T) {
1809 return T->getStmtClass() == CXXInheritedCtorInitExprClass;
1810 }
1811
1815
1819};
1820
1821/// Represents an explicit C++ type conversion that uses "functional"
1822/// notation (C++ [expr.type.conv]).
1823///
1824/// Example:
1825/// \code
1826/// x = int(0.5);
1827/// \endcode
1828class CXXFunctionalCastExpr final
1829 : public ExplicitCastExpr,
1830 private llvm::TrailingObjects<CXXFunctionalCastExpr, CXXBaseSpecifier *,
1831 FPOptionsOverride> {
1832 SourceLocation LParenLoc;
1833 SourceLocation RParenLoc;
1834
1835 CXXFunctionalCastExpr(QualType ty, ExprValueKind VK,
1836 TypeSourceInfo *writtenTy, CastKind kind,
1837 Expr *castExpr, unsigned pathSize,
1838 FPOptionsOverride FPO, SourceLocation lParenLoc,
1839 SourceLocation rParenLoc)
1840 : ExplicitCastExpr(CXXFunctionalCastExprClass, ty, VK, kind, castExpr,
1841 pathSize, FPO.requiresTrailingStorage(), writtenTy),
1842 LParenLoc(lParenLoc), RParenLoc(rParenLoc) {
1843 if (hasStoredFPFeatures())
1844 *getTrailingFPFeatures() = FPO;
1845 }
1846
1847 explicit CXXFunctionalCastExpr(EmptyShell Shell, unsigned PathSize,
1848 bool HasFPFeatures)
1849 : ExplicitCastExpr(CXXFunctionalCastExprClass, Shell, PathSize,
1850 HasFPFeatures) {}
1851
1852 unsigned numTrailingObjects(OverloadToken<CXXBaseSpecifier *>) const {
1853 return path_size();
1854 }
1855
1856public:
1857 friend class CastExpr;
1859
1860 static CXXFunctionalCastExpr *
1861 Create(const ASTContext &Context, QualType T, ExprValueKind VK,
1862 TypeSourceInfo *Written, CastKind Kind, Expr *Op,
1863 const CXXCastPath *Path, FPOptionsOverride FPO, SourceLocation LPLoc,
1864 SourceLocation RPLoc);
1865 static CXXFunctionalCastExpr *
1866 CreateEmpty(const ASTContext &Context, unsigned PathSize, bool HasFPFeatures);
1867
1868 SourceLocation getLParenLoc() const { return LParenLoc; }
1869 void setLParenLoc(SourceLocation L) { LParenLoc = L; }
1870 SourceLocation getRParenLoc() const { return RParenLoc; }
1871 void setRParenLoc(SourceLocation L) { RParenLoc = L; }
1872
1873 /// Determine whether this expression models list-initialization.
1874 bool isListInitialization() const { return LParenLoc.isInvalid(); }
1875
1876 SourceLocation getBeginLoc() const LLVM_READONLY;
1877 SourceLocation getEndLoc() const LLVM_READONLY;
1878
1879 static bool classof(const Stmt *T) {
1880 return T->getStmtClass() == CXXFunctionalCastExprClass;
1881 }
1882};
1883
1884/// Represents a C++ functional cast expression that builds a
1885/// temporary object.
1886///
1887/// This expression type represents a C++ "functional" cast
1888/// (C++[expr.type.conv]) with N != 1 arguments that invokes a
1889/// constructor to build a temporary object. With N == 1 arguments the
1890/// functional cast expression will be represented by CXXFunctionalCastExpr.
1891/// Example:
1892/// \code
1893/// struct X { X(int, float); }
1894///
1895/// X create_X() {
1896/// return X(1, 3.14f); // creates a CXXTemporaryObjectExpr
1897/// };
1898/// \endcode
1899class CXXTemporaryObjectExpr final : public CXXConstructExpr {
1900 friend class ASTStmtReader;
1901
1902 // CXXTemporaryObjectExpr has some trailing objects belonging
1903 // to CXXConstructExpr. See the comment inside CXXConstructExpr
1904 // for more details.
1905
1906 TypeSourceInfo *TSI;
1907
1908 CXXTemporaryObjectExpr(CXXConstructorDecl *Cons, QualType Ty,
1910 SourceRange ParenOrBraceRange,
1911 bool HadMultipleCandidates, bool ListInitialization,
1912 bool StdInitListInitialization,
1913 bool ZeroInitialization);
1914
1915 CXXTemporaryObjectExpr(EmptyShell Empty, unsigned NumArgs);
1916
1917public:
1918 static CXXTemporaryObjectExpr *
1919 Create(const ASTContext &Ctx, CXXConstructorDecl *Cons, QualType Ty,
1921 SourceRange ParenOrBraceRange, bool HadMultipleCandidates,
1922 bool ListInitialization, bool StdInitListInitialization,
1923 bool ZeroInitialization);
1924
1925 static CXXTemporaryObjectExpr *CreateEmpty(const ASTContext &Ctx,
1926 unsigned NumArgs);
1927
1928 TypeSourceInfo *getTypeSourceInfo() const { return TSI; }
1929
1930 SourceLocation getBeginLoc() const LLVM_READONLY;
1931 SourceLocation getEndLoc() const LLVM_READONLY;
1932
1933 static bool classof(const Stmt *T) {
1934 return T->getStmtClass() == CXXTemporaryObjectExprClass;
1935 }
1936};
1937
1938Stmt **CXXConstructExpr::getTrailingArgs() {
1939 if (auto *E = dyn_cast<CXXTemporaryObjectExpr>(this))
1940 return reinterpret_cast<Stmt **>(E + 1);
1941 assert((getStmtClass() == CXXConstructExprClass) &&
1942 "Unexpected class deriving from CXXConstructExpr!");
1943 return reinterpret_cast<Stmt **>(this + 1);
1944}
1945
1946/// A C++ lambda expression, which produces a function object
1947/// (of unspecified type) that can be invoked later.
1948///
1949/// Example:
1950/// \code
1951/// void low_pass_filter(std::vector<double> &values, double cutoff) {
1952/// values.erase(std::remove_if(values.begin(), values.end(),
1953/// [=](double value) { return value > cutoff; });
1954/// }
1955/// \endcode
1956///
1957/// C++11 lambda expressions can capture local variables, either by copying
1958/// the values of those local variables at the time the function
1959/// object is constructed (not when it is called!) or by holding a
1960/// reference to the local variable. These captures can occur either
1961/// implicitly or can be written explicitly between the square
1962/// brackets ([...]) that start the lambda expression.
1963///
1964/// C++1y introduces a new form of "capture" called an init-capture that
1965/// includes an initializing expression (rather than capturing a variable),
1966/// and which can never occur implicitly.
1967class LambdaExpr final : public Expr,
1968 private llvm::TrailingObjects<LambdaExpr, Stmt *> {
1969 // LambdaExpr has some data stored in LambdaExprBits.
1970
1971 /// The source range that covers the lambda introducer ([...]).
1972 SourceRange IntroducerRange;
1973
1974 /// The source location of this lambda's capture-default ('=' or '&').
1975 SourceLocation CaptureDefaultLoc;
1976
1977 /// The location of the closing brace ('}') that completes
1978 /// the lambda.
1979 ///
1980 /// The location of the brace is also available by looking up the
1981 /// function call operator in the lambda class. However, it is
1982 /// stored here to improve the performance of getSourceRange(), and
1983 /// to avoid having to deserialize the function call operator from a
1984 /// module file just to determine the source range.
1985 SourceLocation ClosingBrace;
1986
1987 /// Construct a lambda expression.
1988 LambdaExpr(QualType T, SourceRange IntroducerRange,
1989 LambdaCaptureDefault CaptureDefault,
1990 SourceLocation CaptureDefaultLoc, bool ExplicitParams,
1991 bool ExplicitResultType, ArrayRef<Expr *> CaptureInits,
1992 SourceLocation ClosingBrace, bool ContainsUnexpandedParameterPack);
1993
1994 /// Construct an empty lambda expression.
1995 LambdaExpr(EmptyShell Empty, unsigned NumCaptures);
1996
1997 Stmt **getStoredStmts() { return getTrailingObjects(); }
1998 Stmt *const *getStoredStmts() const { return getTrailingObjects(); }
1999
2000 void initBodyIfNeeded() const;
2001
2002public:
2003 friend class ASTStmtReader;
2004 friend class ASTStmtWriter;
2006
2007 /// Construct a new lambda expression.
2008 static LambdaExpr *
2009 Create(const ASTContext &C, CXXRecordDecl *Class, SourceRange IntroducerRange,
2010 LambdaCaptureDefault CaptureDefault, SourceLocation CaptureDefaultLoc,
2011 bool ExplicitParams, bool ExplicitResultType,
2012 ArrayRef<Expr *> CaptureInits, SourceLocation ClosingBrace,
2013 bool ContainsUnexpandedParameterPack);
2014
2015 /// Construct a new lambda expression that will be deserialized from
2016 /// an external source.
2017 static LambdaExpr *CreateDeserialized(const ASTContext &C,
2018 unsigned NumCaptures);
2019
2020 /// Determine the default capture kind for this lambda.
2022 return static_cast<LambdaCaptureDefault>(LambdaExprBits.CaptureDefault);
2023 }
2024
2025 /// Retrieve the location of this lambda's capture-default, if any.
2026 SourceLocation getCaptureDefaultLoc() const { return CaptureDefaultLoc; }
2027
2028 /// Determine whether one of this lambda's captures is an init-capture.
2029 bool isInitCapture(const LambdaCapture *Capture) const;
2030
2031 /// An iterator that walks over the captures of the lambda,
2032 /// both implicit and explicit.
2034
2035 /// An iterator over a range of lambda captures.
2036 using capture_range = llvm::iterator_range<capture_iterator>;
2037
2038 /// Retrieve this lambda's captures.
2039 capture_range captures() const;
2040
2041 /// Retrieve an iterator pointing to the first lambda capture.
2043
2044 /// Retrieve an iterator pointing past the end of the
2045 /// sequence of lambda captures.
2047
2048 /// Determine the number of captures in this lambda.
2049 unsigned capture_size() const { return LambdaExprBits.NumCaptures; }
2050
2051 /// Retrieve this lambda's explicit captures.
2053
2054 /// Retrieve an iterator pointing to the first explicit
2055 /// lambda capture.
2057
2058 /// Retrieve an iterator pointing past the end of the sequence of
2059 /// explicit lambda captures.
2061
2062 /// Retrieve this lambda's implicit captures.
2064
2065 /// Retrieve an iterator pointing to the first implicit
2066 /// lambda capture.
2068
2069 /// Retrieve an iterator pointing past the end of the sequence of
2070 /// implicit lambda captures.
2072
2073 /// Iterator that walks over the capture initialization
2074 /// arguments.
2076
2077 /// Const iterator that walks over the capture initialization
2078 /// arguments.
2079 /// FIXME: This interface is prone to being used incorrectly.
2081
2082 /// Retrieve the initialization expressions for this lambda's captures.
2083 llvm::iterator_range<capture_init_iterator> capture_inits() {
2084 return llvm::make_range(capture_init_begin(), capture_init_end());
2085 }
2086
2087 /// Retrieve the initialization expressions for this lambda's captures.
2088 llvm::iterator_range<const_capture_init_iterator> capture_inits() const {
2089 return llvm::make_range(capture_init_begin(), capture_init_end());
2090 }
2091
2092 /// Retrieve the first initialization argument for this
2093 /// lambda expression (which initializes the first capture field).
2095 return reinterpret_cast<Expr **>(getStoredStmts());
2096 }
2097
2098 /// Retrieve the first initialization argument for this
2099 /// lambda expression (which initializes the first capture field).
2101 return reinterpret_cast<Expr *const *>(getStoredStmts());
2102 }
2103
2104 /// Retrieve the iterator pointing one past the last
2105 /// initialization argument for this lambda expression.
2109
2110 /// Retrieve the iterator pointing one past the last
2111 /// initialization argument for this lambda expression.
2115
2116 /// Retrieve the source range covering the lambda introducer,
2117 /// which contains the explicit capture list surrounded by square
2118 /// brackets ([...]).
2119 SourceRange getIntroducerRange() const { return IntroducerRange; }
2120
2121 /// Retrieve the class that corresponds to the lambda.
2122 ///
2123 /// This is the "closure type" (C++1y [expr.prim.lambda]), and stores the
2124 /// captures in its fields and provides the various operations permitted
2125 /// on a lambda (copying, calling).
2127
2128 /// Retrieve the function call operator associated with this
2129 /// lambda expression.
2131
2132 /// Retrieve the function template call operator associated with this
2133 /// lambda expression.
2135
2136 /// If this is a generic lambda expression, retrieve the template
2137 /// parameter list associated with it, or else return null.
2139
2140 /// Get the template parameters were explicitly specified (as opposed to being
2141 /// invented by use of an auto parameter).
2143
2144 /// Get the trailing requires clause, if any.
2146
2147 /// Whether this is a generic lambda.
2149
2150 /// Retrieve the body of the lambda. This will be most of the time
2151 /// a \p CompoundStmt, but can also be \p CoroutineBodyStmt wrapping
2152 /// a \p CompoundStmt. Note that unlike functions, lambda-expressions
2153 /// cannot have a function-try-block.
2154 Stmt *getBody() const;
2155
2156 /// Retrieve the \p CompoundStmt representing the body of the lambda.
2157 /// This is a convenience function for callers who do not need
2158 /// to handle node(s) which may wrap a \p CompoundStmt.
2159 const CompoundStmt *getCompoundStmtBody() const;
2161 const auto *ConstThis = this;
2162 return const_cast<CompoundStmt *>(ConstThis->getCompoundStmtBody());
2163 }
2164
2165 /// Determine whether the lambda is mutable, meaning that any
2166 /// captures values can be modified.
2167 bool isMutable() const;
2168
2169 /// Determine whether this lambda has an explicit parameter
2170 /// list vs. an implicit (empty) parameter list.
2171 bool hasExplicitParameters() const { return LambdaExprBits.ExplicitParams; }
2172
2173 /// Whether this lambda had its result type explicitly specified.
2175 return LambdaExprBits.ExplicitResultType;
2176 }
2177
2178 static bool classof(const Stmt *T) {
2179 return T->getStmtClass() == LambdaExprClass;
2180 }
2181
2182 SourceLocation getBeginLoc() const LLVM_READONLY {
2183 return IntroducerRange.getBegin();
2184 }
2185
2186 SourceLocation getEndLoc() const LLVM_READONLY { return ClosingBrace; }
2187
2188 /// Includes the captures and the body of the lambda.
2191};
2192
2193/// An expression "T()" which creates an rvalue of a non-class type T.
2194/// For non-void T, the rvalue is value-initialized.
2195/// See (C++98 [5.2.3p2]).
2197 friend class ASTStmtReader;
2198
2199 TypeSourceInfo *TypeInfo;
2200
2201public:
2202 /// Create an explicitly-written scalar-value initialization
2203 /// expression.
2205 SourceLocation RParenLoc)
2206 : Expr(CXXScalarValueInitExprClass, Type, VK_PRValue, OK_Ordinary),
2207 TypeInfo(TypeInfo) {
2208 CXXScalarValueInitExprBits.RParenLoc = RParenLoc;
2210 }
2211
2213 : Expr(CXXScalarValueInitExprClass, Shell) {}
2214
2216 return TypeInfo;
2217 }
2218
2220 return CXXScalarValueInitExprBits.RParenLoc;
2221 }
2222
2223 SourceLocation getBeginLoc() const LLVM_READONLY;
2225
2226 static bool classof(const Stmt *T) {
2227 return T->getStmtClass() == CXXScalarValueInitExprClass;
2228 }
2229
2230 // Iterators
2234
2238};
2239
2241 /// New-expression has no initializer as written.
2243
2244 /// New-expression has a C++98 paren-delimited initializer.
2246
2247 /// New-expression has a C++11 list-initializer.
2249};
2250
2251enum class TypeAwareAllocationMode : unsigned { No, Yes };
2252
2256
2257inline TypeAwareAllocationMode
2258typeAwareAllocationModeFromBool(bool IsTypeAwareAllocation) {
2259 return IsTypeAwareAllocation ? TypeAwareAllocationMode::Yes
2261}
2262
2263enum class AlignedAllocationMode : unsigned { No, Yes };
2264
2266 return Mode == AlignedAllocationMode::Yes;
2267}
2268
2272
2273enum class SizedDeallocationMode : unsigned { No, Yes };
2274
2276 return Mode == SizedDeallocationMode::Yes;
2277}
2278
2282
2309
2342
2343/// The parameters to pass to a usual operator delete.
2350
2351/// Represents a new-expression for memory allocation and constructor
2352/// calls, e.g: "new CXXNewExpr(foo)".
2353class CXXNewExpr final
2354 : public Expr,
2355 private llvm::TrailingObjects<CXXNewExpr, Stmt *, SourceRange> {
2356 friend class ASTStmtReader;
2357 friend class ASTStmtWriter;
2358 friend TrailingObjects;
2359
2360 /// Points to the allocation function used.
2361 FunctionDecl *OperatorNew;
2362
2363 /// Points to the deallocation function used in case of error. May be null.
2364 FunctionDecl *OperatorDelete;
2365
2366 /// The allocated type-source information, as written in the source.
2367 TypeSourceInfo *AllocatedTypeInfo;
2368
2369 /// Range of the entire new expression.
2370 SourceRange Range;
2371
2372 /// Source-range of a paren-delimited initializer.
2373 SourceRange DirectInitRange;
2374
2375 // CXXNewExpr is followed by several optional trailing objects.
2376 // They are in order:
2377 //
2378 // * An optional "Stmt *" for the array size expression.
2379 // Present if and ony if isArray().
2380 //
2381 // * An optional "Stmt *" for the init expression.
2382 // Present if and only if hasInitializer().
2383 //
2384 // * An array of getNumPlacementArgs() "Stmt *" for the placement new
2385 // arguments, if any.
2386 //
2387 // * An optional SourceRange for the range covering the parenthesized type-id
2388 // if the allocated type was expressed as a parenthesized type-id.
2389 // Present if and only if isParenTypeId().
2390 unsigned arraySizeOffset() const { return 0; }
2391 unsigned initExprOffset() const { return arraySizeOffset() + isArray(); }
2392 unsigned placementNewArgsOffset() const {
2393 return initExprOffset() + hasInitializer();
2394 }
2395
2396 unsigned numTrailingObjects(OverloadToken<Stmt *>) const {
2398 }
2399
2400 unsigned numTrailingObjects(OverloadToken<SourceRange>) const {
2401 return isParenTypeId();
2402 }
2403
2404 /// Build a c++ new expression.
2405 CXXNewExpr(bool IsGlobalNew, FunctionDecl *OperatorNew,
2406 FunctionDecl *OperatorDelete,
2407 const ImplicitAllocationParameters &IAP,
2408 bool UsualArrayDeleteWantsSize, ArrayRef<Expr *> PlacementArgs,
2409 SourceRange TypeIdParens, std::optional<Expr *> ArraySize,
2410 CXXNewInitializationStyle InitializationStyle, Expr *Initializer,
2411 QualType Ty, TypeSourceInfo *AllocatedTypeInfo, SourceRange Range,
2412 SourceRange DirectInitRange);
2413
2414 /// Build an empty c++ new expression.
2415 CXXNewExpr(EmptyShell Empty, bool IsArray, unsigned NumPlacementArgs,
2416 bool IsParenTypeId);
2417
2418public:
2419 /// Create a c++ new expression.
2420 static CXXNewExpr *
2421 Create(const ASTContext &Ctx, bool IsGlobalNew, FunctionDecl *OperatorNew,
2422 FunctionDecl *OperatorDelete, const ImplicitAllocationParameters &IAP,
2423 bool UsualArrayDeleteWantsSize, ArrayRef<Expr *> PlacementArgs,
2424 SourceRange TypeIdParens, std::optional<Expr *> ArraySize,
2425 CXXNewInitializationStyle InitializationStyle, Expr *Initializer,
2426 QualType Ty, TypeSourceInfo *AllocatedTypeInfo, SourceRange Range,
2427 SourceRange DirectInitRange);
2428
2429 /// Create an empty c++ new expression.
2430 static CXXNewExpr *CreateEmpty(const ASTContext &Ctx, bool IsArray,
2431 bool HasInit, unsigned NumPlacementArgs,
2432 bool IsParenTypeId);
2433
2435 return getType()->castAs<PointerType>()->getPointeeType();
2436 }
2437
2439 return AllocatedTypeInfo;
2440 }
2441
2442 /// True if the allocation result needs to be null-checked.
2443 ///
2444 /// C++11 [expr.new]p13:
2445 /// If the allocation function returns null, initialization shall
2446 /// not be done, the deallocation function shall not be called,
2447 /// and the value of the new-expression shall be null.
2448 ///
2449 /// C++ DR1748:
2450 /// If the allocation function is a reserved placement allocation
2451 /// function that returns null, the behavior is undefined.
2452 ///
2453 /// An allocation function is not allowed to return null unless it
2454 /// has a non-throwing exception-specification. The '03 rule is
2455 /// identical except that the definition of a non-throwing
2456 /// exception specification is just "is it throw()?".
2457 bool shouldNullCheckAllocation() const;
2458
2459 FunctionDecl *getOperatorNew() const { return OperatorNew; }
2460 void setOperatorNew(FunctionDecl *D) { OperatorNew = D; }
2461 FunctionDecl *getOperatorDelete() const { return OperatorDelete; }
2462 void setOperatorDelete(FunctionDecl *D) { OperatorDelete = D; }
2463
2464 bool isArray() const { return CXXNewExprBits.IsArray; }
2465
2466 /// This might return std::nullopt even if isArray() returns true,
2467 /// since there might not be an array size expression.
2468 /// If the result is not std::nullopt, it will never wrap a nullptr.
2469 std::optional<Expr *> getArraySize() {
2470 if (!isArray())
2471 return std::nullopt;
2472
2473 if (auto *Result =
2474 cast_or_null<Expr>(getTrailingObjects<Stmt *>()[arraySizeOffset()]))
2475 return Result;
2476
2477 return std::nullopt;
2478 }
2479
2480 /// This might return std::nullopt even if isArray() returns true,
2481 /// since there might not be an array size expression.
2482 /// If the result is not std::nullopt, it will never wrap a nullptr.
2483 std::optional<const Expr *> getArraySize() const {
2484 if (!isArray())
2485 return std::nullopt;
2486
2487 if (auto *Result =
2488 cast_or_null<Expr>(getTrailingObjects<Stmt *>()[arraySizeOffset()]))
2489 return Result;
2490
2491 return std::nullopt;
2492 }
2493
2494 unsigned getNumPlacementArgs() const {
2495 return CXXNewExprBits.NumPlacementArgs;
2496 }
2497
2499 return reinterpret_cast<Expr **>(getTrailingObjects<Stmt *>() +
2500 placementNewArgsOffset());
2501 }
2502
2503 Expr *getPlacementArg(unsigned I) {
2504 assert((I < getNumPlacementArgs()) && "Index out of range!");
2505 return getPlacementArgs()[I];
2506 }
2507 const Expr *getPlacementArg(unsigned I) const {
2508 return const_cast<CXXNewExpr *>(this)->getPlacementArg(I);
2509 }
2510
2511 unsigned getNumImplicitArgs() const {
2513 }
2514
2515 bool isParenTypeId() const { return CXXNewExprBits.IsParenTypeId; }
2517 return isParenTypeId() ? getTrailingObjects<SourceRange>()[0]
2518 : SourceRange();
2519 }
2520
2521 bool isGlobalNew() const { return CXXNewExprBits.IsGlobalNew; }
2522
2523 /// Whether this new-expression has any initializer at all.
2524 bool hasInitializer() const { return CXXNewExprBits.HasInitializer; }
2525
2526 /// The kind of initializer this new-expression has.
2528 return static_cast<CXXNewInitializationStyle>(
2529 CXXNewExprBits.StoredInitializationStyle);
2530 }
2531
2532 /// The initializer of this new-expression.
2534 return hasInitializer()
2535 ? cast<Expr>(getTrailingObjects<Stmt *>()[initExprOffset()])
2536 : nullptr;
2537 }
2538 const Expr *getInitializer() const {
2539 return hasInitializer()
2540 ? cast<Expr>(getTrailingObjects<Stmt *>()[initExprOffset()])
2541 : nullptr;
2542 }
2543
2544 /// Returns the CXXConstructExpr from this new-expression, or null.
2546 return dyn_cast_or_null<CXXConstructExpr>(getInitializer());
2547 }
2548
2549 /// Indicates whether the required alignment should be implicitly passed to
2550 /// the allocation function.
2551 bool passAlignment() const { return CXXNewExprBits.ShouldPassAlignment; }
2552
2553 /// Answers whether the usual array deallocation function for the
2554 /// allocated type expects the size of the allocation as a
2555 /// parameter.
2557 return CXXNewExprBits.UsualArrayDeleteWantsSize;
2558 }
2559
2560 /// Provides the full set of information about expected implicit
2561 /// parameters in this call
2568
2571
2572 llvm::iterator_range<arg_iterator> placement_arguments() {
2573 return llvm::make_range(placement_arg_begin(), placement_arg_end());
2574 }
2575
2576 llvm::iterator_range<const_arg_iterator> placement_arguments() const {
2577 return llvm::make_range(placement_arg_begin(), placement_arg_end());
2578 }
2579
2581 return getTrailingObjects<Stmt *>() + placementNewArgsOffset();
2582 }
2587 return getTrailingObjects<Stmt *>() + placementNewArgsOffset();
2588 }
2592
2594
2595 raw_arg_iterator raw_arg_begin() { return getTrailingObjects<Stmt *>(); }
2597 return raw_arg_begin() + numTrailingObjects(OverloadToken<Stmt *>());
2598 }
2600 return getTrailingObjects<Stmt *>();
2601 }
2603 return raw_arg_begin() + numTrailingObjects(OverloadToken<Stmt *>());
2604 }
2605
2606 SourceLocation getBeginLoc() const { return Range.getBegin(); }
2607 SourceLocation getEndLoc() const { return Range.getEnd(); }
2608
2609 SourceRange getDirectInitRange() const { return DirectInitRange; }
2610 SourceRange getSourceRange() const { return Range; }
2611
2612 static bool classof(const Stmt *T) {
2613 return T->getStmtClass() == CXXNewExprClass;
2614 }
2615
2616 // Iterators
2618
2620 return const_child_range(const_cast<CXXNewExpr *>(this)->children());
2621 }
2622};
2623
2624/// Represents a \c delete expression for memory deallocation and
2625/// destructor calls, e.g. "delete[] pArray".
2626class CXXDeleteExpr : public Expr {
2627 friend class ASTStmtReader;
2628
2629 /// Points to the operator delete overload that is used. Could be a member.
2630 FunctionDecl *OperatorDelete = nullptr;
2631
2632 /// The pointer expression to be deleted.
2633 Stmt *Argument = nullptr;
2634
2635public:
2636 CXXDeleteExpr(QualType Ty, bool GlobalDelete, bool ArrayForm,
2637 bool ArrayFormAsWritten, bool UsualArrayDeleteWantsSize,
2638 FunctionDecl *OperatorDelete, Expr *Arg, SourceLocation Loc)
2639 : Expr(CXXDeleteExprClass, Ty, VK_PRValue, OK_Ordinary),
2640 OperatorDelete(OperatorDelete), Argument(Arg) {
2641 CXXDeleteExprBits.GlobalDelete = GlobalDelete;
2642 CXXDeleteExprBits.ArrayForm = ArrayForm;
2643 CXXDeleteExprBits.ArrayFormAsWritten = ArrayFormAsWritten;
2644 CXXDeleteExprBits.UsualArrayDeleteWantsSize = UsualArrayDeleteWantsSize;
2645 CXXDeleteExprBits.Loc = Loc;
2647 }
2648
2649 explicit CXXDeleteExpr(EmptyShell Shell) : Expr(CXXDeleteExprClass, Shell) {}
2650
2651 bool isGlobalDelete() const { return CXXDeleteExprBits.GlobalDelete; }
2652 bool isArrayForm() const { return CXXDeleteExprBits.ArrayForm; }
2654 return CXXDeleteExprBits.ArrayFormAsWritten;
2655 }
2656
2657 /// Answers whether the usual array deallocation function for the
2658 /// allocated type expects the size of the allocation as a
2659 /// parameter. This can be true even if the actual deallocation
2660 /// function that we're using doesn't want a size.
2662 return CXXDeleteExprBits.UsualArrayDeleteWantsSize;
2663 }
2664
2665 FunctionDecl *getOperatorDelete() const { return OperatorDelete; }
2666
2667 Expr *getArgument() { return cast<Expr>(Argument); }
2668 const Expr *getArgument() const { return cast<Expr>(Argument); }
2669
2670 /// Retrieve the type being destroyed.
2671 ///
2672 /// If the type being destroyed is a dependent type which may or may not
2673 /// be a pointer, return an invalid type.
2674 QualType getDestroyedType() const;
2675
2677 SourceLocation getEndLoc() const LLVM_READONLY {
2678 return Argument->getEndLoc();
2679 }
2680
2681 static bool classof(const Stmt *T) {
2682 return T->getStmtClass() == CXXDeleteExprClass;
2683 }
2684
2685 // Iterators
2686 child_range children() { return child_range(&Argument, &Argument + 1); }
2687
2689 return const_child_range(&Argument, &Argument + 1);
2690 }
2691};
2692
2693/// Stores the type being destroyed by a pseudo-destructor expression.
2695 /// Either the type source information or the name of the type, if
2696 /// it couldn't be resolved due to type-dependence.
2697 llvm::PointerUnion<TypeSourceInfo *, const IdentifierInfo *> Type;
2698
2699 /// The starting source location of the pseudo-destructor type.
2700 SourceLocation Location;
2701
2702public:
2704
2706 : Type(II), Location(Loc) {}
2707
2709
2711 return Type.dyn_cast<TypeSourceInfo *>();
2712 }
2713
2715 return Type.dyn_cast<const IdentifierInfo *>();
2716 }
2717
2718 SourceLocation getLocation() const { return Location; }
2719};
2720
2721/// Represents a C++ pseudo-destructor (C++ [expr.pseudo]).
2722///
2723/// A pseudo-destructor is an expression that looks like a member access to a
2724/// destructor of a scalar type, except that scalar types don't have
2725/// destructors. For example:
2726///
2727/// \code
2728/// typedef int T;
2729/// void f(int *p) {
2730/// p->T::~T();
2731/// }
2732/// \endcode
2733///
2734/// Pseudo-destructors typically occur when instantiating templates such as:
2735///
2736/// \code
2737/// template<typename T>
2738/// void destroy(T* ptr) {
2739/// ptr->T::~T();
2740/// }
2741/// \endcode
2742///
2743/// for scalar types. A pseudo-destructor expression has no run-time semantics
2744/// beyond evaluating the base expression.
2746 friend class ASTStmtReader;
2747
2748 /// The base expression (that is being destroyed).
2749 Stmt *Base = nullptr;
2750
2751 /// Whether the operator was an arrow ('->'); otherwise, it was a
2752 /// period ('.').
2753 LLVM_PREFERRED_TYPE(bool)
2754 bool IsArrow : 1;
2755
2756 /// The location of the '.' or '->' operator.
2757 SourceLocation OperatorLoc;
2758
2759 /// The nested-name-specifier that follows the operator, if present.
2760 NestedNameSpecifierLoc QualifierLoc;
2761
2762 /// The type that precedes the '::' in a qualified pseudo-destructor
2763 /// expression.
2764 TypeSourceInfo *ScopeType = nullptr;
2765
2766 /// The location of the '::' in a qualified pseudo-destructor
2767 /// expression.
2768 SourceLocation ColonColonLoc;
2769
2770 /// The location of the '~'.
2771 SourceLocation TildeLoc;
2772
2773 /// The type being destroyed, or its name if we were unable to
2774 /// resolve the name.
2775 PseudoDestructorTypeStorage DestroyedType;
2776
2777public:
2778 CXXPseudoDestructorExpr(const ASTContext &Context,
2779 Expr *Base, bool isArrow, SourceLocation OperatorLoc,
2780 NestedNameSpecifierLoc QualifierLoc,
2781 TypeSourceInfo *ScopeType,
2782 SourceLocation ColonColonLoc,
2783 SourceLocation TildeLoc,
2784 PseudoDestructorTypeStorage DestroyedType);
2785
2787 : Expr(CXXPseudoDestructorExprClass, Shell), IsArrow(false) {}
2788
2789 Expr *getBase() const { return cast<Expr>(Base); }
2790
2791 /// Determines whether this member expression actually had
2792 /// a C++ nested-name-specifier prior to the name of the member, e.g.,
2793 /// x->Base::foo.
2794 bool hasQualifier() const { return QualifierLoc.hasQualifier(); }
2795
2796 /// Retrieves the nested-name-specifier that qualifies the type name,
2797 /// with source-location information.
2798 NestedNameSpecifierLoc getQualifierLoc() const { return QualifierLoc; }
2799
2800 /// If the member name was qualified, retrieves the
2801 /// nested-name-specifier that precedes the member name. Otherwise, returns
2802 /// null.
2804 return QualifierLoc.getNestedNameSpecifier();
2805 }
2806
2807 /// Determine whether this pseudo-destructor expression was written
2808 /// using an '->' (otherwise, it used a '.').
2809 bool isArrow() const { return IsArrow; }
2810
2811 /// Retrieve the location of the '.' or '->' operator.
2812 SourceLocation getOperatorLoc() const { return OperatorLoc; }
2813
2814 /// Retrieve the scope type in a qualified pseudo-destructor
2815 /// expression.
2816 ///
2817 /// Pseudo-destructor expressions can have extra qualification within them
2818 /// that is not part of the nested-name-specifier, e.g., \c p->T::~T().
2819 /// Here, if the object type of the expression is (or may be) a scalar type,
2820 /// \p T may also be a scalar type and, therefore, cannot be part of a
2821 /// nested-name-specifier. It is stored as the "scope type" of the pseudo-
2822 /// destructor expression.
2823 TypeSourceInfo *getScopeTypeInfo() const { return ScopeType; }
2824
2825 /// Retrieve the location of the '::' in a qualified pseudo-destructor
2826 /// expression.
2827 SourceLocation getColonColonLoc() const { return ColonColonLoc; }
2828
2829 /// Retrieve the location of the '~'.
2830 SourceLocation getTildeLoc() const { return TildeLoc; }
2831
2832 /// Retrieve the source location information for the type
2833 /// being destroyed.
2834 ///
2835 /// This type-source information is available for non-dependent
2836 /// pseudo-destructor expressions and some dependent pseudo-destructor
2837 /// expressions. Returns null if we only have the identifier for a
2838 /// dependent pseudo-destructor expression.
2840 return DestroyedType.getTypeSourceInfo();
2841 }
2842
2843 /// In a dependent pseudo-destructor expression for which we do not
2844 /// have full type information on the destroyed type, provides the name
2845 /// of the destroyed type.
2847 return DestroyedType.getIdentifier();
2848 }
2849
2850 /// Retrieve the type being destroyed.
2851 QualType getDestroyedType() const;
2852
2853 /// Retrieve the starting location of the type being destroyed.
2855 return DestroyedType.getLocation();
2856 }
2857
2858 /// Set the name of destroyed type for a dependent pseudo-destructor
2859 /// expression.
2861 DestroyedType = PseudoDestructorTypeStorage(II, Loc);
2862 }
2863
2864 /// Set the destroyed type.
2866 DestroyedType = PseudoDestructorTypeStorage(Info);
2867 }
2868
2869 SourceLocation getBeginLoc() const LLVM_READONLY {
2870 return Base->getBeginLoc();
2871 }
2872 SourceLocation getEndLoc() const LLVM_READONLY;
2873
2874 static bool classof(const Stmt *T) {
2875 return T->getStmtClass() == CXXPseudoDestructorExprClass;
2876 }
2877
2878 // Iterators
2879 child_range children() { return child_range(&Base, &Base + 1); }
2880
2882 return const_child_range(&Base, &Base + 1);
2883 }
2884};
2885
2886/// A type trait used in the implementation of various C++11 and
2887/// Library TR1 trait templates.
2888///
2889/// \code
2890/// __is_pod(int) == true
2891/// __is_enum(std::string) == false
2892/// __is_trivially_constructible(vector<int>, int*, int*)
2893/// \endcode
2894class TypeTraitExpr final
2895 : public Expr,
2896 private llvm::TrailingObjects<TypeTraitExpr, APValue, TypeSourceInfo *> {
2897 /// The location of the type trait keyword.
2898 SourceLocation Loc;
2899
2900 /// The location of the closing parenthesis.
2901 SourceLocation RParenLoc;
2902
2903 TypeTraitExpr(QualType T, SourceLocation Loc, TypeTrait Kind,
2905 std::variant<bool, APValue> Value);
2906
2907 TypeTraitExpr(EmptyShell Empty, bool IsStoredAsBool);
2908
2909 size_t numTrailingObjects(OverloadToken<TypeSourceInfo *>) const {
2910 return getNumArgs();
2911 }
2912
2913 size_t numTrailingObjects(OverloadToken<APValue>) const {
2914 return TypeTraitExprBits.IsBooleanTypeTrait ? 0 : 1;
2915 }
2916
2917public:
2918 friend class ASTStmtReader;
2919 friend class ASTStmtWriter;
2921
2922 /// Create a new type trait expression.
2923 static TypeTraitExpr *Create(const ASTContext &C, QualType T,
2924 SourceLocation Loc, TypeTrait Kind,
2926 SourceLocation RParenLoc,
2927 bool Value);
2928
2929 static TypeTraitExpr *Create(const ASTContext &C, QualType T,
2930 SourceLocation Loc, TypeTrait Kind,
2932 SourceLocation RParenLoc, APValue Value);
2933
2934 static TypeTraitExpr *CreateDeserialized(const ASTContext &C,
2935 bool IsStoredAsBool,
2936 unsigned NumArgs);
2937
2938 /// Determine which type trait this expression uses.
2940 return static_cast<TypeTrait>(TypeTraitExprBits.Kind);
2941 }
2942
2943 bool isStoredAsBoolean() const {
2944 return TypeTraitExprBits.IsBooleanTypeTrait;
2945 }
2946
2947 bool getBoolValue() const {
2948 assert(!isValueDependent() && TypeTraitExprBits.IsBooleanTypeTrait);
2949 return TypeTraitExprBits.Value;
2950 }
2951
2952 const APValue &getAPValue() const {
2953 assert(!isValueDependent() && !TypeTraitExprBits.IsBooleanTypeTrait);
2954 return *getTrailingObjects<APValue>();
2955 }
2956
2957 /// Determine the number of arguments to this type trait.
2958 unsigned getNumArgs() const { return TypeTraitExprBits.NumArgs; }
2959
2960 /// Retrieve the Ith argument.
2961 TypeSourceInfo *getArg(unsigned I) const {
2962 assert(I < getNumArgs() && "Argument out-of-range");
2963 return getArgs()[I];
2964 }
2965
2966 /// Retrieve the argument types.
2968 return getTrailingObjects<TypeSourceInfo *>(getNumArgs());
2969 }
2970
2971 SourceLocation getBeginLoc() const LLVM_READONLY { return Loc; }
2972 SourceLocation getEndLoc() const LLVM_READONLY { return RParenLoc; }
2973
2974 static bool classof(const Stmt *T) {
2975 return T->getStmtClass() == TypeTraitExprClass;
2976 }
2977
2978 // Iterators
2982
2986};
2987
2988/// An Embarcadero array type trait, as used in the implementation of
2989/// __array_rank and __array_extent.
2990///
2991/// Example:
2992/// \code
2993/// __array_rank(int[10][20]) == 2
2994/// __array_extent(int[10][20], 1) == 20
2995/// \endcode
2996class ArrayTypeTraitExpr : public Expr {
2997 /// The value of the type trait. Unspecified if dependent.
2998 uint64_t Value = 0;
2999
3000 /// The array dimension being queried, or -1 if not used.
3001 Expr *Dimension;
3002
3003 /// The location of the type trait keyword.
3004 SourceLocation Loc;
3005
3006 /// The location of the closing paren.
3007 SourceLocation RParen;
3008
3009 /// The type being queried.
3010 TypeSourceInfo *QueriedType = nullptr;
3011
3012public:
3013 friend class ASTStmtReader;
3014
3016 TypeSourceInfo *queried, uint64_t value, Expr *dimension,
3017 SourceLocation rparen, QualType ty)
3018 : Expr(ArrayTypeTraitExprClass, ty, VK_PRValue, OK_Ordinary),
3019 Value(value), Dimension(dimension), Loc(loc), RParen(rparen),
3020 QueriedType(queried) {
3021 assert(att <= ATT_Last && "invalid enum value!");
3022 ArrayTypeTraitExprBits.ATT = att;
3023 assert(static_cast<unsigned>(att) == ArrayTypeTraitExprBits.ATT &&
3024 "ATT overflow!");
3026 }
3027
3029 : Expr(ArrayTypeTraitExprClass, Empty) {
3030 ArrayTypeTraitExprBits.ATT = 0;
3031 }
3032
3033 SourceLocation getBeginLoc() const LLVM_READONLY { return Loc; }
3034 SourceLocation getEndLoc() const LLVM_READONLY { return RParen; }
3035
3037 return static_cast<ArrayTypeTrait>(ArrayTypeTraitExprBits.ATT);
3038 }
3039
3040 QualType getQueriedType() const { return QueriedType->getType(); }
3041
3042 TypeSourceInfo *getQueriedTypeSourceInfo() const { return QueriedType; }
3043
3044 uint64_t getValue() const { assert(!isTypeDependent()); return Value; }
3045
3046 Expr *getDimensionExpression() const { return Dimension; }
3047
3048 static bool classof(const Stmt *T) {
3049 return T->getStmtClass() == ArrayTypeTraitExprClass;
3050 }
3051
3052 // Iterators
3056
3060};
3061
3062/// An expression trait intrinsic.
3063///
3064/// Example:
3065/// \code
3066/// __is_lvalue_expr(std::cout) == true
3067/// __is_lvalue_expr(1) == false
3068/// \endcode
3070 /// The location of the type trait keyword.
3071 SourceLocation Loc;
3072
3073 /// The location of the closing paren.
3074 SourceLocation RParen;
3075
3076 /// The expression being queried.
3077 Expr* QueriedExpression = nullptr;
3078
3079public:
3080 friend class ASTStmtReader;
3081
3083 bool value, SourceLocation rparen, QualType resultType)
3084 : Expr(ExpressionTraitExprClass, resultType, VK_PRValue, OK_Ordinary),
3085 Loc(loc), RParen(rparen), QueriedExpression(queried) {
3087 ExpressionTraitExprBits.Value = value;
3088
3089 assert(et <= ET_Last && "invalid enum value!");
3090 assert(static_cast<unsigned>(et) == ExpressionTraitExprBits.ET &&
3091 "ET overflow!");
3093 }
3094
3096 : Expr(ExpressionTraitExprClass, Empty) {
3098 ExpressionTraitExprBits.Value = false;
3099 }
3100
3101 SourceLocation getBeginLoc() const LLVM_READONLY { return Loc; }
3102 SourceLocation getEndLoc() const LLVM_READONLY { return RParen; }
3103
3105 return static_cast<ExpressionTrait>(ExpressionTraitExprBits.ET);
3106 }
3107
3108 Expr *getQueriedExpression() const { return QueriedExpression; }
3109
3110 bool getValue() const { return ExpressionTraitExprBits.Value; }
3111
3112 static bool classof(const Stmt *T) {
3113 return T->getStmtClass() == ExpressionTraitExprClass;
3114 }
3115
3116 // Iterators
3120
3124};
3125
3126/// A reference to an overloaded function set, either an
3127/// \c UnresolvedLookupExpr or an \c UnresolvedMemberExpr.
3128class OverloadExpr : public Expr {
3129 friend class ASTStmtReader;
3130 friend class ASTStmtWriter;
3131
3132 /// The common name of these declarations.
3133 DeclarationNameInfo NameInfo;
3134
3135 /// The nested-name-specifier that qualifies the name, if any.
3136 NestedNameSpecifierLoc QualifierLoc;
3137
3138protected:
3139 OverloadExpr(StmtClass SC, const ASTContext &Context,
3140 NestedNameSpecifierLoc QualifierLoc,
3141 SourceLocation TemplateKWLoc,
3142 const DeclarationNameInfo &NameInfo,
3143 const TemplateArgumentListInfo *TemplateArgs,
3145 bool KnownDependent, bool KnownInstantiationDependent,
3146 bool KnownContainsUnexpandedParameterPack);
3147
3148 OverloadExpr(StmtClass SC, EmptyShell Empty, unsigned NumResults,
3149 bool HasTemplateKWAndArgsInfo);
3150
3151 /// Return the results. Defined after UnresolvedMemberExpr.
3154 return const_cast<OverloadExpr *>(this)->getTrailingResults();
3155 }
3156
3157 /// Return the optional template keyword and arguments info.
3158 /// Defined after UnresolvedMemberExpr.
3164
3165 /// Return the optional template arguments. Defined after
3166 /// UnresolvedMemberExpr.
3169 return const_cast<OverloadExpr *>(this)->getTrailingTemplateArgumentLoc();
3170 }
3171
3173 return OverloadExprBits.HasTemplateKWAndArgsInfo;
3174 }
3175
3176public:
3183
3184 /// Finds the overloaded expression in the given expression \p E of
3185 /// OverloadTy.
3186 ///
3187 /// \return the expression (which must be there) and true if it has
3188 /// the particular form of a member pointer expression
3189 static FindResult find(Expr *E) {
3190 assert(E->getType()->isSpecificBuiltinType(BuiltinType::Overload));
3191
3193 bool HasParen = isa<ParenExpr>(E);
3194
3195 E = E->IgnoreParens();
3196 if (isa<UnaryOperator>(E)) {
3197 assert(cast<UnaryOperator>(E)->getOpcode() == UO_AddrOf);
3198 E = cast<UnaryOperator>(E)->getSubExpr();
3199 auto *Ovl = cast<OverloadExpr>(E->IgnoreParens());
3200
3201 Result.HasFormOfMemberPointer = (E == Ovl && Ovl->getQualifier());
3202 Result.IsAddressOfOperand = true;
3203 Result.IsAddressOfOperandWithParen = HasParen;
3204 Result.Expression = Ovl;
3205 } else {
3206 Result.Expression = cast<OverloadExpr>(E);
3207 }
3208
3209 return Result;
3210 }
3211
3212 /// Gets the naming class of this lookup, if any.
3213 /// Defined after UnresolvedMemberExpr.
3214 inline CXXRecordDecl *getNamingClass();
3216 return const_cast<OverloadExpr *>(this)->getNamingClass();
3217 }
3218
3220
3227 llvm::iterator_range<decls_iterator> decls() const {
3228 return llvm::make_range(decls_begin(), decls_end());
3229 }
3230
3231 /// Gets the number of declarations in the unresolved set.
3232 unsigned getNumDecls() const { return OverloadExprBits.NumResults; }
3233
3234 /// Gets the full name info.
3235 const DeclarationNameInfo &getNameInfo() const { return NameInfo; }
3236
3237 /// Gets the name looked up.
3238 DeclarationName getName() const { return NameInfo.getName(); }
3239
3240 /// Gets the location of the name.
3241 SourceLocation getNameLoc() const { return NameInfo.getLoc(); }
3242
3243 /// Fetches the nested-name qualifier, if one was given.
3245 return QualifierLoc.getNestedNameSpecifier();
3246 }
3247
3248 /// Fetches the nested-name qualifier with source-location
3249 /// information, if one was given.
3250 NestedNameSpecifierLoc getQualifierLoc() const { return QualifierLoc; }
3251
3252 /// Retrieve the location of the template keyword preceding
3253 /// this name, if any.
3259
3260 /// Retrieve the location of the left angle bracket starting the
3261 /// explicit template argument list following the name, if any.
3267
3268 /// Retrieve the location of the right angle bracket ending the
3269 /// explicit template argument list following the name, if any.
3275
3276 /// Determines whether the name was preceded by the template keyword.
3278
3279 /// Determines whether this expression had explicit template arguments.
3282 return false;
3283 // FIXME: deduced function types can have "hidden" args and no <
3284 // investigate that further, but ultimately maybe we want to model concepts
3285 // reference with another kind of expression.
3288 : getLAngleLoc().isValid();
3289 }
3290
3291 bool isConceptReference() const {
3292 return getNumDecls() == 1 && [&]() {
3293 if (auto *TTP = dyn_cast_or_null<TemplateTemplateParmDecl>(
3294 getTrailingResults()->getDecl()))
3295 return TTP->templateParameterKind() == TNK_Concept_template;
3296 if (isa<ConceptDecl>(getTrailingResults()->getDecl()))
3297 return true;
3298 return false;
3299 }();
3300 }
3301
3302 bool isVarDeclReference() const {
3303 return getNumDecls() == 1 && [&]() {
3304 if (auto *TTP = dyn_cast_or_null<TemplateTemplateParmDecl>(
3305 getTrailingResults()->getDecl()))
3306 return TTP->templateParameterKind() == TNK_Var_template;
3307 if (isa<VarTemplateDecl>(getTrailingResults()->getDecl()))
3308 return true;
3309 return false;
3310 }();
3311 }
3312
3314 assert(getNumDecls() == 1);
3315 return dyn_cast_or_null<TemplateDecl>(getTrailingResults()->getDecl());
3316 }
3317
3319 assert(getNumDecls() == 1);
3320 return dyn_cast_or_null<TemplateTemplateParmDecl>(
3321 getTrailingResults()->getDecl());
3322 }
3323
3326 return nullptr;
3327 return const_cast<OverloadExpr *>(this)->getTrailingTemplateArgumentLoc();
3328 }
3329
3330 unsigned getNumTemplateArgs() const {
3332 return 0;
3333
3335 }
3336
3340
3341 /// Copies the template arguments into the given structure.
3346
3347 static bool classof(const Stmt *T) {
3348 return T->getStmtClass() == UnresolvedLookupExprClass ||
3349 T->getStmtClass() == UnresolvedMemberExprClass;
3350 }
3351};
3352
3353/// A reference to a name which we were able to look up during
3354/// parsing but could not resolve to a specific declaration.
3355///
3356/// This arises in several ways:
3357/// * we might be waiting for argument-dependent lookup;
3358/// * the name might resolve to an overloaded function;
3359/// * the name might resolve to a non-function template; for example, in the
3360/// following snippet, the return expression of the member function
3361/// 'foo()' might remain unresolved until instantiation:
3362///
3363/// \code
3364/// struct P {
3365/// template <class T> using I = T;
3366/// };
3367///
3368/// struct Q {
3369/// template <class T> int foo() {
3370/// return T::template I<int>;
3371/// }
3372/// };
3373/// \endcode
3374///
3375/// ...which is distinct from modeling function overloads, and therefore we use
3376/// a different builtin type 'UnresolvedTemplate' to avoid confusion. This is
3377/// done in Sema::BuildTemplateIdExpr.
3378///
3379/// and eventually:
3380/// * the lookup might have included a function template.
3381/// * the unresolved template gets transformed in an instantiation or gets
3382/// diagnosed for its direct use.
3383///
3384/// These never include UnresolvedUsingValueDecls, which are always class
3385/// members and therefore appear only in UnresolvedMemberLookupExprs.
3386class UnresolvedLookupExpr final
3387 : public OverloadExpr,
3388 private llvm::TrailingObjects<UnresolvedLookupExpr, DeclAccessPair,
3389 ASTTemplateKWAndArgsInfo,
3390 TemplateArgumentLoc> {
3391 friend class ASTStmtReader;
3392 friend class OverloadExpr;
3393 friend TrailingObjects;
3394
3395 /// The naming class (C++ [class.access.base]p5) of the lookup, if
3396 /// any. This can generally be recalculated from the context chain,
3397 /// but that can be fairly expensive for unqualified lookups.
3398 CXXRecordDecl *NamingClass;
3399
3400 // UnresolvedLookupExpr is followed by several trailing objects.
3401 // They are in order:
3402 //
3403 // * An array of getNumResults() DeclAccessPair for the results. These are
3404 // undesugared, which is to say, they may include UsingShadowDecls.
3405 // Access is relative to the naming class.
3406 //
3407 // * An optional ASTTemplateKWAndArgsInfo for the explicitly specified
3408 // template keyword and arguments. Present if and only if
3409 // hasTemplateKWAndArgsInfo().
3410 //
3411 // * An array of getNumTemplateArgs() TemplateArgumentLoc containing
3412 // location information for the explicitly specified template arguments.
3413
3414 UnresolvedLookupExpr(const ASTContext &Context, CXXRecordDecl *NamingClass,
3415 NestedNameSpecifierLoc QualifierLoc,
3416 SourceLocation TemplateKWLoc,
3417 const DeclarationNameInfo &NameInfo, bool RequiresADL,
3418 const TemplateArgumentListInfo *TemplateArgs,
3420 bool KnownDependent, bool KnownInstantiationDependent);
3421
3422 UnresolvedLookupExpr(EmptyShell Empty, unsigned NumResults,
3423 bool HasTemplateKWAndArgsInfo);
3424
3425 unsigned numTrailingObjects(OverloadToken<DeclAccessPair>) const {
3426 return getNumDecls();
3427 }
3428
3429 unsigned numTrailingObjects(OverloadToken<ASTTemplateKWAndArgsInfo>) const {
3430 return hasTemplateKWAndArgsInfo();
3431 }
3432
3433public:
3434 static UnresolvedLookupExpr *
3435 Create(const ASTContext &Context, CXXRecordDecl *NamingClass,
3436 NestedNameSpecifierLoc QualifierLoc,
3437 const DeclarationNameInfo &NameInfo, bool RequiresADL,
3438 UnresolvedSetIterator Begin, UnresolvedSetIterator End,
3439 bool KnownDependent, bool KnownInstantiationDependent);
3440
3441 // After canonicalization, there may be dependent template arguments in
3442 // CanonicalConverted But none of Args is dependent. When any of
3443 // CanonicalConverted dependent, KnownDependent is true.
3444 static UnresolvedLookupExpr *
3445 Create(const ASTContext &Context, CXXRecordDecl *NamingClass,
3446 NestedNameSpecifierLoc QualifierLoc, SourceLocation TemplateKWLoc,
3447 const DeclarationNameInfo &NameInfo, bool RequiresADL,
3448 const TemplateArgumentListInfo *Args, UnresolvedSetIterator Begin,
3449 UnresolvedSetIterator End, bool KnownDependent,
3450 bool KnownInstantiationDependent);
3451
3452 static UnresolvedLookupExpr *CreateEmpty(const ASTContext &Context,
3453 unsigned NumResults,
3454 bool HasTemplateKWAndArgsInfo,
3455 unsigned NumTemplateArgs);
3456
3457 /// True if this declaration should be extended by
3458 /// argument-dependent lookup.
3459 bool requiresADL() const { return UnresolvedLookupExprBits.RequiresADL; }
3460
3461 /// Gets the 'naming class' (in the sense of C++0x
3462 /// [class.access.base]p5) of the lookup. This is the scope
3463 /// that was looked in to find these results.
3464 CXXRecordDecl *getNamingClass() { return NamingClass; }
3465 const CXXRecordDecl *getNamingClass() const { return NamingClass; }
3466
3467 SourceLocation getBeginLoc() const LLVM_READONLY {
3469 return l.getBeginLoc();
3470 return getNameInfo().getBeginLoc();
3471 }
3472
3473 SourceLocation getEndLoc() const LLVM_READONLY {
3475 return getRAngleLoc();
3476 return getNameInfo().getEndLoc();
3477 }
3478
3482
3486
3487 static bool classof(const Stmt *T) {
3488 return T->getStmtClass() == UnresolvedLookupExprClass;
3489 }
3490};
3491
3492/// A qualified reference to a name whose declaration cannot
3493/// yet be resolved.
3494///
3495/// DependentScopeDeclRefExpr is similar to DeclRefExpr in that
3496/// it expresses a reference to a declaration such as
3497/// X<T>::value. The difference, however, is that an
3498/// DependentScopeDeclRefExpr node is used only within C++ templates when
3499/// the qualification (e.g., X<T>::) refers to a dependent type. In
3500/// this case, X<T>::value cannot resolve to a declaration because the
3501/// declaration will differ from one instantiation of X<T> to the
3502/// next. Therefore, DependentScopeDeclRefExpr keeps track of the
3503/// qualifier (X<T>::) and the name of the entity being referenced
3504/// ("value"). Such expressions will instantiate to a DeclRefExpr once the
3505/// declaration can be found.
3506class DependentScopeDeclRefExpr final
3507 : public Expr,
3508 private llvm::TrailingObjects<DependentScopeDeclRefExpr,
3509 ASTTemplateKWAndArgsInfo,
3510 TemplateArgumentLoc> {
3511 friend class ASTStmtReader;
3512 friend class ASTStmtWriter;
3513 friend TrailingObjects;
3514
3515 /// The nested-name-specifier that qualifies this unresolved
3516 /// declaration name.
3517 NestedNameSpecifierLoc QualifierLoc;
3518
3519 /// The name of the entity we will be referencing.
3520 DeclarationNameInfo NameInfo;
3521
3522 DependentScopeDeclRefExpr(QualType Ty, NestedNameSpecifierLoc QualifierLoc,
3523 SourceLocation TemplateKWLoc,
3524 const DeclarationNameInfo &NameInfo,
3525 const TemplateArgumentListInfo *Args);
3526
3527 size_t numTrailingObjects(OverloadToken<ASTTemplateKWAndArgsInfo>) const {
3528 return hasTemplateKWAndArgsInfo();
3529 }
3530
3531 bool hasTemplateKWAndArgsInfo() const {
3532 return DependentScopeDeclRefExprBits.HasTemplateKWAndArgsInfo;
3533 }
3534
3535public:
3536 static DependentScopeDeclRefExpr *
3537 Create(const ASTContext &Context, NestedNameSpecifierLoc QualifierLoc,
3538 SourceLocation TemplateKWLoc, const DeclarationNameInfo &NameInfo,
3539 const TemplateArgumentListInfo *TemplateArgs);
3540
3541 static DependentScopeDeclRefExpr *CreateEmpty(const ASTContext &Context,
3542 bool HasTemplateKWAndArgsInfo,
3543 unsigned NumTemplateArgs);
3544
3545 /// Retrieve the name that this expression refers to.
3546 const DeclarationNameInfo &getNameInfo() const { return NameInfo; }
3547
3548 /// Retrieve the name that this expression refers to.
3549 DeclarationName getDeclName() const { return NameInfo.getName(); }
3550
3551 /// Retrieve the location of the name within the expression.
3552 ///
3553 /// For example, in "X<T>::value" this is the location of "value".
3554 SourceLocation getLocation() const { return NameInfo.getLoc(); }
3555
3556 /// Retrieve the nested-name-specifier that qualifies the
3557 /// name, with source location information.
3558 NestedNameSpecifierLoc getQualifierLoc() const { return QualifierLoc; }
3559
3560 /// Retrieve the nested-name-specifier that qualifies this
3561 /// declaration.
3563 return QualifierLoc.getNestedNameSpecifier();
3564 }
3565
3566 /// Retrieve the location of the template keyword preceding
3567 /// this name, if any.
3569 if (!hasTemplateKWAndArgsInfo())
3570 return SourceLocation();
3571 return getTrailingObjects<ASTTemplateKWAndArgsInfo>()->TemplateKWLoc;
3572 }
3573
3574 /// Retrieve the location of the left angle bracket starting the
3575 /// explicit template argument list following the name, if any.
3577 if (!hasTemplateKWAndArgsInfo())
3578 return SourceLocation();
3579 return getTrailingObjects<ASTTemplateKWAndArgsInfo>()->LAngleLoc;
3580 }
3581
3582 /// Retrieve the location of the right angle bracket ending the
3583 /// explicit template argument list following the name, if any.
3585 if (!hasTemplateKWAndArgsInfo())
3586 return SourceLocation();
3587 return getTrailingObjects<ASTTemplateKWAndArgsInfo>()->RAngleLoc;
3588 }
3589
3590 /// Determines whether the name was preceded by the template keyword.
3592
3593 /// Determines whether this lookup had explicit template arguments.
3594 bool hasExplicitTemplateArgs() const { return getLAngleLoc().isValid(); }
3595
3596 /// Copies the template arguments (if present) into the given
3597 /// structure.
3600 getTrailingObjects<ASTTemplateKWAndArgsInfo>()->copyInto(
3601 getTrailingObjects<TemplateArgumentLoc>(), List);
3602 }
3603
3606 return nullptr;
3607
3608 return getTrailingObjects<TemplateArgumentLoc>();
3609 }
3610
3611 unsigned getNumTemplateArgs() const {
3613 return 0;
3614
3615 return getTrailingObjects<ASTTemplateKWAndArgsInfo>()->NumTemplateArgs;
3616 }
3617
3621
3622 /// Note: getBeginLoc() is the start of the whole DependentScopeDeclRefExpr,
3623 /// and differs from getLocation().getStart().
3624 SourceLocation getBeginLoc() const LLVM_READONLY {
3625 return QualifierLoc.getBeginLoc();
3626 }
3627
3628 SourceLocation getEndLoc() const LLVM_READONLY {
3630 return getRAngleLoc();
3631 return getLocation();
3632 }
3633
3634 static bool classof(const Stmt *T) {
3635 return T->getStmtClass() == DependentScopeDeclRefExprClass;
3636 }
3637
3641
3645};
3646
3647/// Represents an expression -- generally a full-expression -- that
3648/// introduces cleanups to be run at the end of the sub-expression's
3649/// evaluation. The most common source of expression-introduced
3650/// cleanups is temporary objects in C++, but several other kinds of
3651/// expressions can create cleanups, including basically every
3652/// call in ARC that returns an Objective-C pointer.
3653///
3654/// This expression also tracks whether the sub-expression contains a
3655/// potentially-evaluated block literal. The lifetime of a block
3656/// literal is the extent of the enclosing scope.
3657class ExprWithCleanups final
3658 : public FullExpr,
3659 private llvm::TrailingObjects<
3660 ExprWithCleanups,
3661 llvm::PointerUnion<BlockDecl *, CompoundLiteralExpr *>> {
3662public:
3663 /// The type of objects that are kept in the cleanup.
3664 /// It's useful to remember the set of blocks and block-scoped compound
3665 /// literals; we could also remember the set of temporaries, but there's
3666 /// currently no need.
3667 using CleanupObject = llvm::PointerUnion<BlockDecl *, CompoundLiteralExpr *>;
3668
3669private:
3670 friend class ASTStmtReader;
3671 friend TrailingObjects;
3672
3673 ExprWithCleanups(EmptyShell, unsigned NumObjects);
3674 ExprWithCleanups(Expr *SubExpr, bool CleanupsHaveSideEffects,
3675 ArrayRef<CleanupObject> Objects);
3676
3677public:
3678 static ExprWithCleanups *Create(const ASTContext &C, EmptyShell empty,
3679 unsigned numObjects);
3680
3681 static ExprWithCleanups *Create(const ASTContext &C, Expr *subexpr,
3682 bool CleanupsHaveSideEffects,
3683 ArrayRef<CleanupObject> objects);
3684
3686 return getTrailingObjects(getNumObjects());
3687 }
3688
3689 unsigned getNumObjects() const { return ExprWithCleanupsBits.NumObjects; }
3690
3691 CleanupObject getObject(unsigned i) const {
3692 assert(i < getNumObjects() && "Index out of range");
3693 return getObjects()[i];
3694 }
3695
3697 return ExprWithCleanupsBits.CleanupsHaveSideEffects;
3698 }
3699
3700 SourceLocation getBeginLoc() const LLVM_READONLY {
3701 return SubExpr->getBeginLoc();
3702 }
3703
3704 SourceLocation getEndLoc() const LLVM_READONLY {
3705 return SubExpr->getEndLoc();
3706 }
3707
3708 // Implement isa/cast/dyncast/etc.
3709 static bool classof(const Stmt *T) {
3710 return T->getStmtClass() == ExprWithCleanupsClass;
3711 }
3712
3713 // Iterators
3715
3717 return const_child_range(&SubExpr, &SubExpr + 1);
3718 }
3719};
3720
3721/// Describes an explicit type conversion that uses functional
3722/// notion but could not be resolved because one or more arguments are
3723/// type-dependent.
3724///
3725/// The explicit type conversions expressed by
3726/// CXXUnresolvedConstructExpr have the form <tt>T(a1, a2, ..., aN)</tt>,
3727/// where \c T is some type and \c a1, \c a2, ..., \c aN are values, and
3728/// either \c T is a dependent type or one or more of the <tt>a</tt>'s is
3729/// type-dependent. For example, this would occur in a template such
3730/// as:
3731///
3732/// \code
3733/// template<typename T, typename A1>
3734/// inline T make_a(const A1& a1) {
3735/// return T(a1);
3736/// }
3737/// \endcode
3738///
3739/// When the returned expression is instantiated, it may resolve to a
3740/// constructor call, conversion function call, or some kind of type
3741/// conversion.
3742class CXXUnresolvedConstructExpr final
3743 : public Expr,
3744 private llvm::TrailingObjects<CXXUnresolvedConstructExpr, Expr *> {
3745 friend class ASTStmtReader;
3746 friend TrailingObjects;
3747
3748 /// The type being constructed, and whether the construct expression models
3749 /// list initialization or not.
3750 llvm::PointerIntPair<TypeSourceInfo *, 1> TypeAndInitForm;
3751
3752 /// The location of the left parentheses ('(').
3753 SourceLocation LParenLoc;
3754
3755 /// The location of the right parentheses (')').
3756 SourceLocation RParenLoc;
3757
3758 CXXUnresolvedConstructExpr(QualType T, TypeSourceInfo *TSI,
3759 SourceLocation LParenLoc, ArrayRef<Expr *> Args,
3760 SourceLocation RParenLoc, bool IsListInit);
3761
3762 CXXUnresolvedConstructExpr(EmptyShell Empty, unsigned NumArgs)
3763 : Expr(CXXUnresolvedConstructExprClass, Empty) {
3764 CXXUnresolvedConstructExprBits.NumArgs = NumArgs;
3765 }
3766
3767public:
3769 Create(const ASTContext &Context, QualType T, TypeSourceInfo *TSI,
3770 SourceLocation LParenLoc, ArrayRef<Expr *> Args,
3771 SourceLocation RParenLoc, bool IsListInit);
3772
3773 static CXXUnresolvedConstructExpr *CreateEmpty(const ASTContext &Context,
3774 unsigned NumArgs);
3775
3776 /// Retrieve the type that is being constructed, as specified
3777 /// in the source code.
3779
3780 /// Retrieve the type source information for the type being
3781 /// constructed.
3783 return TypeAndInitForm.getPointer();
3784 }
3785
3786 /// Retrieve the location of the left parentheses ('(') that
3787 /// precedes the argument list.
3788 SourceLocation getLParenLoc() const { return LParenLoc; }
3789 void setLParenLoc(SourceLocation L) { LParenLoc = L; }
3790
3791 /// Retrieve the location of the right parentheses (')') that
3792 /// follows the argument list.
3793 SourceLocation getRParenLoc() const { return RParenLoc; }
3794 void setRParenLoc(SourceLocation L) { RParenLoc = L; }
3795
3796 /// Determine whether this expression models list-initialization.
3797 /// If so, there will be exactly one subexpression, which will be
3798 /// an InitListExpr.
3799 bool isListInitialization() const { return TypeAndInitForm.getInt(); }
3800
3801 /// Retrieve the number of arguments.
3802 unsigned getNumArgs() const { return CXXUnresolvedConstructExprBits.NumArgs; }
3803
3804 using arg_iterator = Expr **;
3805 using arg_range = llvm::iterator_range<arg_iterator>;
3806
3807 arg_iterator arg_begin() { return getTrailingObjects(); }
3810
3811 using const_arg_iterator = const Expr* const *;
3812 using const_arg_range = llvm::iterator_range<const_arg_iterator>;
3813
3814 const_arg_iterator arg_begin() const { return getTrailingObjects(); }
3817 return const_arg_range(arg_begin(), arg_end());
3818 }
3819
3820 Expr *getArg(unsigned I) {
3821 assert(I < getNumArgs() && "Argument index out-of-range");
3822 return arg_begin()[I];
3823 }
3824
3825 const Expr *getArg(unsigned I) const {
3826 assert(I < getNumArgs() && "Argument index out-of-range");
3827 return arg_begin()[I];
3828 }
3829
3830 void setArg(unsigned I, Expr *E) {
3831 assert(I < getNumArgs() && "Argument index out-of-range");
3832 arg_begin()[I] = E;
3833 }
3834
3835 SourceLocation getBeginLoc() const LLVM_READONLY;
3836 SourceLocation getEndLoc() const LLVM_READONLY {
3837 if (!RParenLoc.isValid() && getNumArgs() > 0)
3838 return getArg(getNumArgs() - 1)->getEndLoc();
3839 return RParenLoc;
3840 }
3841
3842 static bool classof(const Stmt *T) {
3843 return T->getStmtClass() == CXXUnresolvedConstructExprClass;
3844 }
3845
3846 // Iterators
3848 auto **begin = reinterpret_cast<Stmt **>(arg_begin());
3849 return child_range(begin, begin + getNumArgs());
3850 }
3851
3853 auto **begin = reinterpret_cast<Stmt **>(
3854 const_cast<CXXUnresolvedConstructExpr *>(this)->arg_begin());
3855 return const_child_range(begin, begin + getNumArgs());
3856 }
3857};
3858
3859/// Represents a C++ member access expression where the actual
3860/// member referenced could not be resolved because the base
3861/// expression or the member name was dependent.
3862///
3863/// Like UnresolvedMemberExprs, these can be either implicit or
3864/// explicit accesses. It is only possible to get one of these with
3865/// an implicit access if a qualifier is provided.
3866class CXXDependentScopeMemberExpr final
3867 : public Expr,
3868 private llvm::TrailingObjects<CXXDependentScopeMemberExpr,
3869 ASTTemplateKWAndArgsInfo,
3870 TemplateArgumentLoc, NamedDecl *> {
3871 friend class ASTStmtReader;
3872 friend class ASTStmtWriter;
3873 friend TrailingObjects;
3874
3875 /// The expression for the base pointer or class reference,
3876 /// e.g., the \c x in x.f. Can be null in implicit accesses.
3877 Stmt *Base;
3878
3879 /// The type of the base expression. Never null, even for
3880 /// implicit accesses.
3881 QualType BaseType;
3882
3883 /// The nested-name-specifier that precedes the member name, if any.
3884 /// FIXME: This could be in principle store as a trailing object.
3885 /// However the performance impact of doing so should be investigated first.
3886 NestedNameSpecifierLoc QualifierLoc;
3887
3888 /// The member to which this member expression refers, which
3889 /// can be name, overloaded operator, or destructor.
3890 ///
3891 /// FIXME: could also be a template-id
3892 DeclarationNameInfo MemberNameInfo;
3893
3894 // CXXDependentScopeMemberExpr is followed by several trailing objects,
3895 // some of which optional. They are in order:
3896 //
3897 // * An optional ASTTemplateKWAndArgsInfo for the explicitly specified
3898 // template keyword and arguments. Present if and only if
3899 // hasTemplateKWAndArgsInfo().
3900 //
3901 // * An array of getNumTemplateArgs() TemplateArgumentLoc containing location
3902 // information for the explicitly specified template arguments.
3903 //
3904 // * An optional NamedDecl *. In a qualified member access expression such
3905 // as t->Base::f, this member stores the resolves of name lookup in the
3906 // context of the member access expression, to be used at instantiation
3907 // time. Present if and only if hasFirstQualifierFoundInScope().
3908
3909 bool hasTemplateKWAndArgsInfo() const {
3910 return CXXDependentScopeMemberExprBits.HasTemplateKWAndArgsInfo;
3911 }
3912
3913 bool hasFirstQualifierFoundInScope() const {
3914 return CXXDependentScopeMemberExprBits.HasFirstQualifierFoundInScope;
3915 }
3916
3917 unsigned numTrailingObjects(OverloadToken<ASTTemplateKWAndArgsInfo>) const {
3918 return hasTemplateKWAndArgsInfo();
3919 }
3920
3921 unsigned numTrailingObjects(OverloadToken<TemplateArgumentLoc>) const {
3922 return getNumTemplateArgs();
3923 }
3924
3925 CXXDependentScopeMemberExpr(const ASTContext &Ctx, Expr *Base,
3926 QualType BaseType, bool IsArrow,
3927 SourceLocation OperatorLoc,
3928 NestedNameSpecifierLoc QualifierLoc,
3929 SourceLocation TemplateKWLoc,
3930 NamedDecl *FirstQualifierFoundInScope,
3931 DeclarationNameInfo MemberNameInfo,
3932 const TemplateArgumentListInfo *TemplateArgs);
3933
3934 CXXDependentScopeMemberExpr(EmptyShell Empty, bool HasTemplateKWAndArgsInfo,
3935 bool HasFirstQualifierFoundInScope);
3936
3937public:
3938 static CXXDependentScopeMemberExpr *
3939 Create(const ASTContext &Ctx, Expr *Base, QualType BaseType, bool IsArrow,
3940 SourceLocation OperatorLoc, NestedNameSpecifierLoc QualifierLoc,
3941 SourceLocation TemplateKWLoc, NamedDecl *FirstQualifierFoundInScope,
3942 DeclarationNameInfo MemberNameInfo,
3943 const TemplateArgumentListInfo *TemplateArgs);
3944
3945 static CXXDependentScopeMemberExpr *
3946 CreateEmpty(const ASTContext &Ctx, bool HasTemplateKWAndArgsInfo,
3947 unsigned NumTemplateArgs, bool HasFirstQualifierFoundInScope);
3948
3949 /// True if this is an implicit access, i.e. one in which the
3950 /// member being accessed was not written in the source. The source
3951 /// location of the operator is invalid in this case.
3952 bool isImplicitAccess() const {
3953 if (!Base)
3954 return true;
3955 return cast<Expr>(Base)->isImplicitCXXThis();
3956 }
3957
3958 /// Retrieve the base object of this member expressions,
3959 /// e.g., the \c x in \c x.m.
3960 Expr *getBase() const {
3961 assert(!isImplicitAccess());
3962 return cast<Expr>(Base);
3963 }
3964
3965 QualType getBaseType() const { return BaseType; }
3966
3967 /// Determine whether this member expression used the '->'
3968 /// operator; otherwise, it used the '.' operator.
3969 bool isArrow() const { return CXXDependentScopeMemberExprBits.IsArrow; }
3970
3971 /// Retrieve the location of the '->' or '.' operator.
3973 return CXXDependentScopeMemberExprBits.OperatorLoc;
3974 }
3975
3976 /// Retrieve the nested-name-specifier that qualifies the member name.
3978 return QualifierLoc.getNestedNameSpecifier();
3979 }
3980
3981 /// Retrieve the nested-name-specifier that qualifies the member
3982 /// name, with source location information.
3983 NestedNameSpecifierLoc getQualifierLoc() const { return QualifierLoc; }
3984
3985 /// Retrieve the first part of the nested-name-specifier that was
3986 /// found in the scope of the member access expression when the member access
3987 /// was initially parsed.
3988 ///
3989 /// This function only returns a useful result when member access expression
3990 /// uses a qualified member name, e.g., "x.Base::f". Here, the declaration
3991 /// returned by this function describes what was found by unqualified name
3992 /// lookup for the identifier "Base" within the scope of the member access
3993 /// expression itself. At template instantiation time, this information is
3994 /// combined with the results of name lookup into the type of the object
3995 /// expression itself (the class type of x).
3997 if (!hasFirstQualifierFoundInScope())
3998 return nullptr;
3999 return *getTrailingObjects<NamedDecl *>();
4000 }
4001
4002 /// Retrieve the name of the member that this expression refers to.
4004 return MemberNameInfo;
4005 }
4006
4007 /// Retrieve the name of the member that this expression refers to.
4008 DeclarationName getMember() const { return MemberNameInfo.getName(); }
4009
4010 // Retrieve the location of the name of the member that this
4011 // expression refers to.
4012 SourceLocation getMemberLoc() const { return MemberNameInfo.getLoc(); }
4013
4014 /// Retrieve the location of the template keyword preceding the
4015 /// member name, if any.
4017 if (!hasTemplateKWAndArgsInfo())
4018 return SourceLocation();
4019 return getTrailingObjects<ASTTemplateKWAndArgsInfo>()->TemplateKWLoc;
4020 }
4021
4022 /// Retrieve the location of the left angle bracket starting the
4023 /// explicit template argument list following the member name, if any.
4025 if (!hasTemplateKWAndArgsInfo())
4026 return SourceLocation();
4027 return getTrailingObjects<ASTTemplateKWAndArgsInfo>()->LAngleLoc;
4028 }
4029
4030 /// Retrieve the location of the right angle bracket ending the
4031 /// explicit template argument list following the member name, if any.
4033 if (!hasTemplateKWAndArgsInfo())
4034 return SourceLocation();
4035 return getTrailingObjects<ASTTemplateKWAndArgsInfo>()->RAngleLoc;
4036 }
4037
4038 /// Determines whether the member name was preceded by the template keyword.
4040
4041 /// Determines whether this member expression actually had a C++
4042 /// template argument list explicitly specified, e.g., x.f<int>.
4043 bool hasExplicitTemplateArgs() const { return getLAngleLoc().isValid(); }
4044
4045 /// Copies the template arguments (if present) into the given
4046 /// structure.
4049 getTrailingObjects<ASTTemplateKWAndArgsInfo>()->copyInto(
4050 getTrailingObjects<TemplateArgumentLoc>(), List);
4051 }
4052
4053 /// Retrieve the template arguments provided as part of this
4054 /// template-id.
4057 return nullptr;
4058
4059 return getTrailingObjects<TemplateArgumentLoc>();
4060 }
4061
4062 /// Retrieve the number of template arguments provided as part of this
4063 /// template-id.
4064 unsigned getNumTemplateArgs() const {
4066 return 0;
4067
4068 return getTrailingObjects<ASTTemplateKWAndArgsInfo>()->NumTemplateArgs;
4069 }
4070
4074
4075 SourceLocation getBeginLoc() const LLVM_READONLY {
4076 if (!isImplicitAccess())
4077 return Base->getBeginLoc();
4078 if (getQualifier())
4079 return getQualifierLoc().getBeginLoc();
4080 return MemberNameInfo.getBeginLoc();
4081 }
4082
4083 SourceLocation getEndLoc() const LLVM_READONLY {
4085 return getRAngleLoc();
4086 return MemberNameInfo.getEndLoc();
4087 }
4088
4089 static bool classof(const Stmt *T) {
4090 return T->getStmtClass() == CXXDependentScopeMemberExprClass;
4091 }
4092
4093 // Iterators
4095 if (isImplicitAccess())
4097 return child_range(&Base, &Base + 1);
4098 }
4099
4101 if (isImplicitAccess())
4103 return const_child_range(&Base, &Base + 1);
4104 }
4105};
4106
4107/// Represents a C++ member access expression for which lookup
4108/// produced a set of overloaded functions.
4109///
4110/// The member access may be explicit or implicit:
4111/// \code
4112/// struct A {
4113/// int a, b;
4114/// int explicitAccess() { return this->a + this->A::b; }
4115/// int implicitAccess() { return a + A::b; }
4116/// };
4117/// \endcode
4118///
4119/// In the final AST, an explicit access always becomes a MemberExpr.
4120/// An implicit access may become either a MemberExpr or a
4121/// DeclRefExpr, depending on whether the member is static.
4122class UnresolvedMemberExpr final
4123 : public OverloadExpr,
4124 private llvm::TrailingObjects<UnresolvedMemberExpr, DeclAccessPair,
4125 ASTTemplateKWAndArgsInfo,
4126 TemplateArgumentLoc> {
4127 friend class ASTStmtReader;
4128 friend class OverloadExpr;
4129 friend TrailingObjects;
4130
4131 /// The expression for the base pointer or class reference,
4132 /// e.g., the \c x in x.f.
4133 ///
4134 /// This can be null if this is an 'unbased' member expression.
4135 Stmt *Base;
4136
4137 /// The type of the base expression; never null.
4138 QualType BaseType;
4139
4140 /// The location of the '->' or '.' operator.
4141 SourceLocation OperatorLoc;
4142
4143 // UnresolvedMemberExpr is followed by several trailing objects.
4144 // They are in order:
4145 //
4146 // * An array of getNumResults() DeclAccessPair for the results. These are
4147 // undesugared, which is to say, they may include UsingShadowDecls.
4148 // Access is relative to the naming class.
4149 //
4150 // * An optional ASTTemplateKWAndArgsInfo for the explicitly specified
4151 // template keyword and arguments. Present if and only if
4152 // hasTemplateKWAndArgsInfo().
4153 //
4154 // * An array of getNumTemplateArgs() TemplateArgumentLoc containing
4155 // location information for the explicitly specified template arguments.
4156
4157 UnresolvedMemberExpr(const ASTContext &Context, bool HasUnresolvedUsing,
4158 Expr *Base, QualType BaseType, bool IsArrow,
4159 SourceLocation OperatorLoc,
4160 NestedNameSpecifierLoc QualifierLoc,
4161 SourceLocation TemplateKWLoc,
4162 const DeclarationNameInfo &MemberNameInfo,
4163 const TemplateArgumentListInfo *TemplateArgs,
4165
4166 UnresolvedMemberExpr(EmptyShell Empty, unsigned NumResults,
4167 bool HasTemplateKWAndArgsInfo);
4168
4169 unsigned numTrailingObjects(OverloadToken<DeclAccessPair>) const {
4170 return getNumDecls();
4171 }
4172
4173 unsigned numTrailingObjects(OverloadToken<ASTTemplateKWAndArgsInfo>) const {
4174 return hasTemplateKWAndArgsInfo();
4175 }
4176
4177public:
4178 static UnresolvedMemberExpr *
4179 Create(const ASTContext &Context, bool HasUnresolvedUsing, Expr *Base,
4180 QualType BaseType, bool IsArrow, SourceLocation OperatorLoc,
4181 NestedNameSpecifierLoc QualifierLoc, SourceLocation TemplateKWLoc,
4182 const DeclarationNameInfo &MemberNameInfo,
4183 const TemplateArgumentListInfo *TemplateArgs,
4184 UnresolvedSetIterator Begin, UnresolvedSetIterator End);
4185
4186 static UnresolvedMemberExpr *CreateEmpty(const ASTContext &Context,
4187 unsigned NumResults,
4188 bool HasTemplateKWAndArgsInfo,
4189 unsigned NumTemplateArgs);
4190
4191 /// True if this is an implicit access, i.e., one in which the
4192 /// member being accessed was not written in the source.
4193 ///
4194 /// The source location of the operator is invalid in this case.
4195 bool isImplicitAccess() const;
4196
4197 /// Retrieve the base object of this member expressions,
4198 /// e.g., the \c x in \c x.m.
4200 assert(!isImplicitAccess());
4201 return cast<Expr>(Base);
4202 }
4203 const Expr *getBase() const {
4204 assert(!isImplicitAccess());
4205 return cast<Expr>(Base);
4206 }
4207
4208 QualType getBaseType() const { return BaseType; }
4209
4210 /// Determine whether the lookup results contain an unresolved using
4211 /// declaration.
4212 bool hasUnresolvedUsing() const {
4213 return UnresolvedMemberExprBits.HasUnresolvedUsing;
4214 }
4215
4216 /// Determine whether this member expression used the '->'
4217 /// operator; otherwise, it used the '.' operator.
4218 bool isArrow() const { return UnresolvedMemberExprBits.IsArrow; }
4219
4220 /// Retrieve the location of the '->' or '.' operator.
4221 SourceLocation getOperatorLoc() const { return OperatorLoc; }
4222
4223 /// Retrieve the naming class of this lookup.
4226 return const_cast<UnresolvedMemberExpr *>(this)->getNamingClass();
4227 }
4228
4229 /// Retrieve the full name info for the member that this expression
4230 /// refers to.
4232
4233 /// Retrieve the name of the member that this expression refers to.
4235
4236 /// Retrieve the location of the name of the member that this
4237 /// expression refers to.
4239
4240 /// Return the preferred location (the member name) for the arrow when
4241 /// diagnosing a problem with this expression.
4242 SourceLocation getExprLoc() const LLVM_READONLY { return getMemberLoc(); }
4243
4244 SourceLocation getBeginLoc() const LLVM_READONLY {
4245 if (!isImplicitAccess())
4246 return Base->getBeginLoc();
4248 return l.getBeginLoc();
4249 return getMemberNameInfo().getBeginLoc();
4250 }
4251
4252 SourceLocation getEndLoc() const LLVM_READONLY {
4254 return getRAngleLoc();
4255 return getMemberNameInfo().getEndLoc();
4256 }
4257
4258 static bool classof(const Stmt *T) {
4259 return T->getStmtClass() == UnresolvedMemberExprClass;
4260 }
4261
4262 // Iterators
4264 if (isImplicitAccess())
4266 return child_range(&Base, &Base + 1);
4267 }
4268
4270 if (isImplicitAccess())
4272 return const_child_range(&Base, &Base + 1);
4273 }
4274};
4275
4277 if (auto *ULE = dyn_cast<UnresolvedLookupExpr>(this))
4278 return ULE->getTrailingObjects<DeclAccessPair>();
4279 return cast<UnresolvedMemberExpr>(this)->getTrailingObjects<DeclAccessPair>();
4280}
4281
4284 return nullptr;
4285
4286 if (auto *ULE = dyn_cast<UnresolvedLookupExpr>(this))
4287 return ULE->getTrailingObjects<ASTTemplateKWAndArgsInfo>();
4288 return cast<UnresolvedMemberExpr>(this)
4289 ->getTrailingObjects<ASTTemplateKWAndArgsInfo>();
4290}
4291
4293 if (auto *ULE = dyn_cast<UnresolvedLookupExpr>(this))
4294 return ULE->getTrailingObjects<TemplateArgumentLoc>();
4295 return cast<UnresolvedMemberExpr>(this)
4296 ->getTrailingObjects<TemplateArgumentLoc>();
4297}
4298
4300 if (auto *ULE = dyn_cast<UnresolvedLookupExpr>(this))
4301 return ULE->getNamingClass();
4302 return cast<UnresolvedMemberExpr>(this)->getNamingClass();
4303}
4304
4305/// Represents a C++11 noexcept expression (C++ [expr.unary.noexcept]).
4306///
4307/// The noexcept expression tests whether a given expression might throw. Its
4308/// result is a boolean constant.
4309class CXXNoexceptExpr : public Expr {
4310 friend class ASTStmtReader;
4311
4312 Stmt *Operand;
4313 SourceRange Range;
4314
4315public:
4318 : Expr(CXXNoexceptExprClass, Ty, VK_PRValue, OK_Ordinary),
4319 Operand(Operand), Range(Keyword, RParen) {
4320 CXXNoexceptExprBits.Value = Val == CT_Cannot;
4321 setDependence(computeDependence(this, Val));
4322 }
4323
4324 CXXNoexceptExpr(EmptyShell Empty) : Expr(CXXNoexceptExprClass, Empty) {}
4325
4326 Expr *getOperand() const { return static_cast<Expr *>(Operand); }
4327
4328 SourceLocation getBeginLoc() const { return Range.getBegin(); }
4329 SourceLocation getEndLoc() const { return Range.getEnd(); }
4330 SourceRange getSourceRange() const { return Range; }
4331
4332 bool getValue() const { return CXXNoexceptExprBits.Value; }
4333
4334 static bool classof(const Stmt *T) {
4335 return T->getStmtClass() == CXXNoexceptExprClass;
4336 }
4337
4338 // Iterators
4339 child_range children() { return child_range(&Operand, &Operand + 1); }
4340
4342 return const_child_range(&Operand, &Operand + 1);
4343 }
4344};
4345
4346/// Represents a C++11 pack expansion that produces a sequence of
4347/// expressions.
4348///
4349/// A pack expansion expression contains a pattern (which itself is an
4350/// expression) followed by an ellipsis. For example:
4351///
4352/// \code
4353/// template<typename F, typename ...Types>
4354/// void forward(F f, Types &&...args) {
4355/// f(static_cast<Types&&>(args)...);
4356/// }
4357/// \endcode
4358///
4359/// Here, the argument to the function object \c f is a pack expansion whose
4360/// pattern is \c static_cast<Types&&>(args). When the \c forward function
4361/// template is instantiated, the pack expansion will instantiate to zero or
4362/// or more function arguments to the function object \c f.
4363class PackExpansionExpr : public Expr {
4364 friend class ASTStmtReader;
4365 friend class ASTStmtWriter;
4366
4367 SourceLocation EllipsisLoc;
4368
4369 /// The number of expansions that will be produced by this pack
4370 /// expansion expression, if known.
4371 ///
4372 /// When zero, the number of expansions is not known. Otherwise, this value
4373 /// is the number of expansions + 1.
4374 unsigned NumExpansions;
4375
4376 Stmt *Pattern;
4377
4378public:
4380 UnsignedOrNone NumExpansions)
4381 : Expr(PackExpansionExprClass, Pattern->getType(),
4382 Pattern->getValueKind(), Pattern->getObjectKind()),
4383 EllipsisLoc(EllipsisLoc),
4384 NumExpansions(NumExpansions ? *NumExpansions + 1 : 0),
4385 Pattern(Pattern) {
4387 }
4388
4389 PackExpansionExpr(EmptyShell Empty) : Expr(PackExpansionExprClass, Empty) {}
4390
4391 /// Retrieve the pattern of the pack expansion.
4392 Expr *getPattern() { return reinterpret_cast<Expr *>(Pattern); }
4393
4394 /// Retrieve the pattern of the pack expansion.
4395 const Expr *getPattern() const { return reinterpret_cast<Expr *>(Pattern); }
4396
4397 /// Retrieve the location of the ellipsis that describes this pack
4398 /// expansion.
4399 SourceLocation getEllipsisLoc() const { return EllipsisLoc; }
4400
4401 /// Determine the number of expansions that will be produced when
4402 /// this pack expansion is instantiated, if already known.
4404 if (NumExpansions)
4405 return NumExpansions - 1;
4406
4407 return std::nullopt;
4408 }
4409
4410 SourceLocation getBeginLoc() const LLVM_READONLY {
4411 return Pattern->getBeginLoc();
4412 }
4413
4414 SourceLocation getEndLoc() const LLVM_READONLY { return EllipsisLoc; }
4415
4416 static bool classof(const Stmt *T) {
4417 return T->getStmtClass() == PackExpansionExprClass;
4418 }
4419
4420 // Iterators
4422 return child_range(&Pattern, &Pattern + 1);
4423 }
4424
4426 return const_child_range(&Pattern, &Pattern + 1);
4427 }
4428};
4429
4430/// Represents an expression that computes the length of a parameter
4431/// pack.
4432///
4433/// \code
4434/// template<typename ...Types>
4435/// struct count {
4436/// static const unsigned value = sizeof...(Types);
4437/// };
4438/// \endcode
4439class SizeOfPackExpr final
4440 : public Expr,
4441 private llvm::TrailingObjects<SizeOfPackExpr, TemplateArgument> {
4442 friend class ASTStmtReader;
4443 friend class ASTStmtWriter;
4444 friend TrailingObjects;
4445
4446 /// The location of the \c sizeof keyword.
4447 SourceLocation OperatorLoc;
4448
4449 /// The location of the name of the parameter pack.
4450 SourceLocation PackLoc;
4451
4452 /// The location of the closing parenthesis.
4453 SourceLocation RParenLoc;
4454
4455 /// The length of the parameter pack, if known.
4456 ///
4457 /// When this expression is not value-dependent, this is the length of
4458 /// the pack. When the expression was parsed rather than instantiated
4459 /// (and thus is value-dependent), this is zero.
4460 ///
4461 /// After partial substitution into a sizeof...(X) expression (for instance,
4462 /// within an alias template or during function template argument deduction),
4463 /// we store a trailing array of partially-substituted TemplateArguments,
4464 /// and this is the length of that array.
4465 unsigned Length;
4466
4467 /// The parameter pack.
4468 NamedDecl *Pack = nullptr;
4469
4470 /// Create an expression that computes the length of
4471 /// the given parameter pack.
4472 SizeOfPackExpr(QualType SizeType, SourceLocation OperatorLoc, NamedDecl *Pack,
4473 SourceLocation PackLoc, SourceLocation RParenLoc,
4474 UnsignedOrNone Length, ArrayRef<TemplateArgument> PartialArgs)
4475 : Expr(SizeOfPackExprClass, SizeType, VK_PRValue, OK_Ordinary),
4476 OperatorLoc(OperatorLoc), PackLoc(PackLoc), RParenLoc(RParenLoc),
4477 Length(Length ? *Length : PartialArgs.size()), Pack(Pack) {
4478 assert((!Length || PartialArgs.empty()) &&
4479 "have partial args for non-dependent sizeof... expression");
4480 auto *Args = getTrailingObjects();
4481 llvm::uninitialized_copy(PartialArgs, Args);
4482 setDependence(Length ? ExprDependence::None
4483 : ExprDependence::ValueInstantiation);
4484 }
4485
4486 /// Create an empty expression.
4487 SizeOfPackExpr(EmptyShell Empty, unsigned NumPartialArgs)
4488 : Expr(SizeOfPackExprClass, Empty), Length(NumPartialArgs) {}
4489
4490public:
4491 static SizeOfPackExpr *Create(ASTContext &Context, SourceLocation OperatorLoc,
4492 NamedDecl *Pack, SourceLocation PackLoc,
4493 SourceLocation RParenLoc,
4494 UnsignedOrNone Length = std::nullopt,
4495 ArrayRef<TemplateArgument> PartialArgs = {});
4496 static SizeOfPackExpr *CreateDeserialized(ASTContext &Context,
4497 unsigned NumPartialArgs);
4498
4499 /// Determine the location of the 'sizeof' keyword.
4500 SourceLocation getOperatorLoc() const { return OperatorLoc; }
4501
4502 /// Determine the location of the parameter pack.
4503 SourceLocation getPackLoc() const { return PackLoc; }
4504
4505 /// Determine the location of the right parenthesis.
4506 SourceLocation getRParenLoc() const { return RParenLoc; }
4507
4508 /// Retrieve the parameter pack.
4509 NamedDecl *getPack() const { return Pack; }
4510
4511 /// Retrieve the length of the parameter pack.
4512 ///
4513 /// This routine may only be invoked when the expression is not
4514 /// value-dependent.
4515 unsigned getPackLength() const {
4516 assert(!isValueDependent() &&
4517 "Cannot get the length of a value-dependent pack size expression");
4518 return Length;
4519 }
4520
4521 /// Determine whether this represents a partially-substituted sizeof...
4522 /// expression, such as is produced for:
4523 ///
4524 /// template<typename ...Ts> using X = int[sizeof...(Ts)];
4525 /// template<typename ...Us> void f(X<Us..., 1, 2, 3, Us...>);
4527 return isValueDependent() && Length;
4528 }
4529
4530 /// Get
4532 assert(isPartiallySubstituted());
4533 return getTrailingObjects(Length);
4534 }
4535
4536 SourceLocation getBeginLoc() const LLVM_READONLY { return OperatorLoc; }
4537 SourceLocation getEndLoc() const LLVM_READONLY { return RParenLoc; }
4538
4539 static bool classof(const Stmt *T) {
4540 return T->getStmtClass() == SizeOfPackExprClass;
4541 }
4542
4543 // Iterators
4547
4551};
4552
4553class PackIndexingExpr final
4554 : public Expr,
4555 private llvm::TrailingObjects<PackIndexingExpr, Expr *> {
4556 friend class ASTStmtReader;
4557 friend class ASTStmtWriter;
4558 friend TrailingObjects;
4559
4560 SourceLocation EllipsisLoc;
4561
4562 // The location of the closing bracket
4563 SourceLocation RSquareLoc;
4564
4565 // The pack being indexed, followed by the index
4566 Stmt *SubExprs[2];
4567
4568 PackIndexingExpr(QualType Type, SourceLocation EllipsisLoc,
4569 SourceLocation RSquareLoc, Expr *PackIdExpr, Expr *IndexExpr,
4570 ArrayRef<Expr *> SubstitutedExprs = {},
4571 bool FullySubstituted = false)
4572 : Expr(PackIndexingExprClass, Type, VK_LValue, OK_Ordinary),
4573 EllipsisLoc(EllipsisLoc), RSquareLoc(RSquareLoc),
4574 SubExprs{PackIdExpr, IndexExpr} {
4575 PackIndexingExprBits.TransformedExpressions = SubstitutedExprs.size();
4576 PackIndexingExprBits.FullySubstituted = FullySubstituted;
4577 llvm::uninitialized_copy(SubstitutedExprs, getTrailingObjects());
4578
4582 }
4583
4584 /// Create an empty expression.
4585 PackIndexingExpr(EmptyShell Empty) : Expr(PackIndexingExprClass, Empty) {}
4586
4587 unsigned numTrailingObjects(OverloadToken<Expr *>) const {
4588 return PackIndexingExprBits.TransformedExpressions;
4589 }
4590
4591public:
4592 static PackIndexingExpr *Create(ASTContext &Context,
4593 SourceLocation EllipsisLoc,
4594 SourceLocation RSquareLoc, Expr *PackIdExpr,
4595 Expr *IndexExpr, std::optional<int64_t> Index,
4596 ArrayRef<Expr *> SubstitutedExprs = {},
4597 bool FullySubstituted = false);
4598 static PackIndexingExpr *CreateDeserialized(ASTContext &Context,
4599 unsigned NumTransformedExprs);
4600
4601 // The index expression and all elements of the pack have been substituted.
4602 bool isFullySubstituted() const {
4603 return PackIndexingExprBits.FullySubstituted;
4604 }
4605
4606 /// Determine if the expression was expanded to empty.
4607 bool expandsToEmptyPack() const {
4608 return isFullySubstituted() &&
4609 PackIndexingExprBits.TransformedExpressions == 0;
4610 }
4611
4612 /// Determine the location of the 'sizeof' keyword.
4613 SourceLocation getEllipsisLoc() const { return EllipsisLoc; }
4614
4615 /// Determine the location of the parameter pack.
4616 SourceLocation getPackLoc() const { return SubExprs[0]->getBeginLoc(); }
4617
4618 /// Determine the location of the right parenthesis.
4619 SourceLocation getRSquareLoc() const { return RSquareLoc; }
4620
4621 SourceLocation getBeginLoc() const LLVM_READONLY { return getPackLoc(); }
4622 SourceLocation getEndLoc() const LLVM_READONLY { return RSquareLoc; }
4623
4624 Expr *getPackIdExpression() const { return cast<Expr>(SubExprs[0]); }
4625
4626 NamedDecl *getPackDecl() const;
4627
4628 Expr *getIndexExpr() const { return cast<Expr>(SubExprs[1]); }
4629
4632 return std::nullopt;
4634 auto Index = CE->getResultAsAPSInt();
4635 assert(Index.isNonNegative() && "Invalid index");
4636 return static_cast<unsigned>(Index.getExtValue());
4637 }
4638
4641 assert(Index && "extracting the indexed expression of a dependant pack");
4642 return getTrailingObjects()[*Index];
4643 }
4644
4645 /// Return the trailing expressions, regardless of the expansion.
4647 return getTrailingObjects(PackIndexingExprBits.TransformedExpressions);
4648 }
4649
4650 static bool classof(const Stmt *T) {
4651 return T->getStmtClass() == PackIndexingExprClass;
4652 }
4653
4654 // Iterators
4655 child_range children() { return child_range(SubExprs, SubExprs + 2); }
4656
4658 return const_child_range(SubExprs, SubExprs + 2);
4659 }
4660};
4661
4662/// Represents a reference to a non-type template parameter
4663/// that has been substituted with a template argument.
4664class SubstNonTypeTemplateParmExpr : public Expr {
4665 friend class ASTReader;
4666 friend class ASTStmtReader;
4667
4668 /// The replacement expression.
4669 Stmt *Replacement;
4670
4671 /// The associated declaration and a flag indicating if it was a reference
4672 /// parameter. For class NTTPs, we can't determine that based on the value
4673 /// category alone.
4674 llvm::PointerIntPair<Decl *, 1, bool> AssociatedDeclAndRef;
4675
4676 unsigned Index : 15;
4677 unsigned PackIndex : 15;
4678 LLVM_PREFERRED_TYPE(bool)
4679 unsigned Final : 1;
4680
4681 explicit SubstNonTypeTemplateParmExpr(EmptyShell Empty)
4682 : Expr(SubstNonTypeTemplateParmExprClass, Empty) {}
4683
4684public:
4686 SourceLocation Loc, Expr *Replacement,
4687 Decl *AssociatedDecl, unsigned Index,
4688 UnsignedOrNone PackIndex, bool RefParam,
4689 bool Final)
4690 : Expr(SubstNonTypeTemplateParmExprClass, Ty, ValueKind, OK_Ordinary),
4691 Replacement(Replacement),
4692 AssociatedDeclAndRef(AssociatedDecl, RefParam), Index(Index),
4693 PackIndex(PackIndex.toInternalRepresentation()), Final(Final) {
4694 assert(AssociatedDecl != nullptr);
4697 }
4698
4700 return SubstNonTypeTemplateParmExprBits.NameLoc;
4701 }
4704
4705 Expr *getReplacement() const { return cast<Expr>(Replacement); }
4706
4707 /// A template-like entity which owns the whole pattern being substituted.
4708 /// This will own a set of template parameters.
4709 Decl *getAssociatedDecl() const { return AssociatedDeclAndRef.getPointer(); }
4710
4711 /// Returns the index of the replaced parameter in the associated declaration.
4712 /// This should match the result of `getParameter()->getIndex()`.
4713 unsigned getIndex() const { return Index; }
4714
4718
4719 // This substitution is Final, which means the substitution is fully
4720 // sugared: it doesn't need to be resugared later.
4721 bool getFinal() const { return Final; }
4722
4724
4725 bool isReferenceParameter() const { return AssociatedDeclAndRef.getInt(); }
4726
4727 /// Determine the substituted type of the template parameter.
4728 QualType getParameterType(const ASTContext &Ctx) const;
4729
4730 static bool classof(const Stmt *s) {
4731 return s->getStmtClass() == SubstNonTypeTemplateParmExprClass;
4732 }
4733
4734 // Iterators
4735 child_range children() { return child_range(&Replacement, &Replacement + 1); }
4736
4738 return const_child_range(&Replacement, &Replacement + 1);
4739 }
4740};
4741
4742/// Represents a reference to a non-type template parameter pack that
4743/// has been substituted with a non-template argument pack.
4744///
4745/// When a pack expansion in the source code contains multiple parameter packs
4746/// and those parameter packs correspond to different levels of template
4747/// parameter lists, this node is used to represent a non-type template
4748/// parameter pack from an outer level, which has already had its argument pack
4749/// substituted but that still lives within a pack expansion that itself
4750/// could not be instantiated. When actually performing a substitution into
4751/// that pack expansion (e.g., when all template parameters have corresponding
4752/// arguments), this type will be replaced with the appropriate underlying
4753/// expression at the current pack substitution index.
4754class SubstNonTypeTemplateParmPackExpr : public Expr {
4755 friend class ASTReader;
4756 friend class ASTStmtReader;
4757
4758 /// The non-type template parameter pack itself.
4759 Decl *AssociatedDecl;
4760
4761 /// A pointer to the set of template arguments that this
4762 /// parameter pack is instantiated with.
4763 const TemplateArgument *Arguments;
4764
4765 /// The number of template arguments in \c Arguments.
4766 unsigned NumArguments : 15;
4767
4768 LLVM_PREFERRED_TYPE(bool)
4769 unsigned Final : 1;
4770
4771 unsigned Index : 16;
4772
4773 /// The location of the non-type template parameter pack reference.
4774 SourceLocation NameLoc;
4775
4776 explicit SubstNonTypeTemplateParmPackExpr(EmptyShell Empty)
4777 : Expr(SubstNonTypeTemplateParmPackExprClass, Empty) {}
4778
4779public:
4781 SourceLocation NameLoc,
4782 const TemplateArgument &ArgPack,
4783 Decl *AssociatedDecl, unsigned Index,
4784 bool Final);
4785
4786 /// A template-like entity which owns the whole pattern being substituted.
4787 /// This will own a set of template parameters.
4788 Decl *getAssociatedDecl() const { return AssociatedDecl; }
4789
4790 /// Returns the index of the replaced parameter in the associated declaration.
4791 /// This should match the result of `getParameterPack()->getIndex()`.
4792 unsigned getIndex() const { return Index; }
4793
4794 // This substitution will be Final, which means the substitution will be fully
4795 // sugared: it doesn't need to be resugared later.
4796 bool getFinal() const { return Final; }
4797
4798 /// Retrieve the non-type template parameter pack being substituted.
4800
4801 /// Retrieve the location of the parameter pack name.
4802 SourceLocation getParameterPackLocation() const { return NameLoc; }
4803
4804 /// Retrieve the template argument pack containing the substituted
4805 /// template arguments.
4807
4808 SourceLocation getBeginLoc() const LLVM_READONLY { return NameLoc; }
4809 SourceLocation getEndLoc() const LLVM_READONLY { return NameLoc; }
4810
4811 static bool classof(const Stmt *T) {
4812 return T->getStmtClass() == SubstNonTypeTemplateParmPackExprClass;
4813 }
4814
4815 // Iterators
4819
4823};
4824
4825/// Represents a reference to a function parameter pack, init-capture pack,
4826/// or binding pack that has been substituted but not yet expanded.
4827///
4828/// When a pack expansion contains multiple parameter packs at different levels,
4829/// this node is used to represent a function parameter pack at an outer level
4830/// which we have already substituted to refer to expanded parameters, but where
4831/// the containing pack expansion cannot yet be expanded.
4832///
4833/// \code
4834/// template<typename...Ts> struct S {
4835/// template<typename...Us> auto f(Ts ...ts) -> decltype(g(Us(ts)...));
4836/// };
4837/// template struct S<int, int>;
4838/// \endcode
4839class FunctionParmPackExpr final
4840 : public Expr,
4841 private llvm::TrailingObjects<FunctionParmPackExpr, ValueDecl *> {
4842 friend class ASTReader;
4843 friend class ASTStmtReader;
4844 friend TrailingObjects;
4845
4846 /// The function parameter pack which was referenced.
4847 ValueDecl *ParamPack;
4848
4849 /// The location of the function parameter pack reference.
4850 SourceLocation NameLoc;
4851
4852 /// The number of expansions of this pack.
4853 unsigned NumParameters;
4854
4855 FunctionParmPackExpr(QualType T, ValueDecl *ParamPack, SourceLocation NameLoc,
4856 unsigned NumParams, ValueDecl *const *Params);
4857
4858public:
4859 static FunctionParmPackExpr *Create(const ASTContext &Context, QualType T,
4860 ValueDecl *ParamPack,
4861 SourceLocation NameLoc,
4862 ArrayRef<ValueDecl *> Params);
4863 static FunctionParmPackExpr *CreateEmpty(const ASTContext &Context,
4864 unsigned NumParams);
4865
4866 /// Get the parameter pack which this expression refers to.
4867 ValueDecl *getParameterPack() const { return ParamPack; }
4868
4869 /// Get the location of the parameter pack.
4870 SourceLocation getParameterPackLocation() const { return NameLoc; }
4871
4872 /// Iterators over the parameters which the parameter pack expanded
4873 /// into.
4874 using iterator = ValueDecl *const *;
4875 iterator begin() const { return getTrailingObjects(); }
4876 iterator end() const { return begin() + NumParameters; }
4877
4878 /// Get the number of parameters in this parameter pack.
4879 unsigned getNumExpansions() const { return NumParameters; }
4880
4881 /// Get an expansion of the parameter pack by index.
4882 ValueDecl *getExpansion(unsigned I) const { return begin()[I]; }
4883
4884 SourceLocation getBeginLoc() const LLVM_READONLY { return NameLoc; }
4885 SourceLocation getEndLoc() const LLVM_READONLY { return NameLoc; }
4886
4887 static bool classof(const Stmt *T) {
4888 return T->getStmtClass() == FunctionParmPackExprClass;
4889 }
4890
4894
4898};
4899
4900/// Represents a prvalue temporary that is written into memory so that
4901/// a reference can bind to it.
4902///
4903/// Prvalue expressions are materialized when they need to have an address
4904/// in memory for a reference to bind to. This happens when binding a
4905/// reference to the result of a conversion, e.g.,
4906///
4907/// \code
4908/// const int &r = 1.0;
4909/// \endcode
4910///
4911/// Here, 1.0 is implicitly converted to an \c int. That resulting \c int is
4912/// then materialized via a \c MaterializeTemporaryExpr, and the reference
4913/// binds to the temporary. \c MaterializeTemporaryExprs are always glvalues
4914/// (either an lvalue or an xvalue, depending on the kind of reference binding
4915/// to it), maintaining the invariant that references always bind to glvalues.
4916///
4917/// Reference binding and copy-elision can both extend the lifetime of a
4918/// temporary. When either happens, the expression will also track the
4919/// declaration which is responsible for the lifetime extension.
4921private:
4922 friend class ASTStmtReader;
4923 friend class ASTStmtWriter;
4924
4925 llvm::PointerUnion<Stmt *, LifetimeExtendedTemporaryDecl *> State;
4926
4927public:
4929 bool BoundToLvalueReference,
4930 LifetimeExtendedTemporaryDecl *MTD = nullptr);
4931
4933 : Expr(MaterializeTemporaryExprClass, Empty) {}
4934
4935 /// Retrieve the temporary-generating subexpression whose value will
4936 /// be materialized into a glvalue.
4937 Expr *getSubExpr() const {
4938 return cast<Expr>(
4939 isa<Stmt *>(State)
4940 ? cast<Stmt *>(State)
4941 : cast<LifetimeExtendedTemporaryDecl *>(State)->getTemporaryExpr());
4942 }
4943
4944 /// Retrieve the storage duration for the materialized temporary.
4946 return isa<Stmt *>(State) ? SD_FullExpression
4948 ->getStorageDuration();
4949 }
4950
4951 /// Get the storage for the constant value of a materialized temporary
4952 /// of static storage duration.
4953 APValue *getOrCreateValue(bool MayCreate) const {
4955 "the temporary has not been lifetime extended");
4956 return cast<LifetimeExtendedTemporaryDecl *>(State)->getOrCreateValue(
4957 MayCreate);
4958 }
4959
4965 return State.dyn_cast<LifetimeExtendedTemporaryDecl *>();
4966 }
4967
4968 /// Get the declaration which triggered the lifetime-extension of this
4969 /// temporary, if any.
4971 return isa<Stmt *>(State) ? nullptr
4973 ->getExtendingDecl();
4974 }
4976 return const_cast<MaterializeTemporaryExpr *>(this)->getExtendingDecl();
4977 }
4978
4979 void setExtendingDecl(ValueDecl *ExtendedBy, unsigned ManglingNumber);
4980
4981 unsigned getManglingNumber() const {
4982 return isa<Stmt *>(State) ? 0
4984 ->getManglingNumber();
4985 }
4986
4987 /// Determine whether this materialized temporary is bound to an
4988 /// lvalue reference; otherwise, it's bound to an rvalue reference.
4989 bool isBoundToLvalueReference() const { return isLValue(); }
4990
4991 /// Determine whether this temporary object is usable in constant
4992 /// expressions, as specified in C++20 [expr.const]p4.
4993 bool isUsableInConstantExpressions(const ASTContext &Context) const;
4994
4995 SourceLocation getBeginLoc() const LLVM_READONLY {
4996 return getSubExpr()->getBeginLoc();
4997 }
4998
4999 SourceLocation getEndLoc() const LLVM_READONLY {
5000 return getSubExpr()->getEndLoc();
5001 }
5002
5003 static bool classof(const Stmt *T) {
5004 return T->getStmtClass() == MaterializeTemporaryExprClass;
5005 }
5006
5007 // Iterators
5009 return isa<Stmt *>(State)
5010 ? child_range(State.getAddrOfPtr1(), State.getAddrOfPtr1() + 1)
5011 : cast<LifetimeExtendedTemporaryDecl *>(State)->childrenExpr();
5012 }
5013
5015 return isa<Stmt *>(State)
5016 ? const_child_range(State.getAddrOfPtr1(),
5017 State.getAddrOfPtr1() + 1)
5018 : const_cast<const LifetimeExtendedTemporaryDecl *>(
5020 ->childrenExpr();
5021 }
5022};
5023
5024/// Represents a folding of a pack over an operator.
5025///
5026/// This expression is always dependent and represents a pack expansion of the
5027/// forms:
5028///
5029/// ( expr op ... )
5030/// ( ... op expr )
5031/// ( expr op ... op expr )
5032class CXXFoldExpr : public Expr {
5033 friend class ASTStmtReader;
5034 friend class ASTStmtWriter;
5035
5036 enum SubExpr { Callee, LHS, RHS, Count };
5037
5038 SourceLocation LParenLoc;
5039 SourceLocation EllipsisLoc;
5040 SourceLocation RParenLoc;
5041 // When 0, the number of expansions is not known. Otherwise, this is one more
5042 // than the number of expansions.
5043 UnsignedOrNone NumExpansions = std::nullopt;
5044 Stmt *SubExprs[SubExpr::Count];
5045
5046public:
5048 SourceLocation LParenLoc, Expr *LHS, BinaryOperatorKind Opcode,
5049 SourceLocation EllipsisLoc, Expr *RHS, SourceLocation RParenLoc,
5050 UnsignedOrNone NumExpansions);
5051
5052 CXXFoldExpr(EmptyShell Empty) : Expr(CXXFoldExprClass, Empty) {}
5053
5055 return static_cast<UnresolvedLookupExpr *>(SubExprs[SubExpr::Callee]);
5056 }
5057 Expr *getLHS() const { return static_cast<Expr*>(SubExprs[SubExpr::LHS]); }
5058 Expr *getRHS() const { return static_cast<Expr*>(SubExprs[SubExpr::RHS]); }
5059
5060 /// Does this produce a right-associated sequence of operators?
5061 bool isRightFold() const {
5063 }
5064
5065 /// Does this produce a left-associated sequence of operators?
5066 bool isLeftFold() const { return !isRightFold(); }
5067
5068 /// Get the pattern, that is, the operand that contains an unexpanded pack.
5069 Expr *getPattern() const { return isLeftFold() ? getRHS() : getLHS(); }
5070
5071 /// Get the operand that doesn't contain a pack, for a binary fold.
5072 Expr *getInit() const { return isLeftFold() ? getLHS() : getRHS(); }
5073
5074 SourceLocation getLParenLoc() const { return LParenLoc; }
5075 SourceLocation getRParenLoc() const { return RParenLoc; }
5076 SourceLocation getEllipsisLoc() const { return EllipsisLoc; }
5078
5079 UnsignedOrNone getNumExpansions() const { return NumExpansions; }
5080
5081 SourceLocation getBeginLoc() const LLVM_READONLY {
5082 if (LParenLoc.isValid())
5083 return LParenLoc;
5084 if (isLeftFold())
5085 return getEllipsisLoc();
5086 return getLHS()->getBeginLoc();
5087 }
5088
5089 SourceLocation getEndLoc() const LLVM_READONLY {
5090 if (RParenLoc.isValid())
5091 return RParenLoc;
5092 if (isRightFold())
5093 return getEllipsisLoc();
5094 return getRHS()->getEndLoc();
5095 }
5096
5097 static bool classof(const Stmt *T) {
5098 return T->getStmtClass() == CXXFoldExprClass;
5099 }
5100
5101 // Iterators
5103 return child_range(SubExprs, SubExprs + SubExpr::Count);
5104 }
5105
5107 return const_child_range(SubExprs, SubExprs + SubExpr::Count);
5108 }
5109};
5110
5111/// Represents a list-initialization with parenthesis.
5112///
5113/// As per P0960R3, this is a C++20 feature that allows aggregate to
5114/// be initialized with a parenthesized list of values:
5115/// ```
5116/// struct A {
5117/// int a;
5118/// double b;
5119/// };
5120///
5121/// void foo() {
5122/// A a1(0); // Well-formed in C++20
5123/// A a2(1.5, 1.0); // Well-formed in C++20
5124/// }
5125/// ```
5126/// It has some sort of similiarity to braced
5127/// list-initialization, with some differences such as
5128/// it allows narrowing conversion whilst braced
5129/// list-initialization doesn't.
5130/// ```
5131/// struct A {
5132/// char a;
5133/// };
5134/// void foo() {
5135/// A a(1.5); // Well-formed in C++20
5136/// A b{1.5}; // Ill-formed !
5137/// }
5138/// ```
5139class CXXParenListInitExpr final
5140 : public Expr,
5141 private llvm::TrailingObjects<CXXParenListInitExpr, Expr *> {
5142 friend class TrailingObjects;
5143 friend class ASTStmtReader;
5144 friend class ASTStmtWriter;
5145
5146 unsigned NumExprs;
5147 unsigned NumUserSpecifiedExprs;
5148 SourceLocation InitLoc, LParenLoc, RParenLoc;
5149 llvm::PointerUnion<Expr *, FieldDecl *> ArrayFillerOrUnionFieldInit;
5150
5151 CXXParenListInitExpr(ArrayRef<Expr *> Args, QualType T,
5152 unsigned NumUserSpecifiedExprs, SourceLocation InitLoc,
5153 SourceLocation LParenLoc, SourceLocation RParenLoc)
5154 : Expr(CXXParenListInitExprClass, T, getValueKindForType(T), OK_Ordinary),
5155 NumExprs(Args.size()), NumUserSpecifiedExprs(NumUserSpecifiedExprs),
5156 InitLoc(InitLoc), LParenLoc(LParenLoc), RParenLoc(RParenLoc) {
5157 llvm::copy(Args, getTrailingObjects());
5158 assert(NumExprs >= NumUserSpecifiedExprs &&
5159 "number of user specified inits is greater than the number of "
5160 "passed inits");
5162 }
5163
5164 size_t numTrailingObjects(OverloadToken<Expr *>) const { return NumExprs; }
5165
5166public:
5167 static CXXParenListInitExpr *
5168 Create(ASTContext &C, ArrayRef<Expr *> Args, QualType T,
5169 unsigned NumUserSpecifiedExprs, SourceLocation InitLoc,
5170 SourceLocation LParenLoc, SourceLocation RParenLoc);
5171
5172 static CXXParenListInitExpr *CreateEmpty(ASTContext &C, unsigned numExprs,
5173 EmptyShell Empty);
5174
5175 explicit CXXParenListInitExpr(EmptyShell Empty, unsigned NumExprs)
5176 : Expr(CXXParenListInitExprClass, Empty), NumExprs(NumExprs),
5177 NumUserSpecifiedExprs(0) {}
5178
5180
5182 return getTrailingObjects(NumExprs);
5183 }
5184
5185 ArrayRef<Expr *> getInitExprs() const { return getTrailingObjects(NumExprs); }
5186
5188 return getTrailingObjects(NumUserSpecifiedExprs);
5189 }
5190
5192 return getTrailingObjects(NumUserSpecifiedExprs);
5193 }
5194
5195 SourceLocation getBeginLoc() const LLVM_READONLY { return LParenLoc; }
5196
5197 SourceLocation getEndLoc() const LLVM_READONLY { return RParenLoc; }
5198
5199 SourceLocation getInitLoc() const LLVM_READONLY { return InitLoc; }
5200
5201 SourceRange getSourceRange() const LLVM_READONLY {
5202 return SourceRange(getBeginLoc(), getEndLoc());
5203 }
5204
5205 void setArrayFiller(Expr *E) { ArrayFillerOrUnionFieldInit = E; }
5206
5208 return dyn_cast_if_present<Expr *>(ArrayFillerOrUnionFieldInit);
5209 }
5210
5211 const Expr *getArrayFiller() const {
5212 return dyn_cast_if_present<Expr *>(ArrayFillerOrUnionFieldInit);
5213 }
5214
5216 ArrayFillerOrUnionFieldInit = FD;
5217 }
5218
5220 return dyn_cast_if_present<FieldDecl *>(ArrayFillerOrUnionFieldInit);
5221 }
5222
5224 return dyn_cast_if_present<FieldDecl *>(ArrayFillerOrUnionFieldInit);
5225 }
5226
5228 Stmt **Begin = reinterpret_cast<Stmt **>(getTrailingObjects());
5229 return child_range(Begin, Begin + NumExprs);
5230 }
5231
5233 Stmt *const *Begin = reinterpret_cast<Stmt *const *>(getTrailingObjects());
5234 return const_child_range(Begin, Begin + NumExprs);
5235 }
5236
5237 static bool classof(const Stmt *T) {
5238 return T->getStmtClass() == CXXParenListInitExprClass;
5239 }
5240};
5241
5242/// Represents an expression that might suspend coroutine execution;
5243/// either a co_await or co_yield expression.
5244///
5245/// Evaluation of this expression first evaluates its 'ready' expression. If
5246/// that returns 'false':
5247/// -- execution of the coroutine is suspended
5248/// -- the 'suspend' expression is evaluated
5249/// -- if the 'suspend' expression returns 'false', the coroutine is
5250/// resumed
5251/// -- otherwise, control passes back to the resumer.
5252/// If the coroutine is not suspended, or when it is resumed, the 'resume'
5253/// expression is evaluated, and its result is the result of the overall
5254/// expression.
5256 friend class ASTStmtReader;
5257
5258 SourceLocation KeywordLoc;
5259
5260 enum SubExpr { Operand, Common, Ready, Suspend, Resume, Count };
5261
5262 Stmt *SubExprs[SubExpr::Count];
5263 OpaqueValueExpr *OpaqueValue = nullptr;
5264
5265public:
5266 // These types correspond to the three C++ 'await_suspend' return variants
5268
5270 Expr *Common, Expr *Ready, Expr *Suspend, Expr *Resume,
5271 OpaqueValueExpr *OpaqueValue)
5272 : Expr(SC, Resume->getType(), Resume->getValueKind(),
5273 Resume->getObjectKind()),
5274 KeywordLoc(KeywordLoc), OpaqueValue(OpaqueValue) {
5275 SubExprs[SubExpr::Operand] = Operand;
5276 SubExprs[SubExpr::Common] = Common;
5277 SubExprs[SubExpr::Ready] = Ready;
5278 SubExprs[SubExpr::Suspend] = Suspend;
5279 SubExprs[SubExpr::Resume] = Resume;
5281 }
5282
5284 Expr *Operand, Expr *Common)
5285 : Expr(SC, Ty, VK_PRValue, OK_Ordinary), KeywordLoc(KeywordLoc) {
5286 assert(Common->isTypeDependent() && Ty->isDependentType() &&
5287 "wrong constructor for non-dependent co_await/co_yield expression");
5288 SubExprs[SubExpr::Operand] = Operand;
5289 SubExprs[SubExpr::Common] = Common;
5290 SubExprs[SubExpr::Ready] = nullptr;
5291 SubExprs[SubExpr::Suspend] = nullptr;
5292 SubExprs[SubExpr::Resume] = nullptr;
5294 }
5295
5297 SubExprs[SubExpr::Operand] = nullptr;
5298 SubExprs[SubExpr::Common] = nullptr;
5299 SubExprs[SubExpr::Ready] = nullptr;
5300 SubExprs[SubExpr::Suspend] = nullptr;
5301 SubExprs[SubExpr::Resume] = nullptr;
5302 }
5303
5305 return static_cast<Expr*>(SubExprs[SubExpr::Common]);
5306 }
5307
5308 /// getOpaqueValue - Return the opaque value placeholder.
5309 OpaqueValueExpr *getOpaqueValue() const { return OpaqueValue; }
5310
5312 return static_cast<Expr*>(SubExprs[SubExpr::Ready]);
5313 }
5314
5316 return static_cast<Expr*>(SubExprs[SubExpr::Suspend]);
5317 }
5318
5320 return static_cast<Expr*>(SubExprs[SubExpr::Resume]);
5321 }
5322
5323 // The syntactic operand written in the code
5324 Expr *getOperand() const {
5325 return static_cast<Expr *>(SubExprs[SubExpr::Operand]);
5326 }
5327
5329 auto *SuspendExpr = getSuspendExpr();
5330 assert(SuspendExpr);
5331
5332 auto SuspendType = SuspendExpr->getType();
5333
5334 if (SuspendType->isVoidType())
5336 if (SuspendType->isBooleanType())
5338
5339 // Void pointer is the type of handle.address(), which is returned
5340 // from the await suspend wrapper so that the temporary coroutine handle
5341 // value won't go to the frame by mistake
5342 assert(SuspendType->isVoidPointerType());
5344 }
5345
5346 SourceLocation getKeywordLoc() const { return KeywordLoc; }
5347
5348 SourceLocation getBeginLoc() const LLVM_READONLY { return KeywordLoc; }
5349
5350 SourceLocation getEndLoc() const LLVM_READONLY {
5351 return getOperand()->getEndLoc();
5352 }
5353
5355 return child_range(SubExprs, SubExprs + SubExpr::Count);
5356 }
5357
5359 return const_child_range(SubExprs, SubExprs + SubExpr::Count);
5360 }
5361
5362 static bool classof(const Stmt *T) {
5363 return T->getStmtClass() == CoawaitExprClass ||
5364 T->getStmtClass() == CoyieldExprClass;
5365 }
5366};
5367
5368/// Represents a 'co_await' expression.
5370 friend class ASTStmtReader;
5371
5372public:
5373 CoawaitExpr(SourceLocation CoawaitLoc, Expr *Operand, Expr *Common,
5374 Expr *Ready, Expr *Suspend, Expr *Resume,
5375 OpaqueValueExpr *OpaqueValue, bool IsImplicit = false)
5376 : CoroutineSuspendExpr(CoawaitExprClass, CoawaitLoc, Operand, Common,
5377 Ready, Suspend, Resume, OpaqueValue) {
5378 CoawaitBits.IsImplicit = IsImplicit;
5379 }
5380
5381 CoawaitExpr(SourceLocation CoawaitLoc, QualType Ty, Expr *Operand,
5382 Expr *Common, bool IsImplicit = false)
5383 : CoroutineSuspendExpr(CoawaitExprClass, CoawaitLoc, Ty, Operand,
5384 Common) {
5385 CoawaitBits.IsImplicit = IsImplicit;
5386 }
5387
5390
5391 bool isImplicit() const { return CoawaitBits.IsImplicit; }
5392 void setIsImplicit(bool value = true) { CoawaitBits.IsImplicit = value; }
5393
5394 static bool classof(const Stmt *T) {
5395 return T->getStmtClass() == CoawaitExprClass;
5396 }
5397};
5398
5399/// Represents a 'co_await' expression while the type of the promise
5400/// is dependent.
5402 friend class ASTStmtReader;
5403
5404 SourceLocation KeywordLoc;
5405 Stmt *SubExprs[2];
5406
5407public:
5409 UnresolvedLookupExpr *OpCoawait)
5410 : Expr(DependentCoawaitExprClass, Ty, VK_PRValue, OK_Ordinary),
5411 KeywordLoc(KeywordLoc) {
5412 // NOTE: A co_await expression is dependent on the coroutines promise
5413 // type and may be dependent even when the `Op` expression is not.
5414 assert(Ty->isDependentType() &&
5415 "wrong constructor for non-dependent co_await/co_yield expression");
5416 SubExprs[0] = Op;
5417 SubExprs[1] = OpCoawait;
5419 }
5420
5422 : Expr(DependentCoawaitExprClass, Empty) {}
5423
5424 Expr *getOperand() const { return cast<Expr>(SubExprs[0]); }
5425
5429
5430 SourceLocation getKeywordLoc() const { return KeywordLoc; }
5431
5432 SourceLocation getBeginLoc() const LLVM_READONLY { return KeywordLoc; }
5433
5434 SourceLocation getEndLoc() const LLVM_READONLY {
5435 return getOperand()->getEndLoc();
5436 }
5437
5438 child_range children() { return child_range(SubExprs, SubExprs + 2); }
5439
5441 return const_child_range(SubExprs, SubExprs + 2);
5442 }
5443
5444 static bool classof(const Stmt *T) {
5445 return T->getStmtClass() == DependentCoawaitExprClass;
5446 }
5447};
5448
5449/// Represents a 'co_yield' expression.
5451 friend class ASTStmtReader;
5452
5453public:
5454 CoyieldExpr(SourceLocation CoyieldLoc, Expr *Operand, Expr *Common,
5455 Expr *Ready, Expr *Suspend, Expr *Resume,
5456 OpaqueValueExpr *OpaqueValue)
5457 : CoroutineSuspendExpr(CoyieldExprClass, CoyieldLoc, Operand, Common,
5458 Ready, Suspend, Resume, OpaqueValue) {}
5459 CoyieldExpr(SourceLocation CoyieldLoc, QualType Ty, Expr *Operand,
5460 Expr *Common)
5461 : CoroutineSuspendExpr(CoyieldExprClass, CoyieldLoc, Ty, Operand,
5462 Common) {}
5465
5466 static bool classof(const Stmt *T) {
5467 return T->getStmtClass() == CoyieldExprClass;
5468 }
5469};
5470
5471/// Represents a C++2a __builtin_bit_cast(T, v) expression. Used to implement
5472/// std::bit_cast. These can sometimes be evaluated as part of a constant
5473/// expression, but otherwise CodeGen to a simple memcpy in general.
5475 : public ExplicitCastExpr,
5476 private llvm::TrailingObjects<BuiltinBitCastExpr, CXXBaseSpecifier *> {
5477 friend class ASTStmtReader;
5478 friend class CastExpr;
5479 friend TrailingObjects;
5480
5481 SourceLocation KWLoc;
5482 SourceLocation RParenLoc;
5483
5484public:
5486 TypeSourceInfo *DstType, SourceLocation KWLoc,
5487 SourceLocation RParenLoc)
5488 : ExplicitCastExpr(BuiltinBitCastExprClass, T, VK, CK, SrcExpr, 0, false,
5489 DstType),
5490 KWLoc(KWLoc), RParenLoc(RParenLoc) {}
5492 : ExplicitCastExpr(BuiltinBitCastExprClass, Empty, 0, false) {}
5493
5494 SourceLocation getBeginLoc() const LLVM_READONLY { return KWLoc; }
5495 SourceLocation getEndLoc() const LLVM_READONLY { return RParenLoc; }
5496
5497 static bool classof(const Stmt *T) {
5498 return T->getStmtClass() == BuiltinBitCastExprClass;
5499 }
5500};
5501
5502} // namespace clang
5503
5504#endif // LLVM_CLANG_AST_EXPRCXX_H
This file provides AST data structures related to concepts.
#define V(N, I)
Defines the C++ Decl subclasses, other than those for templates (found in DeclTemplate....
Defines the C++ template declaration subclasses.
Defines the ExceptionSpecificationType enumeration and various utility functions.
Defines enumerations for expression traits intrinsics.
Forward-declares and imports various common LLVM datatypes that clang wants to use unqualified.
Defines several types used to describe C++ lambda expressions that are shared between the parser and ...
Defines the clang::LangOptions interface.
Defines an enumeration for C++ overloaded operators.
Defines the clang::SourceLocation class and associated facilities.
Defines various enumerations that describe declaration and type specifiers.
static QualType getPointeeType(const MemRegion *R)
Defines the clang::TemplateNameKind enum.
Defines enumerations for the type traits support.
C Language Family Type Representation.
__device__ __2f16 float __ockl_bool s
Holds long-lived AST nodes (such as types and decls) that can be referred to throughout the semantic ...
Definition ASTContext.h:220
APValue - This class implements a discriminated union of [uninitialized] [APSInt] [APFloat],...
Definition APValue.h:122
Holds long-lived AST nodes (such as types and decls) that can be referred to throughout the semantic ...
Definition ASTContext.h:220
ArrayTypeTraitExpr(SourceLocation loc, ArrayTypeTrait att, TypeSourceInfo *queried, uint64_t value, Expr *dimension, SourceLocation rparen, QualType ty)
Definition ExprCXX.h:3015
uint64_t getValue() const
Definition ExprCXX.h:3044
SourceLocation getEndLoc() const LLVM_READONLY
Definition ExprCXX.h:3034
ArrayTypeTrait getTrait() const
Definition ExprCXX.h:3036
QualType getQueriedType() const
Definition ExprCXX.h:3040
Expr * getDimensionExpression() const
Definition ExprCXX.h:3046
ArrayTypeTraitExpr(EmptyShell Empty)
Definition ExprCXX.h:3028
child_range children()
Definition ExprCXX.h:3053
const_child_range children() const
Definition ExprCXX.h:3057
static bool classof(const Stmt *T)
Definition ExprCXX.h:3048
TypeSourceInfo * getQueriedTypeSourceInfo() const
Definition ExprCXX.h:3042
friend class ASTStmtReader
Definition ExprCXX.h:3013
SourceLocation getBeginLoc() const LLVM_READONLY
Definition ExprCXX.h:3033
StringRef getOpcodeStr() const
Definition Expr.h:4038
static bool classof(const Stmt *T)
Definition ExprCXX.h:5497
SourceLocation getEndLoc() const LLVM_READONLY
Definition ExprCXX.h:5495
BuiltinBitCastExpr(EmptyShell Empty)
Definition ExprCXX.h:5491
BuiltinBitCastExpr(QualType T, ExprValueKind VK, CastKind CK, Expr *SrcExpr, TypeSourceInfo *DstType, SourceLocation KWLoc, SourceLocation RParenLoc)
Definition ExprCXX.h:5485
friend class ASTStmtReader
Definition ExprCXX.h:5477
SourceLocation getBeginLoc() const LLVM_READONLY
Definition ExprCXX.h:5494
Represents a call to a CUDA kernel function.
Definition ExprCXX.h:234
const CallExpr * getConfig() const
Definition ExprCXX.h:260
static CUDAKernelCallExpr * CreateEmpty(const ASTContext &Ctx, unsigned NumArgs, bool HasFPFeatures, EmptyShell Empty)
Definition ExprCXX.cpp:1972
static bool classof(const Stmt *T)
Definition ExprCXX.h:265
CallExpr * getConfig()
Definition ExprCXX.h:263
friend class ASTStmtReader
Definition ExprCXX.h:235
static bool classof(const Stmt *T)
Definition ExprCXX.h:626
static CXXAddrspaceCastExpr * CreateEmpty(const ASTContext &Context)
Definition ExprCXX.cpp:914
Represents binding an expression to a temporary.
Definition ExprCXX.h:1493
CXXBindTemporaryExpr(EmptyShell Empty)
Definition ExprCXX.h:1505
static bool classof(const Stmt *T)
Definition ExprCXX.h:1528
void setTemporary(CXXTemporary *T)
Definition ExprCXX.h:1513
const_child_range children() const
Definition ExprCXX.h:1535
CXXTemporary * getTemporary()
Definition ExprCXX.h:1511
const CXXTemporary * getTemporary() const
Definition ExprCXX.h:1512
const Expr * getSubExpr() const
Definition ExprCXX.h:1515
SourceLocation getEndLoc() const LLVM_READONLY
Definition ExprCXX.h:1523
SourceLocation getBeginLoc() const LLVM_READONLY
Definition ExprCXX.h:1519
const_child_range children() const
Definition ExprCXX.h:758
CXXBoolLiteralExpr(bool Val, QualType Ty, SourceLocation Loc)
Definition ExprCXX.h:725
SourceLocation getEndLoc() const
Definition ExprCXX.h:744
static bool classof(const Stmt *T)
Definition ExprCXX.h:749
static CXXBoolLiteralExpr * Create(const ASTContext &C, bool Val, QualType Ty, SourceLocation Loc)
Definition ExprCXX.h:735
bool getValue() const
Definition ExprCXX.h:740
CXXBoolLiteralExpr(EmptyShell Empty)
Definition ExprCXX.h:732
SourceLocation getBeginLoc() const
Definition ExprCXX.h:743
void setValue(bool V)
Definition ExprCXX.h:741
SourceLocation getLocation() const
Definition ExprCXX.h:746
void setLocation(SourceLocation L)
Definition ExprCXX.h:747
child_range children()
Definition ExprCXX.h:754
static bool classof(const Stmt *T)
Definition ExprCXX.h:589
friend class CastExpr
Definition ExprCXX.h:579
static CXXConstCastExpr * CreateEmpty(const ASTContext &Context)
Definition ExprCXX.cpp:901
Represents a call to a C++ constructor.
Definition ExprCXX.h:1548
arg_iterator arg_begin()
Definition ExprCXX.h:1677
bool hasUnusedResultAttr(const ASTContext &Ctx) const
Returns true if this call expression should warn on unused results.
Definition ExprCXX.h:1723
SourceRange getParenOrBraceRange() const
Definition ExprCXX.h:1729
void setElidable(bool E)
Definition ExprCXX.h:1618
const_arg_iterator arg_end() const
Definition ExprCXX.h:1680
void setStdInitListInitialization(bool V)
Definition ExprCXX.h:1644
void setConstructionKind(CXXConstructionKind CK)
Definition ExprCXX.h:1663
ExprIterator arg_iterator
Definition ExprCXX.h:1667
void setIsImmediateEscalating(bool Set)
Definition ExprCXX.h:1710
llvm::iterator_range< arg_iterator > arg_range
Definition ExprCXX.h:1669
bool isElidable() const
Whether this construction is elidable.
Definition ExprCXX.h:1617
bool hadMultipleCandidates() const
Whether the referred constructor was resolved from an overloaded set having size greater than 1.
Definition ExprCXX.h:1622
ConstExprIterator const_arg_iterator
Definition ExprCXX.h:1668
std::pair< const NamedDecl *, const WarnUnusedResultAttr * > getUnusedResultAttr(const ASTContext &Ctx) const
Returns the WarnUnusedResultAttr that is declared on the callee or its return type declaration,...
Definition ExprCXX.h:1718
child_range children()
Definition ExprCXX.h:1738
Expr * getArg(unsigned Arg)
Return the specified argument.
Definition ExprCXX.h:1691
CXXConstructExpr(StmtClass SC, QualType Ty, SourceLocation Loc, CXXConstructorDecl *Ctor, bool Elidable, ArrayRef< Expr * > Args, bool HadMultipleCandidates, bool ListInitialization, bool StdInitListInitialization, bool ZeroInitialization, CXXConstructionKind ConstructKind, SourceRange ParenOrBraceRange)
Build a C++ construction expression.
Definition ExprCXX.cpp:1204
arg_range arguments()
Definition ExprCXX.h:1672
bool isStdInitListInitialization() const
Whether this constructor call was written as list-initialization, but was interpreted as forming a st...
Definition ExprCXX.h:1641
void setListInitialization(bool V)
Definition ExprCXX.h:1633
bool isImmediateEscalating() const
Definition ExprCXX.h:1706
bool requiresZeroInitialization() const
Whether this construction first requires zero-initialization before the initializer is called.
Definition ExprCXX.h:1650
void setRequiresZeroInitialization(bool ZeroInit)
Definition ExprCXX.h:1653
SourceLocation getLocation() const
Definition ExprCXX.h:1613
const_arg_range arguments() const
Definition ExprCXX.h:1673
arg_iterator arg_end()
Definition ExprCXX.h:1678
static unsigned sizeOfTrailingObjects(unsigned NumArgs)
Return the size in bytes of the trailing objects.
Definition ExprCXX.h:1594
void setArg(unsigned Arg, Expr *ArgExpr)
Set the specified argument.
Definition ExprCXX.h:1701
SourceLocation getEndLoc() const LLVM_READONLY
Definition ExprCXX.cpp:581
llvm::iterator_range< const_arg_iterator > const_arg_range
Definition ExprCXX.h:1670
SourceLocation getBeginLoc() const LLVM_READONLY
Definition ExprCXX.cpp:575
void setParenOrBraceRange(SourceRange Range)
Definition ExprCXX.h:1730
const_arg_iterator arg_begin() const
Definition ExprCXX.h:1679
const_child_range children() const
Definition ExprCXX.h:1742
CXXConstructorDecl * getConstructor() const
Get the constructor that this expression will (ultimately) call.
Definition ExprCXX.h:1611
bool isListInitialization() const
Whether this constructor call was written as list-initialization.
Definition ExprCXX.h:1630
unsigned getNumArgs() const
Return the number of arguments to the constructor call.
Definition ExprCXX.h:1688
CXXConstructionKind getConstructionKind() const
Determine whether this constructor is actually constructing a base class (rather than a complete obje...
Definition ExprCXX.h:1659
void setHadMultipleCandidates(bool V)
Definition ExprCXX.h:1625
void setLocation(SourceLocation Loc)
Definition ExprCXX.h:1614
friend class ASTStmtReader
Definition ExprCXX.h:1549
const Expr * getArg(unsigned Arg) const
Definition ExprCXX.h:1695
const Expr *const * getArgs() const
Definition ExprCXX.h:1683
static bool classof(const Stmt *T)
Definition ExprCXX.h:1732
static CXXConstructExpr * CreateEmpty(const ASTContext &Ctx, unsigned NumArgs)
Create an empty C++ construction expression.
Definition ExprCXX.cpp:1195
Represents a C++ constructor within a class.
Definition DeclCXX.h:2604
A default argument (C++ [dcl.fct.default]).
Definition ExprCXX.h:1270
SourceLocation getEndLoc() const
Definition ExprCXX.h:1349
const_child_range children() const
Definition ExprCXX.h:1362
SourceLocation getBeginLoc() const
Default argument expressions have no representation in the source, so they have an empty source range...
Definition ExprCXX.h:1348
SourceLocation getUsedLocation() const
Retrieve the location where this default argument was actually used.
Definition ExprCXX.h:1344
ParmVarDecl * getParam()
Definition ExprCXX.h:1313
const ParmVarDecl * getParam() const
Definition ExprCXX.h:1312
friend class ASTReader
Definition ExprCXX.h:1272
const Expr * getExpr() const
Definition ExprCXX.h:1321
Expr * getAdjustedRewrittenExpr()
Definition ExprCXX.cpp:1055
const Expr * getAdjustedRewrittenExpr() const
Definition ExprCXX.h:1336
DeclContext * getUsedContext()
Definition ExprCXX.h:1341
SourceLocation getExprLoc() const
Definition ExprCXX.h:1351
const DeclContext * getUsedContext() const
Definition ExprCXX.h:1340
const Expr * getRewrittenExpr() const
Definition ExprCXX.h:1329
static bool classof(const Stmt *T)
Definition ExprCXX.h:1353
static CXXDefaultArgExpr * CreateEmpty(const ASTContext &C, bool HasRewrittenInit)
Definition ExprCXX.cpp:1032
child_range children()
Definition ExprCXX.h:1358
friend class ASTStmtReader
Definition ExprCXX.h:1271
bool hasRewrittenInit() const
Definition ExprCXX.h:1315
A use of a default initializer in a constructor or in aggregate initialization.
Definition ExprCXX.h:1377
static bool classof(const Stmt *T)
Definition ExprCXX.h:1444
const DeclContext * getUsedContext() const
Definition ExprCXX.h:1434
child_range children()
Definition ExprCXX.h:1449
const FieldDecl * getField() const
Definition ExprCXX.h:1412
const Expr * getRewrittenExpr() const
Retrieve the initializing expression with evaluated immediate calls, if any.
Definition ExprCXX.h:1422
const Expr * getExpr() const
Definition ExprCXX.h:1416
bool hasRewrittenInit() const
Definition ExprCXX.h:1406
Expr * getExpr()
Get the initialization expression that will be used.
Definition ExprCXX.cpp:1105
FieldDecl * getField()
Get the field whose initializer will be used.
Definition ExprCXX.h:1411
static CXXDefaultInitExpr * CreateEmpty(const ASTContext &C, bool HasRewrittenInit)
Definition ExprCXX.cpp:1086
Expr * getRewrittenExpr()
Retrieve the initializing expression with evaluated immediate calls, if any.
Definition ExprCXX.h:1429
SourceLocation getBeginLoc() const
Definition ExprCXX.h:1441
SourceLocation getEndLoc() const
Definition ExprCXX.h:1442
const_child_range children() const
Definition ExprCXX.h:1453
DeclContext * getUsedContext()
Definition ExprCXX.h:1435
SourceLocation getUsedLocation() const
Retrieve the location where this default initializer expression was actually used.
Definition ExprCXX.h:1439
friend class ASTStmtReader
Definition ExprCXX.h:1379
static bool classof(const Stmt *T)
Definition ExprCXX.h:2681
child_range children()
Definition ExprCXX.h:2686
FunctionDecl * getOperatorDelete() const
Definition ExprCXX.h:2665
SourceLocation getEndLoc() const LLVM_READONLY
Definition ExprCXX.h:2677
bool isArrayForm() const
Definition ExprCXX.h:2652
CXXDeleteExpr(EmptyShell Shell)
Definition ExprCXX.h:2649
const_child_range children() const
Definition ExprCXX.h:2688
SourceLocation getBeginLoc() const
Definition ExprCXX.h:2676
const Expr * getArgument() const
Definition ExprCXX.h:2668
bool isGlobalDelete() const
Definition ExprCXX.h:2651
friend class ASTStmtReader
Definition ExprCXX.h:2627
bool doesUsualArrayDeleteWantSize() const
Answers whether the usual array deallocation function for the allocated type expects the size of the ...
Definition ExprCXX.h:2661
QualType getDestroyedType() const
Retrieve the type being destroyed.
Definition ExprCXX.cpp:338
bool isArrayFormAsWritten() const
Definition ExprCXX.h:2653
CXXDeleteExpr(QualType Ty, bool GlobalDelete, bool ArrayForm, bool ArrayFormAsWritten, bool UsualArrayDeleteWantsSize, FunctionDecl *OperatorDelete, Expr *Arg, SourceLocation Loc)
Definition ExprCXX.h:2636
bool isArrow() const
Determine whether this member expression used the '->' operator; otherwise, it used the '.
Definition ExprCXX.h:3969
SourceLocation getOperatorLoc() const
Retrieve the location of the '->' or '.' operator.
Definition ExprCXX.h:3972
NestedNameSpecifier getQualifier() const
Retrieve the nested-name-specifier that qualifies the member name.
Definition ExprCXX.h:3977
SourceLocation getLAngleLoc() const
Retrieve the location of the left angle bracket starting the explicit template argument list followin...
Definition ExprCXX.h:4024
SourceLocation getTemplateKeywordLoc() const
Retrieve the location of the template keyword preceding the member name, if any.
Definition ExprCXX.h:4016
const DeclarationNameInfo & getMemberNameInfo() const
Retrieve the name of the member that this expression refers to.
Definition ExprCXX.h:4003
SourceLocation getBeginLoc() const LLVM_READONLY
Definition ExprCXX.h:4075
void copyTemplateArgumentsInto(TemplateArgumentListInfo &List) const
Copies the template arguments (if present) into the given structure.
Definition ExprCXX.h:4047
unsigned getNumTemplateArgs() const
Retrieve the number of template arguments provided as part of this template-id.
Definition ExprCXX.h:4064
const TemplateArgumentLoc * getTemplateArgs() const
Retrieve the template arguments provided as part of this template-id.
Definition ExprCXX.h:4055
bool hasExplicitTemplateArgs() const
Determines whether this member expression actually had a C++ template argument list explicitly specif...
Definition ExprCXX.h:4043
static CXXDependentScopeMemberExpr * CreateEmpty(const ASTContext &Ctx, bool HasTemplateKWAndArgsInfo, unsigned NumTemplateArgs, bool HasFirstQualifierFoundInScope)
Definition ExprCXX.cpp:1571
SourceLocation getMemberLoc() const
Definition ExprCXX.h:4012
static bool classof(const Stmt *T)
Definition ExprCXX.h:4089
SourceLocation getRAngleLoc() const
Retrieve the location of the right angle bracket ending the explicit template argument list following...
Definition ExprCXX.h:4032
DeclarationName getMember() const
Retrieve the name of the member that this expression refers to.
Definition ExprCXX.h:4008
SourceLocation getEndLoc() const LLVM_READONLY
Definition ExprCXX.h:4083
NamedDecl * getFirstQualifierFoundInScope() const
Retrieve the first part of the nested-name-specifier that was found in the scope of the member access...
Definition ExprCXX.h:3996
Expr * getBase() const
Retrieve the base object of this member expressions, e.g., the x in x.m.
Definition ExprCXX.h:3960
NestedNameSpecifierLoc getQualifierLoc() const
Retrieve the nested-name-specifier that qualifies the member name, with source location information.
Definition ExprCXX.h:3983
const_child_range children() const
Definition ExprCXX.h:4100
bool hasTemplateKeyword() const
Determines whether the member name was preceded by the template keyword.
Definition ExprCXX.h:4039
bool isImplicitAccess() const
True if this is an implicit access, i.e.
Definition ExprCXX.h:3952
ArrayRef< TemplateArgumentLoc > template_arguments() const
Definition ExprCXX.h:4071
Represents a C++ destructor within a class.
Definition DeclCXX.h:2869
static bool classof(const Stmt *T)
Definition ExprCXX.h:510
friend class CastExpr
Definition ExprCXX.h:495
static CXXDynamicCastExpr * CreateEmpty(const ASTContext &Context, unsigned pathSize)
Definition ExprCXX.cpp:824
bool isAlwaysNull() const
isAlwaysNull - Return whether the result of the dynamic_cast is proven to always be null.
Definition ExprCXX.cpp:838
static bool classof(const Stmt *T)
Definition ExprCXX.h:5097
SourceLocation getBeginLoc() const LLVM_READONLY
Definition ExprCXX.h:5081
UnresolvedLookupExpr * getCallee() const
Definition ExprCXX.h:5054
Expr * getInit() const
Get the operand that doesn't contain a pack, for a binary fold.
Definition ExprCXX.h:5072
CXXFoldExpr(EmptyShell Empty)
Definition ExprCXX.h:5052
CXXFoldExpr(QualType T, UnresolvedLookupExpr *Callee, SourceLocation LParenLoc, Expr *LHS, BinaryOperatorKind Opcode, SourceLocation EllipsisLoc, Expr *RHS, SourceLocation RParenLoc, UnsignedOrNone NumExpansions)
Definition ExprCXX.cpp:2004
SourceLocation getEndLoc() const LLVM_READONLY
Definition ExprCXX.h:5089
Expr * getRHS() const
Definition ExprCXX.h:5058
const_child_range children() const
Definition ExprCXX.h:5106
SourceLocation getLParenLoc() const
Definition ExprCXX.h:5074
SourceLocation getEllipsisLoc() const
Definition ExprCXX.h:5076
bool isLeftFold() const
Does this produce a left-associated sequence of operators?
Definition ExprCXX.h:5066
UnsignedOrNone getNumExpansions() const
Definition ExprCXX.h:5079
child_range children()
Definition ExprCXX.h:5102
bool isRightFold() const
Does this produce a right-associated sequence of operators?
Definition ExprCXX.h:5061
friend class ASTStmtWriter
Definition ExprCXX.h:5034
Expr * getPattern() const
Get the pattern, that is, the operand that contains an unexpanded pack.
Definition ExprCXX.h:5069
Expr * getLHS() const
Definition ExprCXX.h:5057
friend class ASTStmtReader
Definition ExprCXX.h:5033
SourceLocation getRParenLoc() const
Definition ExprCXX.h:5075
BinaryOperatorKind getOperator() const
Definition ExprCXX.h:5077
void setLParenLoc(SourceLocation L)
Definition ExprCXX.h:1869
SourceLocation getLParenLoc() const
Definition ExprCXX.h:1868
static CXXFunctionalCastExpr * CreateEmpty(const ASTContext &Context, unsigned PathSize, bool HasFPFeatures)
Definition ExprCXX.cpp:934
SourceLocation getRParenLoc() const
Definition ExprCXX.h:1870
SourceLocation getBeginLoc() const LLVM_READONLY
Definition ExprCXX.cpp:944
void setRParenLoc(SourceLocation L)
Definition ExprCXX.h:1871
static bool classof(const Stmt *T)
Definition ExprCXX.h:1879
bool isListInitialization() const
Determine whether this expression models list-initialization.
Definition ExprCXX.h:1874
SourceLocation getEndLoc() const LLVM_READONLY
Definition ExprCXX.cpp:948
CXXInheritedCtorInitExpr(EmptyShell Empty)
Construct an empty C++ inheriting construction expression.
Definition ExprCXX.h:1783
const_child_range children() const
Definition ExprCXX.h:1816
CXXConstructionKind getConstructionKind() const
Definition ExprCXX.h:1793
SourceLocation getBeginLoc() const LLVM_READONLY
Definition ExprCXX.h:1805
static bool classof(const Stmt *T)
Definition ExprCXX.h:1808
bool constructsVBase() const
Determine whether this constructor is actually constructing a base class (rather than a complete obje...
Definition ExprCXX.h:1792
CXXConstructorDecl * getConstructor() const
Get the constructor that this expression will call.
Definition ExprCXX.h:1788
CXXInheritedCtorInitExpr(SourceLocation Loc, QualType T, CXXConstructorDecl *Ctor, bool ConstructsVirtualBase, bool InheritedFromVirtualBase)
Construct a C++ inheriting construction expression.
Definition ExprCXX.h:1771
SourceLocation getLocation() const LLVM_READONLY
Definition ExprCXX.h:1804
SourceLocation getEndLoc() const LLVM_READONLY
Definition ExprCXX.h:1806
bool inheritedFromVBase() const
Determine whether the inherited constructor is inherited from a virtual base of the object we constru...
Definition ExprCXX.h:1802
CXXMethodDecl * getMethodDecl() const
Retrieve the declaration of the called method.
Definition ExprCXX.cpp:741
Expr * getImplicitObjectArgument() const
Retrieve the implicit object argument for the member call.
Definition ExprCXX.cpp:722
static CXXMemberCallExpr * CreateEmpty(const ASTContext &Ctx, unsigned NumArgs, bool HasFPFeatures, EmptyShell Empty)
Definition ExprCXX.cpp:709
QualType getObjectType() const
Retrieve the type of the object argument.
Definition ExprCXX.cpp:734
SourceLocation getExprLoc() const LLVM_READONLY
Definition ExprCXX.h:220
static bool classof(const Stmt *T)
Definition ExprCXX.h:228
CXXRecordDecl * getRecordDecl() const
Retrieve the CXXRecordDecl for the underlying type of the implicit object argument.
Definition ExprCXX.cpp:750
Represents a static or instance method of a struct/union/class.
Definition DeclCXX.h:2129
SourceLocation getBeginLoc() const LLVM_READONLY
Definition ExprCXX.h:411
SourceLocation getOperatorLoc() const
Retrieve the location of the cast operator keyword, e.g., static_cast.
Definition ExprCXX.h:406
const char * getCastName() const
getCastName - Get the name of the C++ cast being used, e.g., "static_cast", "dynamic_cast",...
Definition ExprCXX.cpp:768
CXXNamedCastExpr(StmtClass SC, QualType ty, ExprValueKind VK, CastKind kind, Expr *op, unsigned PathSize, bool HasFPFeatures, TypeSourceInfo *writtenTy, SourceLocation l, SourceLocation RParenLoc, SourceRange AngleBrackets)
Definition ExprCXX.h:389
static bool classof(const Stmt *T)
Definition ExprCXX.h:415
CXXNamedCastExpr(StmtClass SC, EmptyShell Shell, unsigned PathSize, bool HasFPFeatures)
Definition ExprCXX.h:397
SourceRange getAngleBrackets() const LLVM_READONLY
Definition ExprCXX.h:413
friend class ASTStmtReader
Definition ExprCXX.h:387
SourceLocation getEndLoc() const LLVM_READONLY
Definition ExprCXX.h:412
SourceLocation getRParenLoc() const
Retrieve the location of the closing parenthesis.
Definition ExprCXX.h:409
static CXXNewExpr * CreateEmpty(const ASTContext &Ctx, bool IsArray, bool HasInit, unsigned NumPlacementArgs, bool IsParenTypeId)
Create an empty c++ new expression.
Definition ExprCXX.cpp:315
bool isArray() const
Definition ExprCXX.h:2464
SourceRange getDirectInitRange() const
Definition ExprCXX.h:2609
llvm::iterator_range< arg_iterator > placement_arguments()
Definition ExprCXX.h:2572
ExprIterator arg_iterator
Definition ExprCXX.h:2569
QualType getAllocatedType() const
Definition ExprCXX.h:2434
unsigned getNumImplicitArgs() const
Definition ExprCXX.h:2511
arg_iterator placement_arg_end()
Definition ExprCXX.h:2583
std::optional< const Expr * > getArraySize() const
This might return std::nullopt even if isArray() returns true, since there might not be an array size...
Definition ExprCXX.h:2483
const_arg_iterator placement_arg_begin() const
Definition ExprCXX.h:2586
std::optional< Expr * > getArraySize()
This might return std::nullopt even if isArray() returns true, since there might not be an array size...
Definition ExprCXX.h:2469
SourceLocation getEndLoc() const
Definition ExprCXX.h:2607
CXXNewInitializationStyle getInitializationStyle() const
The kind of initializer this new-expression has.
Definition ExprCXX.h:2527
ImplicitAllocationParameters implicitAllocationParameters() const
Provides the full set of information about expected implicit parameters in this call.
Definition ExprCXX.h:2562
Expr * getPlacementArg(unsigned I)
Definition ExprCXX.h:2503
bool hasInitializer() const
Whether this new-expression has any initializer at all.
Definition ExprCXX.h:2524
const Expr * getInitializer() const
Definition ExprCXX.h:2538
bool shouldNullCheckAllocation() const
True if the allocation result needs to be null-checked.
Definition ExprCXX.cpp:326
const Expr * getPlacementArg(unsigned I) const
Definition ExprCXX.h:2507
static bool classof(const Stmt *T)
Definition ExprCXX.h:2612
SourceLocation getBeginLoc() const
Definition ExprCXX.h:2606
Stmt ** raw_arg_iterator
Definition ExprCXX.h:2593
void setOperatorDelete(FunctionDecl *D)
Definition ExprCXX.h:2462
bool passAlignment() const
Indicates whether the required alignment should be implicitly passed to the allocation function.
Definition ExprCXX.h:2551
FunctionDecl * getOperatorDelete() const
Definition ExprCXX.h:2461
unsigned getNumPlacementArgs() const
Definition ExprCXX.h:2494
const CXXConstructExpr * getConstructExpr() const
Returns the CXXConstructExpr from this new-expression, or null.
Definition ExprCXX.h:2545
llvm::iterator_range< const_arg_iterator > placement_arguments() const
Definition ExprCXX.h:2576
const_arg_iterator placement_arg_end() const
Definition ExprCXX.h:2589
TypeSourceInfo * getAllocatedTypeSourceInfo() const
Definition ExprCXX.h:2438
SourceRange getSourceRange() const
Definition ExprCXX.h:2610
SourceRange getTypeIdParens() const
Definition ExprCXX.h:2516
Expr ** getPlacementArgs()
Definition ExprCXX.h:2498
bool isParenTypeId() const
Definition ExprCXX.h:2515
raw_arg_iterator raw_arg_end()
Definition ExprCXX.h:2596
child_range children()
Definition ExprCXX.h:2617
bool doesUsualArrayDeleteWantSize() const
Answers whether the usual array deallocation function for the allocated type expects the size of the ...
Definition ExprCXX.h:2556
const_arg_iterator raw_arg_end() const
Definition ExprCXX.h:2602
const_child_range children() const
Definition ExprCXX.h:2619
friend class ASTStmtWriter
Definition ExprCXX.h:2357
arg_iterator placement_arg_begin()
Definition ExprCXX.h:2580
raw_arg_iterator raw_arg_begin()
Definition ExprCXX.h:2595
void setOperatorNew(FunctionDecl *D)
Definition ExprCXX.h:2460
friend class ASTStmtReader
Definition ExprCXX.h:2356
FunctionDecl * getOperatorNew() const
Definition ExprCXX.h:2459
const_arg_iterator raw_arg_begin() const
Definition ExprCXX.h:2599
ConstExprIterator const_arg_iterator
Definition ExprCXX.h:2570
bool isGlobalNew() const
Definition ExprCXX.h:2521
Expr * getInitializer()
The initializer of this new-expression.
Definition ExprCXX.h:2533
bool getValue() const
Definition ExprCXX.h:4332
static bool classof(const Stmt *T)
Definition ExprCXX.h:4334
const_child_range children() const
Definition ExprCXX.h:4341
SourceLocation getEndLoc() const
Definition ExprCXX.h:4329
Expr * getOperand() const
Definition ExprCXX.h:4326
SourceLocation getBeginLoc() const
Definition ExprCXX.h:4328
SourceRange getSourceRange() const
Definition ExprCXX.h:4330
CXXNoexceptExpr(EmptyShell Empty)
Definition ExprCXX.h:4324
CXXNoexceptExpr(QualType Ty, Expr *Operand, CanThrowResult Val, SourceLocation Keyword, SourceLocation RParen)
Definition ExprCXX.h:4316
child_range children()
Definition ExprCXX.h:4339
friend class ASTStmtReader
Definition ExprCXX.h:4310
const_child_range children() const
Definition ExprCXX.h:793
CXXNullPtrLiteralExpr(EmptyShell Empty)
Definition ExprCXX.h:776
void setLocation(SourceLocation L)
Definition ExprCXX.h:783
SourceLocation getEndLoc() const
Definition ExprCXX.h:780
static bool classof(const Stmt *T)
Definition ExprCXX.h:785
CXXNullPtrLiteralExpr(QualType Ty, SourceLocation Loc)
Definition ExprCXX.h:770
SourceLocation getLocation() const
Definition ExprCXX.h:782
SourceLocation getBeginLoc() const
Definition ExprCXX.h:779
bool isInfixBinaryOp() const
Is this written as an infix binary operator?
Definition ExprCXX.cpp:48
bool isAssignmentOp() const
Definition ExprCXX.h:126
static bool classof(const Stmt *T)
Definition ExprCXX.h:166
SourceLocation getOperatorLoc() const
Returns the location of the operator symbol in the expression.
Definition ExprCXX.h:152
SourceLocation getEndLoc() const
Definition ExprCXX.h:163
SourceLocation getExprLoc() const LLVM_READONLY
Definition ExprCXX.h:154
OverloadedOperatorKind getOperator() const
Returns the kind of overloaded operator that this expression refers to.
Definition ExprCXX.h:114
static CXXOperatorCallExpr * Create(const ASTContext &Ctx, OverloadedOperatorKind OpKind, Expr *Fn, ArrayRef< Expr * > Args, QualType Ty, ExprValueKind VK, SourceLocation OperatorLoc, FPOptionsOverride FPFeatures, ADLCallKind UsesADL=NotADL)
Definition ExprCXX.cpp:624
friend class ASTStmtWriter
Definition ExprCXX.h:86
static CXXOperatorCallExpr * CreateEmpty(const ASTContext &Ctx, unsigned NumArgs, bool HasFPFeatures, EmptyShell Empty)
Definition ExprCXX.cpp:641
friend class ASTStmtReader
Definition ExprCXX.h:85
SourceLocation getBeginLoc() const
Definition ExprCXX.h:162
static bool isComparisonOp(OverloadedOperatorKind Opc)
Definition ExprCXX.h:128
static bool isAssignmentOp(OverloadedOperatorKind Opc)
Definition ExprCXX.h:119
bool isComparisonOp() const
Definition ExprCXX.h:142
SourceRange getSourceRange() const
Definition ExprCXX.h:164
ArrayRef< Expr * > getInitExprs() const
Definition ExprCXX.h:5185
SourceRange getSourceRange() const LLVM_READONLY
Definition ExprCXX.h:5201
const_child_range children() const
Definition ExprCXX.h:5232
void setInitializedFieldInUnion(FieldDecl *FD)
Definition ExprCXX.h:5215
SourceLocation getEndLoc() const LLVM_READONLY
Definition ExprCXX.h:5197
SourceLocation getInitLoc() const LLVM_READONLY
Definition ExprCXX.h:5199
MutableArrayRef< Expr * > getInitExprs()
Definition ExprCXX.h:5181
ArrayRef< Expr * > getUserSpecifiedInitExprs()
Definition ExprCXX.h:5187
ArrayRef< Expr * > getUserSpecifiedInitExprs() const
Definition ExprCXX.h:5191
CXXParenListInitExpr(EmptyShell Empty, unsigned NumExprs)
Definition ExprCXX.h:5175
friend class TrailingObjects
Definition ExprCXX.h:5142
static CXXParenListInitExpr * CreateEmpty(ASTContext &C, unsigned numExprs, EmptyShell Empty)
Definition ExprCXX.cpp:1996
const FieldDecl * getInitializedFieldInUnion() const
Definition ExprCXX.h:5223
SourceLocation getBeginLoc() const LLVM_READONLY
Definition ExprCXX.h:5195
static bool classof(const Stmt *T)
Definition ExprCXX.h:5237
FieldDecl * getInitializedFieldInUnion()
Definition ExprCXX.h:5219
const Expr * getArrayFiller() const
Definition ExprCXX.h:5211
void setArrayFiller(Expr *E)
Definition ExprCXX.h:5205
TypeSourceInfo * getDestroyedTypeInfo() const
Retrieve the source location information for the type being destroyed.
Definition ExprCXX.h:2839
SourceLocation getBeginLoc() const LLVM_READONLY
Definition ExprCXX.h:2869
bool isArrow() const
Determine whether this pseudo-destructor expression was written using an '->' (otherwise,...
Definition ExprCXX.h:2809
TypeSourceInfo * getScopeTypeInfo() const
Retrieve the scope type in a qualified pseudo-destructor expression.
Definition ExprCXX.h:2823
CXXPseudoDestructorExpr(const ASTContext &Context, Expr *Base, bool isArrow, SourceLocation OperatorLoc, NestedNameSpecifierLoc QualifierLoc, TypeSourceInfo *ScopeType, SourceLocation ColonColonLoc, SourceLocation TildeLoc, PseudoDestructorTypeStorage DestroyedType)
Definition ExprCXX.cpp:371
static bool classof(const Stmt *T)
Definition ExprCXX.h:2874
SourceLocation getTildeLoc() const
Retrieve the location of the '~'.
Definition ExprCXX.h:2830
NestedNameSpecifierLoc getQualifierLoc() const
Retrieves the nested-name-specifier that qualifies the type name, with source-location information.
Definition ExprCXX.h:2798
SourceLocation getEndLoc() const LLVM_READONLY
Definition ExprCXX.cpp:392
SourceLocation getDestroyedTypeLoc() const
Retrieve the starting location of the type being destroyed.
Definition ExprCXX.h:2854
SourceLocation getColonColonLoc() const
Retrieve the location of the '::' in a qualified pseudo-destructor expression.
Definition ExprCXX.h:2827
const_child_range children() const
Definition ExprCXX.h:2881
QualType getDestroyedType() const
Retrieve the type being destroyed.
Definition ExprCXX.cpp:385
SourceLocation getOperatorLoc() const
Retrieve the location of the '.' or '->' operator.
Definition ExprCXX.h:2812
NestedNameSpecifier getQualifier() const
If the member name was qualified, retrieves the nested-name-specifier that precedes the member name.
Definition ExprCXX.h:2803
void setDestroyedType(IdentifierInfo *II, SourceLocation Loc)
Set the name of destroyed type for a dependent pseudo-destructor expression.
Definition ExprCXX.h:2860
const IdentifierInfo * getDestroyedTypeIdentifier() const
In a dependent pseudo-destructor expression for which we do not have full type information on the des...
Definition ExprCXX.h:2846
void setDestroyedType(TypeSourceInfo *Info)
Set the destroyed type.
Definition ExprCXX.h:2865
bool hasQualifier() const
Determines whether this member expression actually had a C++ nested-name-specifier prior to the name ...
Definition ExprCXX.h:2794
CXXPseudoDestructorExpr(EmptyShell Shell)
Definition ExprCXX.h:2786
Represents a C++ struct/union/class.
Definition DeclCXX.h:258
static bool classof(const Stmt *T)
Definition ExprCXX.h:552
static CXXReinterpretCastExpr * CreateEmpty(const ASTContext &Context, unsigned pathSize)
Definition ExprCXX.cpp:887
Expr * getSemanticForm()
Get an equivalent semantic form for this expression.
Definition ExprCXX.h:304
SourceLocation getOperatorLoc() const LLVM_READONLY
Definition ExprCXX.h:338
BinaryOperatorKind getOperator() const
Definition ExprCXX.h:324
SourceLocation getEndLoc() const LLVM_READONLY
Definition ExprCXX.h:350
SourceRange getSourceRange() const LLVM_READONLY
Definition ExprCXX.h:353
bool isReversed() const
Determine whether this expression was rewritten in reverse form.
Definition ExprCXX.h:322
CXXRewrittenBinaryOperator(Expr *SemanticForm, bool IsReversed)
Definition ExprCXX.h:293
const Expr * getLHS() const
Definition ExprCXX.h:335
StringRef getOpcodeStr() const
Definition ExprCXX.h:329
CXXRewrittenBinaryOperator(EmptyShell Empty)
Definition ExprCXX.h:300
SourceLocation getBeginLoc() const LLVM_READONLY
Compute the begin and end locations from the decomposed form.
Definition ExprCXX.h:347
SourceLocation getExprLoc() const LLVM_READONLY
Definition ExprCXX.h:341
const Expr * getRHS() const
Definition ExprCXX.h:336
static bool classof(const Stmt *T)
Definition ExprCXX.h:363
BinaryOperatorKind getOpcode() const
Definition ExprCXX.h:325
static StringRef getOpcodeStr(BinaryOperatorKind Op)
Definition ExprCXX.h:326
DecomposedForm getDecomposedForm() const LLVM_READONLY
Decompose this operator into its syntactic form.
Definition ExprCXX.cpp:65
const Expr * getSemanticForm() const
Definition ExprCXX.h:305
CXXScalarValueInitExpr(EmptyShell Shell)
Definition ExprCXX.h:2212
const_child_range children() const
Definition ExprCXX.h:2235
TypeSourceInfo * getTypeSourceInfo() const
Definition ExprCXX.h:2215
SourceLocation getBeginLoc() const LLVM_READONLY
Definition ExprCXX.cpp:223
static bool classof(const Stmt *T)
Definition ExprCXX.h:2226
SourceLocation getEndLoc() const
Definition ExprCXX.h:2224
SourceLocation getRParenLoc() const
Definition ExprCXX.h:2219
CXXScalarValueInitExpr(QualType Type, TypeSourceInfo *TypeInfo, SourceLocation RParenLoc)
Create an explicitly-written scalar-value initialization expression.
Definition ExprCXX.h:2204
static CXXStaticCastExpr * CreateEmpty(const ASTContext &Context, unsigned PathSize, bool hasFPFeatures)
Definition ExprCXX.cpp:797
friend class CastExpr
Definition ExprCXX.h:458
static bool classof(const Stmt *T)
Definition ExprCXX.h:469
SourceRange getSourceRange() const LLVM_READONLY
Retrieve the source range of the expression.
Definition ExprCXX.h:828
const_child_range children() const
Definition ExprCXX.h:838
CXXStdInitializerListExpr(QualType Ty, Expr *SubExpr)
Definition ExprCXX.h:810
SourceLocation getEndLoc() const LLVM_READONLY
Definition ExprCXX.h:823
SourceLocation getBeginLoc() const LLVM_READONLY
Definition ExprCXX.h:819
const Expr * getSubExpr() const
Definition ExprCXX.h:817
static bool classof(const Stmt *S)
Definition ExprCXX.h:832
TypeSourceInfo * getTypeSourceInfo() const
Definition ExprCXX.h:1928
SourceLocation getEndLoc() const LLVM_READONLY
Definition ExprCXX.cpp:1173
static CXXTemporaryObjectExpr * CreateEmpty(const ASTContext &Ctx, unsigned NumArgs)
Definition ExprCXX.cpp:1161
static bool classof(const Stmt *T)
Definition ExprCXX.h:1933
SourceLocation getBeginLoc() const LLVM_READONLY
Definition ExprCXX.cpp:1169
Represents a C++ temporary.
Definition ExprCXX.h:1459
const CXXDestructorDecl * getDestructor() const
Definition ExprCXX.h:1470
void setDestructor(const CXXDestructorDecl *Dtor)
Definition ExprCXX.h:1472
void setCapturedByCopyInLambdaWithExplicitObjectParameter(bool Set)
Definition ExprCXX.h:1184
SourceLocation getBeginLoc() const
Definition ExprCXX.h:1174
void setLocation(SourceLocation L)
Definition ExprCXX.h:1172
SourceLocation getEndLoc() const
Definition ExprCXX.h:1175
bool isCapturedByCopyInLambdaWithExplicitObjectParameter() const
Definition ExprCXX.h:1180
static CXXThisExpr * CreateEmpty(const ASTContext &Ctx)
Definition ExprCXX.cpp:1591
void setImplicit(bool I)
Definition ExprCXX.h:1178
child_range children()
Definition ExprCXX.h:1194
bool isImplicit() const
Definition ExprCXX.h:1177
static bool classof(const Stmt *T)
Definition ExprCXX.h:1189
const_child_range children() const
Definition ExprCXX.h:1198
SourceLocation getLocation() const
Definition ExprCXX.h:1171
CXXThrowExpr(EmptyShell Empty)
Definition ExprCXX.h:1226
const_child_range children() const
Definition ExprCXX.h:1258
SourceLocation getEndLoc() const LLVM_READONLY
Definition ExprCXX.h:1243
const Expr * getSubExpr() const
Definition ExprCXX.h:1228
CXXThrowExpr(Expr *Operand, QualType Ty, SourceLocation Loc, bool IsThrownVariableInScope)
Definition ExprCXX.h:1219
SourceLocation getThrowLoc() const
Definition ExprCXX.h:1231
Expr * getSubExpr()
Definition ExprCXX.h:1229
SourceLocation getBeginLoc() const
Definition ExprCXX.h:1242
bool isThrownVariableInScope() const
Determines whether the variable thrown by this expression (if any!) is within the innermost try block...
Definition ExprCXX.h:1238
static bool classof(const Stmt *T)
Definition ExprCXX.h:1249
child_range children()
Definition ExprCXX.h:1254
friend class ASTStmtReader
Definition ExprCXX.h:1209
CXXTypeidExpr(QualType Ty, Expr *Operand, SourceRange R)
Definition ExprCXX.h:862
static bool classof(const Stmt *T)
Definition ExprCXX.h:905
CXXTypeidExpr(QualType Ty, TypeSourceInfo *Operand, SourceRange R)
Definition ExprCXX.h:856
bool isTypeOperand() const
Definition ExprCXX.h:884
QualType getTypeOperand(const ASTContext &Context) const
Retrieves the type operand of this typeid() expression after various required adjustments (removing r...
Definition ExprCXX.cpp:161
TypeSourceInfo * getTypeOperandSourceInfo() const
Retrieve source information for the type operand.
Definition ExprCXX.h:891
SourceLocation getBeginLoc() const LLVM_READONLY
Definition ExprCXX.h:900
Expr * getExprOperand() const
Definition ExprCXX.h:895
child_range children()
Definition ExprCXX.h:910
SourceRange getSourceRange() const LLVM_READONLY
Definition ExprCXX.h:902
bool isMostDerived(const ASTContext &Context) const
Best-effort check if the expression operand refers to a most derived object.
Definition ExprCXX.cpp:149
void setSourceRange(SourceRange R)
Definition ExprCXX.h:903
const_child_range children() const
Definition ExprCXX.h:917
SourceLocation getEndLoc() const LLVM_READONLY
Definition ExprCXX.h:901
friend class ASTStmtReader
Definition ExprCXX.h:849
bool isPotentiallyEvaluated() const
Determine whether this typeid has a type operand which is potentially evaluated, per C++11 [expr....
Definition ExprCXX.cpp:134
CXXTypeidExpr(EmptyShell Empty, bool isExpr)
Definition ExprCXX.h:868
bool hasNullCheck() const
Whether this is of a form like "typeid(*ptr)" that can throw a std::bad_typeid if a pointer is a null...
Definition ExprCXX.cpp:200
Describes an explicit type conversion that uses functional notion but could not be resolved because o...
Definition ExprCXX.h:3744
const_child_range children() const
Definition ExprCXX.h:3852
const Expr *const * const_arg_iterator
Definition ExprCXX.h:3811
void setRParenLoc(SourceLocation L)
Definition ExprCXX.h:3794
void setArg(unsigned I, Expr *E)
Definition ExprCXX.h:3830
SourceLocation getLParenLoc() const
Retrieve the location of the left parentheses ('(') that precedes the argument list.
Definition ExprCXX.h:3788
bool isListInitialization() const
Determine whether this expression models list-initialization.
Definition ExprCXX.h:3799
TypeSourceInfo * getTypeSourceInfo() const
Retrieve the type source information for the type being constructed.
Definition ExprCXX.h:3782
const_arg_range arguments() const
Definition ExprCXX.h:3816
QualType getTypeAsWritten() const
Retrieve the type that is being constructed, as specified in the source code.
Definition ExprCXX.h:3778
const_arg_iterator arg_end() const
Definition ExprCXX.h:3815
SourceLocation getEndLoc() const LLVM_READONLY
Definition ExprCXX.h:3836
llvm::iterator_range< const_arg_iterator > const_arg_range
Definition ExprCXX.h:3812
void setLParenLoc(SourceLocation L)
Definition ExprCXX.h:3789
const Expr * getArg(unsigned I) const
Definition ExprCXX.h:3825
SourceLocation getRParenLoc() const
Retrieve the location of the right parentheses (')') that follows the argument list.
Definition ExprCXX.h:3793
SourceLocation getBeginLoc() const LLVM_READONLY
Definition ExprCXX.cpp:1504
unsigned getNumArgs() const
Retrieve the number of arguments.
Definition ExprCXX.h:3802
static bool classof(const Stmt *T)
Definition ExprCXX.h:3842
static CXXUnresolvedConstructExpr * CreateEmpty(const ASTContext &Context, unsigned NumArgs)
Definition ExprCXX.cpp:1498
llvm::iterator_range< arg_iterator > arg_range
Definition ExprCXX.h:3805
const_arg_iterator arg_begin() const
Definition ExprCXX.h:3814
child_range children()
Definition ExprCXX.h:1126
SourceLocation getBeginLoc() const LLVM_READONLY
Definition ExprCXX.h:1116
static bool classof(const Stmt *T)
Definition ExprCXX.h:1121
const_child_range children() const
Definition ExprCXX.h:1133
Expr * getExprOperand() const
Definition ExprCXX.h:1109
CXXUuidofExpr(QualType Ty, TypeSourceInfo *Operand, MSGuidDecl *Guid, SourceRange R)
Definition ExprCXX.h:1077
MSGuidDecl * getGuidDecl() const
Definition ExprCXX.h:1114
QualType getTypeOperand(ASTContext &Context) const
Retrieves the type operand of this __uuidof() expression after various required adjustments (removing...
Definition ExprCXX.cpp:215
bool isTypeOperand() const
Definition ExprCXX.h:1098
CXXUuidofExpr(QualType Ty, Expr *Operand, MSGuidDecl *Guid, SourceRange R)
Definition ExprCXX.h:1084
TypeSourceInfo * getTypeOperandSourceInfo() const
Retrieve source information for the type operand.
Definition ExprCXX.h:1105
void setSourceRange(SourceRange R)
Definition ExprCXX.h:1119
friend class ASTStmtReader
Definition ExprCXX.h:1069
SourceRange getSourceRange() const LLVM_READONLY
Definition ExprCXX.h:1118
SourceLocation getEndLoc() const LLVM_READONLY
Definition ExprCXX.h:1117
CXXUuidofExpr(EmptyShell Empty, bool isExpr)
Definition ExprCXX.h:1090
CallExpr - Represents a function call (C99 6.5.2.2, C++ [expr.call]).
Definition Expr.h:2877
Expr * getArg(unsigned Arg)
getArg - Return the specified argument.
Definition Expr.h:3081
static constexpr ADLCallKind NotADL
Definition Expr.h:2943
SourceLocation getBeginLoc() const
Definition Expr.h:3211
Expr * getCallee()
Definition Expr.h:3024
CallExpr(StmtClass SC, Expr *Fn, ArrayRef< Expr * > PreArgs, ArrayRef< Expr * > Args, QualType Ty, ExprValueKind VK, SourceLocation RParenLoc, FPOptionsOverride FPFeatures, unsigned MinNumArgs, ADLCallKind UsesADL)
Build a call expression, assuming that appropriate storage has been allocated for the trailing object...
Definition Expr.cpp:1472
SourceLocation getRParenLoc() const
Definition Expr.h:3208
static constexpr ADLCallKind UsesADL
Definition Expr.h:2944
Stmt * getPreArg(unsigned I)
Definition Expr.h:2966
FPOptionsOverride * getTrailingFPFeatures()
Return a pointer to the trailing FPOptions.
Definition Expr.cpp:2051
unsigned path_size() const
Definition Expr.h:3679
bool hasStoredFPFeatures() const
Definition Expr.h:3709
void setIsImplicit(bool value=true)
Definition ExprCXX.h:5392
bool isImplicit() const
Definition ExprCXX.h:5391
static bool classof(const Stmt *T)
Definition ExprCXX.h:5394
CoawaitExpr(EmptyShell Empty)
Definition ExprCXX.h:5388
friend class ASTStmtReader
Definition ExprCXX.h:5370
CoawaitExpr(SourceLocation CoawaitLoc, QualType Ty, Expr *Operand, Expr *Common, bool IsImplicit=false)
Definition ExprCXX.h:5381
CoawaitExpr(SourceLocation CoawaitLoc, Expr *Operand, Expr *Common, Expr *Ready, Expr *Suspend, Expr *Resume, OpaqueValueExpr *OpaqueValue, bool IsImplicit=false)
Definition ExprCXX.h:5373
CompoundStmt - This represents a group of statements like { stmt stmt }.
Definition Stmt.h:1719
ConstantExpr - An expression that occurs in a constant context and optionally the result of evaluatin...
Definition Expr.h:1082
llvm::APSInt getResultAsAPSInt() const
Definition Expr.cpp:400
SuspendReturnType getSuspendReturnType() const
Definition ExprCXX.h:5328
CoroutineSuspendExpr(StmtClass SC, SourceLocation KeywordLoc, Expr *Operand, Expr *Common, Expr *Ready, Expr *Suspend, Expr *Resume, OpaqueValueExpr *OpaqueValue)
Definition ExprCXX.h:5269
Expr * getReadyExpr() const
Definition ExprCXX.h:5311
SourceLocation getKeywordLoc() const
Definition ExprCXX.h:5346
Expr * getResumeExpr() const
Definition ExprCXX.h:5319
SourceLocation getBeginLoc() const LLVM_READONLY
Definition ExprCXX.h:5348
Expr * getSuspendExpr() const
Definition ExprCXX.h:5315
CoroutineSuspendExpr(StmtClass SC, SourceLocation KeywordLoc, QualType Ty, Expr *Operand, Expr *Common)
Definition ExprCXX.h:5283
static bool classof(const Stmt *T)
Definition ExprCXX.h:5362
OpaqueValueExpr * getOpaqueValue() const
getOpaqueValue - Return the opaque value placeholder.
Definition ExprCXX.h:5309
Expr * getCommonExpr() const
Definition ExprCXX.h:5304
Expr * getOperand() const
Definition ExprCXX.h:5324
const_child_range children() const
Definition ExprCXX.h:5358
CoroutineSuspendExpr(StmtClass SC, EmptyShell Empty)
Definition ExprCXX.h:5296
SourceLocation getEndLoc() const LLVM_READONLY
Definition ExprCXX.h:5350
CoyieldExpr(EmptyShell Empty)
Definition ExprCXX.h:5463
CoyieldExpr(SourceLocation CoyieldLoc, Expr *Operand, Expr *Common, Expr *Ready, Expr *Suspend, Expr *Resume, OpaqueValueExpr *OpaqueValue)
Definition ExprCXX.h:5454
static bool classof(const Stmt *T)
Definition ExprCXX.h:5466
CoyieldExpr(SourceLocation CoyieldLoc, QualType Ty, Expr *Operand, Expr *Common)
Definition ExprCXX.h:5459
friend class ASTStmtReader
Definition ExprCXX.h:5451
A POD class for pairing a NamedDecl* with an access specifier.
DeclContext - This is used only as base class of specific decl types that can act as declaration cont...
Definition DeclBase.h:1449
Decl - This represents one declaration (or definition), e.g.
Definition DeclBase.h:86
The name of a declaration.
static bool classof(const Stmt *T)
Definition ExprCXX.h:5444
DependentCoawaitExpr(EmptyShell Empty)
Definition ExprCXX.h:5421
SourceLocation getEndLoc() const LLVM_READONLY
Definition ExprCXX.h:5434
const_child_range children() const
Definition ExprCXX.h:5440
Expr * getOperand() const
Definition ExprCXX.h:5424
SourceLocation getBeginLoc() const LLVM_READONLY
Definition ExprCXX.h:5432
DependentCoawaitExpr(SourceLocation KeywordLoc, QualType Ty, Expr *Op, UnresolvedLookupExpr *OpCoawait)
Definition ExprCXX.h:5408
SourceLocation getKeywordLoc() const
Definition ExprCXX.h:5430
UnresolvedLookupExpr * getOperatorCoawaitLookup() const
Definition ExprCXX.h:5426
SourceLocation getRAngleLoc() const
Retrieve the location of the right angle bracket ending the explicit template argument list following...
Definition ExprCXX.h:3584
static DependentScopeDeclRefExpr * CreateEmpty(const ASTContext &Context, bool HasTemplateKWAndArgsInfo, unsigned NumTemplateArgs)
Definition ExprCXX.cpp:559
NestedNameSpecifierLoc getQualifierLoc() const
Retrieve the nested-name-specifier that qualifies the name, with source location information.
Definition ExprCXX.h:3558
SourceLocation getLocation() const
Retrieve the location of the name within the expression.
Definition ExprCXX.h:3554
SourceLocation getLAngleLoc() const
Retrieve the location of the left angle bracket starting the explicit template argument list followin...
Definition ExprCXX.h:3576
ArrayRef< TemplateArgumentLoc > template_arguments() const
Definition ExprCXX.h:3618
const_child_range children() const
Definition ExprCXX.h:3642
static bool classof(const Stmt *T)
Definition ExprCXX.h:3634
bool hasExplicitTemplateArgs() const
Determines whether this lookup had explicit template arguments.
Definition ExprCXX.h:3594
SourceLocation getEndLoc() const LLVM_READONLY
Definition ExprCXX.h:3628
SourceLocation getBeginLoc() const LLVM_READONLY
Note: getBeginLoc() is the start of the whole DependentScopeDeclRefExpr, and differs from getLocation...
Definition ExprCXX.h:3624
NestedNameSpecifier getQualifier() const
Retrieve the nested-name-specifier that qualifies this declaration.
Definition ExprCXX.h:3562
SourceLocation getTemplateKeywordLoc() const
Retrieve the location of the template keyword preceding this name, if any.
Definition ExprCXX.h:3568
bool hasTemplateKeyword() const
Determines whether the name was preceded by the template keyword.
Definition ExprCXX.h:3591
unsigned getNumTemplateArgs() const
Definition ExprCXX.h:3611
DeclarationName getDeclName() const
Retrieve the name that this expression refers to.
Definition ExprCXX.h:3549
TemplateArgumentLoc const * getTemplateArgs() const
Definition ExprCXX.h:3604
void copyTemplateArgumentsInto(TemplateArgumentListInfo &List) const
Copies the template arguments (if present) into the given structure.
Definition ExprCXX.h:3598
const DeclarationNameInfo & getNameInfo() const
Retrieve the name that this expression refers to.
Definition ExprCXX.h:3546
ExplicitCastExpr(StmtClass SC, QualType exprTy, ExprValueKind VK, CastKind kind, Expr *op, unsigned PathSize, bool HasFPFeatures, TypeSourceInfo *writtenTy)
Definition Expr.h:3868
bool cleanupsHaveSideEffects() const
Definition ExprCXX.h:3696
static bool classof(const Stmt *T)
Definition ExprCXX.h:3709
CleanupObject getObject(unsigned i) const
Definition ExprCXX.h:3691
child_range children()
Definition ExprCXX.h:3714
ArrayRef< CleanupObject > getObjects() const
Definition ExprCXX.h:3685
unsigned getNumObjects() const
Definition ExprCXX.h:3689
SourceLocation getEndLoc() const LLVM_READONLY
Definition ExprCXX.h:3704
friend class ASTStmtReader
Definition ExprCXX.h:3670
const_child_range children() const
Definition ExprCXX.h:3716
llvm::PointerUnion< BlockDecl *, CompoundLiteralExpr * > CleanupObject
The type of objects that are kept in the cleanup.
Definition ExprCXX.h:3667
SourceLocation getBeginLoc() const LLVM_READONLY
Definition ExprCXX.h:3700
This represents one expression.
Definition Expr.h:112
static std::pair< const NamedDecl *, const WarnUnusedResultAttr * > getUnusedResultAttrImpl(const Decl *Callee, QualType ReturnType)
Returns the WarnUnusedResultAttr that is declared on the callee or its return type declaration,...
Definition Expr.cpp:1633
bool isImplicitCXXThis() const
Whether this expression is an implicit reference to 'this' in C++.
Definition Expr.cpp:3293
bool isValueDependent() const
Determines whether the value of this expression depends on.
Definition Expr.h:177
ExprValueKind getValueKind() const
getValueKind - The value kind that this expression produces.
Definition Expr.h:444
bool isTypeDependent() const
Determines whether the type of this expression depends on.
Definition Expr.h:194
bool containsUnexpandedParameterPack() const
Whether this expression contains an unexpanded parameter pack (for C++11 variadic templates).
Definition Expr.h:241
Expr * IgnoreParens() LLVM_READONLY
Skip past any parentheses which might surround this expression until reaching a fixed point.
Definition Expr.cpp:3084
bool isLValue() const
isLValue - True if this expression is an "l-value" according to the rules of the current language.
Definition Expr.h:284
ExprObjectKind getObjectKind() const
getObjectKind - The object kind that this expression produces.
Definition Expr.h:451
bool isInstantiationDependent() const
Whether this expression is instantiation-dependent, meaning that it depends in some way on.
Definition Expr.h:223
Expr()=delete
void setValueKind(ExprValueKind Cat)
setValueKind - Set the value kind produced by this expression.
Definition Expr.h:461
SourceLocation getExprLoc() const LLVM_READONLY
getExprLoc - Return the preferred location for the arrow when diagnosing a problem with a generic exp...
Definition Expr.cpp:276
QualType getType() const
Definition Expr.h:144
static ExprValueKind getValueKindForType(QualType T)
getValueKindForType - Given a formal return or parameter type, give its value kind.
Definition Expr.h:434
void setDependence(ExprDependence Deps)
Each concrete expr subclass is expected to compute its dependence and call this in the constructor.
Definition Expr.h:137
ExpressionTraitExpr(SourceLocation loc, ExpressionTrait et, Expr *queried, bool value, SourceLocation rparen, QualType resultType)
Definition ExprCXX.h:3082
static bool classof(const Stmt *T)
Definition ExprCXX.h:3112
ExpressionTraitExpr(EmptyShell Empty)
Definition ExprCXX.h:3095
SourceLocation getBeginLoc() const LLVM_READONLY
Definition ExprCXX.h:3101
Expr * getQueriedExpression() const
Definition ExprCXX.h:3108
ExpressionTrait getTrait() const
Definition ExprCXX.h:3104
friend class ASTStmtReader
Definition ExprCXX.h:3080
SourceLocation getEndLoc() const LLVM_READONLY
Definition ExprCXX.h:3102
const_child_range children() const
Definition ExprCXX.h:3121
Represents difference between two FPOptions values.
bool requiresTrailingStorage() const
Represents a member of a struct/union/class.
Definition Decl.h:3160
Stmt * SubExpr
Definition Expr.h:1051
FullExpr(StmtClass SC, Expr *subexpr)
Definition Expr.h:1053
Represents a function declaration or definition.
Definition Decl.h:2000
const_child_range children() const
Definition ExprCXX.h:4895
ValueDecl * getExpansion(unsigned I) const
Get an expansion of the parameter pack by index.
Definition ExprCXX.h:4882
SourceLocation getEndLoc() const LLVM_READONLY
Definition ExprCXX.h:4885
ValueDecl *const * iterator
Iterators over the parameters which the parameter pack expanded into.
Definition ExprCXX.h:4874
ValueDecl * getParameterPack() const
Get the parameter pack which this expression refers to.
Definition ExprCXX.h:4867
iterator end() const
Definition ExprCXX.h:4876
SourceLocation getBeginLoc() const LLVM_READONLY
Definition ExprCXX.h:4884
unsigned getNumExpansions() const
Get the number of parameters in this parameter pack.
Definition ExprCXX.h:4879
static bool classof(const Stmt *T)
Definition ExprCXX.h:4887
SourceLocation getParameterPackLocation() const
Get the location of the parameter pack.
Definition ExprCXX.h:4870
static FunctionParmPackExpr * CreateEmpty(const ASTContext &Context, unsigned NumParams)
Definition ExprCXX.cpp:1824
iterator begin() const
Definition ExprCXX.h:4875
Declaration of a template function.
One of these records is kept for each identifier that is lexed.
Describes the capture of a variable or of this, or of a C++1y init-capture.
llvm::iterator_range< const_capture_init_iterator > capture_inits() const
Retrieve the initialization expressions for this lambda's captures.
Definition ExprCXX.h:2088
Expr ** capture_init_iterator
Iterator that walks over the capture initialization arguments.
Definition ExprCXX.h:2075
capture_iterator capture_begin() const
Retrieve an iterator pointing to the first lambda capture.
Definition ExprCXX.cpp:1363
static LambdaExpr * CreateDeserialized(const ASTContext &C, unsigned NumCaptures)
Construct a new lambda expression that will be deserialized from an external source.
Definition ExprCXX.cpp:1332
SourceLocation getEndLoc() const LLVM_READONLY
Definition ExprCXX.h:2186
Stmt * getBody() const
Retrieve the body of the lambda.
Definition ExprCXX.cpp:1346
bool hasExplicitParameters() const
Determine whether this lambda has an explicit parameter list vs.
Definition ExprCXX.h:2171
const_capture_init_iterator capture_init_begin() const
Retrieve the first initialization argument for this lambda expression (which initializes the first ca...
Definition ExprCXX.h:2100
bool isGenericLambda() const
Whether this is a generic lambda.
Definition ExprCXX.h:2148
SourceRange getIntroducerRange() const
Retrieve the source range covering the lambda introducer, which contains the explicit capture list su...
Definition ExprCXX.h:2119
bool isMutable() const
Determine whether the lambda is mutable, meaning that any captures values can be modified.
Definition ExprCXX.cpp:1428
capture_iterator implicit_capture_end() const
Retrieve an iterator pointing past the end of the sequence of implicit lambda captures.
Definition ExprCXX.cpp:1392
friend TrailingObjects
Definition ExprCXX.h:2005
CompoundStmt * getCompoundStmtBody()
Definition ExprCXX.h:2160
unsigned capture_size() const
Determine the number of captures in this lambda.
Definition ExprCXX.h:2049
capture_range explicit_captures() const
Retrieve this lambda's explicit captures.
Definition ExprCXX.cpp:1384
bool isInitCapture(const LambdaCapture *Capture) const
Determine whether one of this lambda's captures is an init-capture.
Definition ExprCXX.cpp:1358
const_capture_init_iterator capture_init_end() const
Retrieve the iterator pointing one past the last initialization argument for this lambda expression.
Definition ExprCXX.h:2112
CXXMethodDecl * getCallOperator() const
Retrieve the function call operator associated with this lambda expression.
Definition ExprCXX.cpp:1404
const CompoundStmt * getCompoundStmtBody() const
Retrieve the CompoundStmt representing the body of the lambda.
Definition ExprCXX.cpp:1351
bool hasExplicitResultType() const
Whether this lambda had its result type explicitly specified.
Definition ExprCXX.h:2174
capture_range implicit_captures() const
Retrieve this lambda's implicit captures.
Definition ExprCXX.cpp:1396
const AssociatedConstraint & getTrailingRequiresClause() const
Get the trailing requires clause, if any.
Definition ExprCXX.cpp:1424
TemplateParameterList * getTemplateParameterList() const
If this is a generic lambda expression, retrieve the template parameter list associated with it,...
Definition ExprCXX.cpp:1414
ArrayRef< NamedDecl * > getExplicitTemplateParameters() const
Get the template parameters were explicitly specified (as opposed to being invented by use of an auto...
Definition ExprCXX.cpp:1419
capture_iterator implicit_capture_begin() const
Retrieve an iterator pointing to the first implicit lambda capture.
Definition ExprCXX.cpp:1388
capture_iterator explicit_capture_end() const
Retrieve an iterator pointing past the end of the sequence of explicit lambda captures.
Definition ExprCXX.cpp:1379
capture_iterator capture_end() const
Retrieve an iterator pointing past the end of the sequence of lambda captures.
Definition ExprCXX.cpp:1367
llvm::iterator_range< capture_iterator > capture_range
An iterator over a range of lambda captures.
Definition ExprCXX.h:2036
SourceLocation getCaptureDefaultLoc() const
Retrieve the location of this lambda's capture-default, if any.
Definition ExprCXX.h:2026
capture_init_iterator capture_init_end()
Retrieve the iterator pointing one past the last initialization argument for this lambda expression.
Definition ExprCXX.h:2106
friend class ASTStmtWriter
Definition ExprCXX.h:2004
const LambdaCapture * capture_iterator
An iterator that walks over the captures of the lambda, both implicit and explicit.
Definition ExprCXX.h:2033
Expr *const * const_capture_init_iterator
Const iterator that walks over the capture initialization arguments.
Definition ExprCXX.h:2080
capture_iterator explicit_capture_begin() const
Retrieve an iterator pointing to the first explicit lambda capture.
Definition ExprCXX.cpp:1375
llvm::iterator_range< capture_init_iterator > capture_inits()
Retrieve the initialization expressions for this lambda's captures.
Definition ExprCXX.h:2083
friend class ASTStmtReader
Definition ExprCXX.h:2003
child_range children()
Includes the captures and the body of the lambda.
Definition ExprCXX.cpp:1430
FunctionTemplateDecl * getDependentCallOperator() const
Retrieve the function template call operator associated with this lambda expression.
Definition ExprCXX.cpp:1409
SourceLocation getBeginLoc() const LLVM_READONLY
Definition ExprCXX.h:2182
static bool classof(const Stmt *T)
Definition ExprCXX.h:2178
capture_range captures() const
Retrieve this lambda's captures.
Definition ExprCXX.cpp:1371
capture_init_iterator capture_init_begin()
Retrieve the first initialization argument for this lambda expression (which initializes the first ca...
Definition ExprCXX.h:2094
LambdaCaptureDefault getCaptureDefault() const
Determine the default capture kind for this lambda.
Definition ExprCXX.h:2021
CXXRecordDecl * getLambdaClass() const
Retrieve the class that corresponds to the lambda.
Definition ExprCXX.cpp:1400
Implicit declaration of a temporary that was materialized by a MaterializeTemporaryExpr and lifetime-...
Definition DeclCXX.h:3304
A global _GUID constant.
Definition DeclCXX.h:4394
An instance of this class represents the declaration of a property member.
Definition DeclCXX.h:4340
const_child_range children() const
Definition ExprCXX.h:980
NestedNameSpecifierLoc getQualifierLoc() const
Definition ExprCXX.h:992
MSPropertyRefExpr(EmptyShell Empty)
Definition ExprCXX.h:955
bool isArrow() const
Definition ExprCXX.h:990
bool isImplicitAccess() const
Definition ExprCXX.h:961
SourceRange getSourceRange() const LLVM_READONLY
Definition ExprCXX.h:957
SourceLocation getEndLoc() const
Definition ExprCXX.h:974
MSPropertyDecl * getPropertyDecl() const
Definition ExprCXX.h:989
Expr * getBaseExpr() const
Definition ExprCXX.h:988
child_range children()
Definition ExprCXX.h:976
MSPropertyRefExpr(Expr *baseExpr, MSPropertyDecl *decl, bool isArrow, QualType ty, ExprValueKind VK, NestedNameSpecifierLoc qualifierLoc, SourceLocation nameLoc)
Definition ExprCXX.h:946
static bool classof(const Stmt *T)
Definition ExprCXX.h:984
SourceLocation getBeginLoc() const
Definition ExprCXX.h:965
friend class ASTStmtReader
Definition ExprCXX.h:944
SourceLocation getMemberLoc() const
Definition ExprCXX.h:991
static bool classof(const Stmt *T)
Definition ExprCXX.h:1050
const Expr * getIdx() const
Definition ExprCXX.h:1035
void setRBracketLoc(SourceLocation L)
Definition ExprCXX.h:1044
SourceLocation getEndLoc() const LLVM_READONLY
Definition ExprCXX.h:1041
MSPropertySubscriptExpr(Expr *Base, Expr *Idx, QualType Ty, ExprValueKind VK, ExprObjectKind OK, SourceLocation RBracketLoc)
Definition ExprCXX.h:1018
SourceLocation getExprLoc() const LLVM_READONLY
Definition ExprCXX.h:1046
const_child_range children() const
Definition ExprCXX.h:1059
MSPropertySubscriptExpr(EmptyShell Shell)
Create an empty array subscript expression.
Definition ExprCXX.h:1028
const Expr * getBase() const
Definition ExprCXX.h:1032
SourceLocation getBeginLoc() const LLVM_READONLY
Definition ExprCXX.h:1037
SourceLocation getRBracketLoc() const
Definition ExprCXX.h:1043
MaterializeTemporaryExpr(QualType T, Expr *Temporary, bool BoundToLvalueReference, LifetimeExtendedTemporaryDecl *MTD=nullptr)
Definition ExprCXX.cpp:1830
const LifetimeExtendedTemporaryDecl * getLifetimeExtendedTemporaryDecl() const
Definition ExprCXX.h:4964
StorageDuration getStorageDuration() const
Retrieve the storage duration for the materialized temporary.
Definition ExprCXX.h:4945
Expr * getSubExpr() const
Retrieve the temporary-generating subexpression whose value will be materialized into a glvalue.
Definition ExprCXX.h:4937
APValue * getOrCreateValue(bool MayCreate) const
Get the storage for the constant value of a materialized temporary of static storage duration.
Definition ExprCXX.h:4953
bool isBoundToLvalueReference() const
Determine whether this materialized temporary is bound to an lvalue reference; otherwise,...
Definition ExprCXX.h:4989
ValueDecl * getExtendingDecl()
Get the declaration which triggered the lifetime-extension of this temporary, if any.
Definition ExprCXX.h:4970
bool isUsableInConstantExpressions(const ASTContext &Context) const
Determine whether this temporary object is usable in constant expressions, as specified in C++20 [exp...
Definition ExprCXX.cpp:1861
MaterializeTemporaryExpr(EmptyShell Empty)
Definition ExprCXX.h:4932
LifetimeExtendedTemporaryDecl * getLifetimeExtendedTemporaryDecl()
Definition ExprCXX.h:4960
void setExtendingDecl(ValueDecl *ExtendedBy, unsigned ManglingNumber)
Definition ExprCXX.cpp:1844
SourceLocation getEndLoc() const LLVM_READONLY
Definition ExprCXX.h:4999
const ValueDecl * getExtendingDecl() const
Definition ExprCXX.h:4975
static bool classof(const Stmt *T)
Definition ExprCXX.h:5003
SourceLocation getBeginLoc() const LLVM_READONLY
Definition ExprCXX.h:4995
unsigned getManglingNumber() const
Definition ExprCXX.h:4981
const_child_range children() const
Definition ExprCXX.h:5014
This represents a decl that may have a name.
Definition Decl.h:274
A C++ nested-name-specifier augmented with source location information.
SourceLocation getBeginLoc() const
Retrieve the location of the beginning of this nested-name-specifier.
Represents a C++ nested name specifier, such as "\::std::vector<int>::".
NonTypeTemplateParmDecl - Declares a non-type template parameter, e.g., "Size" in.
OpaqueValueExpr - An expression referring to an opaque object of a fixed type and value class.
Definition Expr.h:1178
static bool classof(const Stmt *T)
Definition ExprCXX.h:3347
ASTTemplateKWAndArgsInfo * getTrailingASTTemplateKWAndArgsInfo()
Return the optional template keyword and arguments info.
Definition ExprCXX.h:4282
bool isVarDeclReference() const
Definition ExprCXX.h:3302
bool hasExplicitTemplateArgs() const
Determines whether this expression had explicit template arguments.
Definition ExprCXX.h:3280
static FindResult find(Expr *E)
Finds the overloaded expression in the given expression E of OverloadTy.
Definition ExprCXX.h:3189
NestedNameSpecifier getQualifier() const
Fetches the nested-name qualifier, if one was given.
Definition ExprCXX.h:3244
SourceLocation getLAngleLoc() const
Retrieve the location of the left angle bracket starting the explicit template argument list followin...
Definition ExprCXX.h:3262
const DeclarationNameInfo & getNameInfo() const
Gets the full name info.
Definition ExprCXX.h:3235
const CXXRecordDecl * getNamingClass() const
Definition ExprCXX.h:3215
SourceLocation getNameLoc() const
Gets the location of the name.
Definition ExprCXX.h:3241
UnresolvedSetImpl::iterator decls_iterator
Definition ExprCXX.h:3219
decls_iterator decls_begin() const
Definition ExprCXX.h:3221
CXXRecordDecl * getNamingClass()
Gets the naming class of this lookup, if any.
Definition ExprCXX.h:4299
unsigned getNumDecls() const
Gets the number of declarations in the unresolved set.
Definition ExprCXX.h:3232
TemplateDecl * getTemplateDecl() const
Definition ExprCXX.h:3313
TemplateTemplateParmDecl * getTemplateTemplateDecl() const
Definition ExprCXX.h:3318
SourceLocation getTemplateKeywordLoc() const
Retrieve the location of the template keyword preceding this name, if any.
Definition ExprCXX.h:3254
NestedNameSpecifierLoc getQualifierLoc() const
Fetches the nested-name qualifier with source-location information, if one was given.
Definition ExprCXX.h:3250
const ASTTemplateKWAndArgsInfo * getTrailingASTTemplateKWAndArgsInfo() const
Definition ExprCXX.h:3160
TemplateArgumentLoc const * getTemplateArgs() const
Definition ExprCXX.h:3324
llvm::iterator_range< decls_iterator > decls() const
Definition ExprCXX.h:3227
friend class ASTStmtWriter
Definition ExprCXX.h:3130
void copyTemplateArgumentsInto(TemplateArgumentListInfo &List) const
Copies the template arguments into the given structure.
Definition ExprCXX.h:3342
TemplateArgumentLoc * getTrailingTemplateArgumentLoc()
Return the optional template arguments.
Definition ExprCXX.h:4292
DeclAccessPair * getTrailingResults()
Return the results. Defined after UnresolvedMemberExpr.
Definition ExprCXX.h:4276
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)
Definition ExprCXX.cpp:479
const DeclAccessPair * getTrailingResults() const
Definition ExprCXX.h:3153
bool isConceptReference() const
Definition ExprCXX.h:3291
friend class ASTStmtReader
Definition ExprCXX.h:3129
bool hasTemplateKWAndArgsInfo() const
Definition ExprCXX.h:3172
decls_iterator decls_end() const
Definition ExprCXX.h:3224
unsigned getNumTemplateArgs() const
Definition ExprCXX.h:3330
const TemplateArgumentLoc * getTrailingTemplateArgumentLoc() const
Definition ExprCXX.h:3168
DeclarationName getName() const
Gets the name looked up.
Definition ExprCXX.h:3238
SourceLocation getRAngleLoc() const
Retrieve the location of the right angle bracket ending the explicit template argument list following...
Definition ExprCXX.h:3270
bool hasTemplateKeyword() const
Determines whether the name was preceded by the template keyword.
Definition ExprCXX.h:3277
ArrayRef< TemplateArgumentLoc > template_arguments() const
Definition ExprCXX.h:3337
Expr * getPattern()
Retrieve the pattern of the pack expansion.
Definition ExprCXX.h:4392
const Expr * getPattern() const
Retrieve the pattern of the pack expansion.
Definition ExprCXX.h:4395
UnsignedOrNone getNumExpansions() const
Determine the number of expansions that will be produced when this pack expansion is instantiated,...
Definition ExprCXX.h:4403
child_range children()
Definition ExprCXX.h:4421
SourceLocation getBeginLoc() const LLVM_READONLY
Definition ExprCXX.h:4410
SourceLocation getEndLoc() const LLVM_READONLY
Definition ExprCXX.h:4414
friend class ASTStmtWriter
Definition ExprCXX.h:4365
PackExpansionExpr(Expr *Pattern, SourceLocation EllipsisLoc, UnsignedOrNone NumExpansions)
Definition ExprCXX.h:4379
const_child_range children() const
Definition ExprCXX.h:4425
friend class ASTStmtReader
Definition ExprCXX.h:4364
SourceLocation getEllipsisLoc() const
Retrieve the location of the ellipsis that describes this pack expansion.
Definition ExprCXX.h:4399
PackExpansionExpr(EmptyShell Empty)
Definition ExprCXX.h:4389
static bool classof(const Stmt *T)
Definition ExprCXX.h:4416
NamedDecl * getPackDecl() const
Definition ExprCXX.cpp:1750
static PackIndexingExpr * CreateDeserialized(ASTContext &Context, unsigned NumTransformedExprs)
Definition ExprCXX.cpp:1761
SourceLocation getEllipsisLoc() const
Determine the location of the 'sizeof' keyword.
Definition ExprCXX.h:4613
Expr * getIndexExpr() const
Definition ExprCXX.h:4628
child_range children()
Definition ExprCXX.h:4655
ArrayRef< Expr * > getExpressions() const
Return the trailing expressions, regardless of the expansion.
Definition ExprCXX.h:4646
SourceLocation getEndLoc() const LLVM_READONLY
Definition ExprCXX.h:4622
SourceLocation getPackLoc() const
Determine the location of the parameter pack.
Definition ExprCXX.h:4616
SourceLocation getRSquareLoc() const
Determine the location of the right parenthesis.
Definition ExprCXX.h:4619
bool expandsToEmptyPack() const
Determine if the expression was expanded to empty.
Definition ExprCXX.h:4607
Expr * getPackIdExpression() const
Definition ExprCXX.h:4624
friend class ASTStmtWriter
Definition ExprCXX.h:4557
Expr * getSelectedExpr() const
Definition ExprCXX.h:4639
static bool classof(const Stmt *T)
Definition ExprCXX.h:4650
bool isFullySubstituted() const
Definition ExprCXX.h:4602
UnsignedOrNone getSelectedIndex() const
Definition ExprCXX.h:4630
friend class ASTStmtReader
Definition ExprCXX.h:4556
const_child_range children() const
Definition ExprCXX.h:4657
SourceLocation getBeginLoc() const LLVM_READONLY
Definition ExprCXX.h:4621
Represents a parameter to a function.
Definition Decl.h:1790
PointerType - C99 6.7.5.1 - Pointer Declarators.
Definition TypeBase.h:3328
Stores the type being destroyed by a pseudo-destructor expression.
Definition ExprCXX.h:2694
PseudoDestructorTypeStorage(const IdentifierInfo *II, SourceLocation Loc)
Definition ExprCXX.h:2705
const IdentifierInfo * getIdentifier() const
Definition ExprCXX.h:2714
SourceLocation getLocation() const
Definition ExprCXX.h:2718
TypeSourceInfo * getTypeSourceInfo() const
Definition ExprCXX.h:2710
A (possibly-)qualified type.
Definition TypeBase.h:937
Represents an expression that computes the length of a parameter pack.
Definition ExprCXX.h:4441
SourceLocation getPackLoc() const
Determine the location of the parameter pack.
Definition ExprCXX.h:4503
child_range children()
Definition ExprCXX.h:4544
static bool classof(const Stmt *T)
Definition ExprCXX.h:4539
SourceLocation getEndLoc() const LLVM_READONLY
Definition ExprCXX.h:4537
static SizeOfPackExpr * CreateDeserialized(ASTContext &Context, unsigned NumPartialArgs)
Definition ExprCXX.cpp:1721
bool isPartiallySubstituted() const
Determine whether this represents a partially-substituted sizeof... expression, such as is produced f...
Definition ExprCXX.h:4526
const_child_range children() const
Definition ExprCXX.h:4548
SourceLocation getBeginLoc() const LLVM_READONLY
Definition ExprCXX.h:4536
ArrayRef< TemplateArgument > getPartialArguments() const
Get.
Definition ExprCXX.h:4531
SourceLocation getOperatorLoc() const
Determine the location of the 'sizeof' keyword.
Definition ExprCXX.h:4500
friend class ASTStmtWriter
Definition ExprCXX.h:4443
SourceLocation getRParenLoc() const
Determine the location of the right parenthesis.
Definition ExprCXX.h:4506
NamedDecl * getPack() const
Retrieve the parameter pack.
Definition ExprCXX.h:4509
friend class ASTStmtReader
Definition ExprCXX.h:4442
unsigned getPackLength() const
Retrieve the length of the parameter pack.
Definition ExprCXX.h:4515
Encodes a location in the source.
bool isValid() const
Return true if this is a valid SourceLocation object.
A trivial tuple used to represent a source range.
Stmt - This represents one statement.
Definition Stmt.h:85
ExpressionTraitExprBitfields ExpressionTraitExprBits
Definition Stmt.h:1375
SourceLocation getEndLoc() const LLVM_READONLY
Definition Stmt.cpp:362
CXXUnresolvedConstructExprBitfields CXXUnresolvedConstructExprBits
Definition Stmt.h:1365
LambdaExprBitfields LambdaExprBits
Definition Stmt.h:1372
UnresolvedLookupExprBitfields UnresolvedLookupExprBits
Definition Stmt.h:1368
SubstNonTypeTemplateParmExprBitfields SubstNonTypeTemplateParmExprBits
Definition Stmt.h:1371
CXXNoexceptExprBitfields CXXNoexceptExprBits
Definition Stmt.h:1370
StmtIterator child_iterator
Child Iterators: All subclasses must implement 'children' to permit easy iteration over the substatem...
Definition Stmt.h:1558
CXXRewrittenBinaryOperatorBitfields CXXRewrittenBinaryOperatorBits
Definition Stmt.h:1351
ExprWithCleanupsBitfields ExprWithCleanupsBits
Definition Stmt.h:1364
StmtClass getStmtClass() const
Definition Stmt.h:1472
CXXScalarValueInitExprBitfields CXXScalarValueInitExprBits
Definition Stmt.h:1358
OverloadExprBitfields OverloadExprBits
Definition Stmt.h:1367
CXXConstructExprBitfields CXXConstructExprBits
Definition Stmt.h:1363
CXXDependentScopeMemberExprBitfields CXXDependentScopeMemberExprBits
Definition Stmt.h:1366
ConstCastIterator< Expr > ConstExprIterator
Definition Stmt.h:1446
TypeTraitExprBitfields TypeTraitExprBits
Definition Stmt.h:1361
CXXNewExprBitfields CXXNewExprBits
Definition Stmt.h:1359
CXXNullPtrLiteralExprBitfields CXXNullPtrLiteralExprBits
Definition Stmt.h:1353
CoawaitExprBitfields CoawaitBits
Definition Stmt.h:1380
llvm::iterator_range< child_iterator > child_range
Definition Stmt.h:1561
CXXFoldExprBitfields CXXFoldExprBits
Definition Stmt.h:1376
CXXThrowExprBitfields CXXThrowExprBits
Definition Stmt.h:1355
PackIndexingExprBitfields PackIndexingExprBits
Definition Stmt.h:1377
ConstStmtIterator const_child_iterator
Definition Stmt.h:1559
CXXBoolLiteralExprBitfields CXXBoolLiteralExprBits
Definition Stmt.h:1352
CXXOperatorCallExprBitfields CXXOperatorCallExprBits
Definition Stmt.h:1350
CXXDefaultInitExprBitfields CXXDefaultInitExprBits
Definition Stmt.h:1357
DependentScopeDeclRefExprBitfields DependentScopeDeclRefExprBits
Definition Stmt.h:1362
ArrayTypeTraitExprBitfields ArrayTypeTraitExprBits
Definition Stmt.h:1374
SourceLocation getBeginLoc() const LLVM_READONLY
Definition Stmt.cpp:350
UnresolvedMemberExprBitfields UnresolvedMemberExprBits
Definition Stmt.h:1369
llvm::iterator_range< const_child_iterator > const_child_range
Definition Stmt.h:1562
CXXDeleteExprBitfields CXXDeleteExprBits
Definition Stmt.h:1360
CXXDefaultArgExprBitfields CXXDefaultArgExprBits
Definition Stmt.h:1356
CXXThisExprBitfields CXXThisExprBits
Definition Stmt.h:1354
CastIterator< Expr > ExprIterator
Definition Stmt.h:1445
Decl * getAssociatedDecl() const
A template-like entity which owns the whole pattern being substituted.
Definition ExprCXX.h:4709
UnsignedOrNone getPackIndex() const
Definition ExprCXX.h:4715
SourceLocation getEndLoc() const
Definition ExprCXX.h:4703
QualType getParameterType(const ASTContext &Ctx) const
Determine the substituted type of the template parameter.
Definition ExprCXX.cpp:1768
const_child_range children() const
Definition ExprCXX.h:4737
unsigned getIndex() const
Returns the index of the replaced parameter in the associated declaration.
Definition ExprCXX.h:4713
SubstNonTypeTemplateParmExpr(QualType Ty, ExprValueKind ValueKind, SourceLocation Loc, Expr *Replacement, Decl *AssociatedDecl, unsigned Index, UnsignedOrNone PackIndex, bool RefParam, bool Final)
Definition ExprCXX.h:4685
SourceLocation getNameLoc() const
Definition ExprCXX.h:4699
NonTypeTemplateParmDecl * getParameter() const
Definition ExprCXX.cpp:1728
SourceLocation getBeginLoc() const
Definition ExprCXX.h:4702
static bool classof(const Stmt *s)
Definition ExprCXX.h:4730
Represents a reference to a non-type template parameter pack that has been substituted with a non-tem...
Definition ExprCXX.h:4754
SourceLocation getBeginLoc() const LLVM_READONLY
Definition ExprCXX.h:4808
TemplateArgument getArgumentPack() const
Retrieve the template argument pack containing the substituted template arguments.
Definition ExprCXX.cpp:1799
SourceLocation getParameterPackLocation() const
Retrieve the location of the parameter pack name.
Definition ExprCXX.h:4802
const_child_range children() const
Definition ExprCXX.h:4820
NonTypeTemplateParmDecl * getParameterPack() const
Retrieve the non-type template parameter pack being substituted.
Definition ExprCXX.cpp:1794
Decl * getAssociatedDecl() const
A template-like entity which owns the whole pattern being substituted.
Definition ExprCXX.h:4788
static bool classof(const Stmt *T)
Definition ExprCXX.h:4811
unsigned getIndex() const
Returns the index of the replaced parameter in the associated declaration.
Definition ExprCXX.h:4792
SourceLocation getEndLoc() const LLVM_READONLY
Definition ExprCXX.h:4809
A convenient class for passing around template argument information.
Location wrapper for a TemplateArgument.
Represents a template argument.
The base class of all kinds of template declarations (e.g., class, function, etc.).
Stores a list of template parameters for a TemplateDecl and its derived classes.
TemplateTemplateParmDecl - Declares a template template parameter, e.g., "T" in.
A container of type source information.
Definition TypeBase.h:8249
QualType getType() const
Return the type wrapped by this type source info.
Definition TypeBase.h:8260
bool getBoolValue() const
Definition ExprCXX.h:2947
ArrayRef< TypeSourceInfo * > getArgs() const
Retrieve the argument types.
Definition ExprCXX.h:2967
child_range children()
Definition ExprCXX.h:2979
SourceLocation getEndLoc() const LLVM_READONLY
Definition ExprCXX.h:2972
TypeSourceInfo * getArg(unsigned I) const
Retrieve the Ith argument.
Definition ExprCXX.h:2961
const_child_range children() const
Definition ExprCXX.h:2983
unsigned getNumArgs() const
Determine the number of arguments to this type trait.
Definition ExprCXX.h:2958
static TypeTraitExpr * CreateDeserialized(const ASTContext &C, bool IsStoredAsBool, unsigned NumArgs)
Definition ExprCXX.cpp:1934
TypeTrait getTrait() const
Determine which type trait this expression uses.
Definition ExprCXX.h:2939
friend class ASTStmtWriter
Definition ExprCXX.h:2919
SourceLocation getBeginLoc() const LLVM_READONLY
Definition ExprCXX.h:2971
const APValue & getAPValue() const
Definition ExprCXX.h:2952
friend class ASTStmtReader
Definition ExprCXX.h:2918
static bool classof(const Stmt *T)
Definition ExprCXX.h:2974
bool isStoredAsBoolean() const
Definition ExprCXX.h:2943
The base class of the type hierarchy.
Definition TypeBase.h:1833
const T * castAs() const
Member-template castAs<specific type>.
Definition TypeBase.h:9158
bool isSpecificBuiltinType(unsigned K) const
Test for a particular builtin type.
Definition TypeBase.h:8840
bool isDependentType() const
Whether this type is a dependent type, meaning that its definition somehow depends on a template para...
Definition TypeBase.h:2782
A reference to a name which we were able to look up during parsing but could not resolve to a specifi...
Definition ExprCXX.h:3390
SourceLocation getBeginLoc() const LLVM_READONLY
Definition ExprCXX.h:3467
const CXXRecordDecl * getNamingClass() const
Definition ExprCXX.h:3465
CXXRecordDecl * getNamingClass()
Gets the 'naming class' (in the sense of C++0x [class.access.base]p5) of the lookup.
Definition ExprCXX.h:3464
SourceLocation getEndLoc() const LLVM_READONLY
Definition ExprCXX.h:3473
static UnresolvedLookupExpr * CreateEmpty(const ASTContext &Context, unsigned NumResults, bool HasTemplateKWAndArgsInfo, unsigned NumTemplateArgs)
Definition ExprCXX.cpp:467
static bool classof(const Stmt *T)
Definition ExprCXX.h:3487
bool requiresADL() const
True if this declaration should be extended by argument-dependent lookup.
Definition ExprCXX.h:3459
const_child_range children() const
Definition ExprCXX.h:3483
SourceLocation getEndLoc() const LLVM_READONLY
Definition ExprCXX.h:4252
DeclarationName getMemberName() const
Retrieve the name of the member that this expression refers to.
Definition ExprCXX.h:4234
QualType getBaseType() const
Definition ExprCXX.h:4208
bool isArrow() const
Determine whether this member expression used the '->' operator; otherwise, it used the '.
Definition ExprCXX.h:4218
SourceLocation getOperatorLoc() const
Retrieve the location of the '->' or '.' operator.
Definition ExprCXX.h:4221
bool hasUnresolvedUsing() const
Determine whether the lookup results contain an unresolved using declaration.
Definition ExprCXX.h:4212
const Expr * getBase() const
Definition ExprCXX.h:4203
const CXXRecordDecl * getNamingClass() const
Definition ExprCXX.h:4225
SourceLocation getExprLoc() const LLVM_READONLY
Return the preferred location (the member name) for the arrow when diagnosing a problem with this exp...
Definition ExprCXX.h:4242
Expr * getBase()
Retrieve the base object of this member expressions, e.g., the x in x.m.
Definition ExprCXX.h:4199
static bool classof(const Stmt *T)
Definition ExprCXX.h:4258
CXXRecordDecl * getNamingClass()
Retrieve the naming class of this lookup.
Definition ExprCXX.cpp:1683
bool isImplicitAccess() const
True if this is an implicit access, i.e., one in which the member being accessed was not written in t...
Definition ExprCXX.cpp:1645
const DeclarationNameInfo & getMemberNameInfo() const
Retrieve the full name info for the member that this expression refers to.
Definition ExprCXX.h:4231
SourceLocation getBeginLoc() const LLVM_READONLY
Definition ExprCXX.h:4244
static UnresolvedMemberExpr * CreateEmpty(const ASTContext &Context, unsigned NumResults, bool HasTemplateKWAndArgsInfo, unsigned NumTemplateArgs)
Definition ExprCXX.cpp:1671
const_child_range children() const
Definition ExprCXX.h:4269
SourceLocation getMemberLoc() const
Retrieve the location of the name of the member that this expression refers to.
Definition ExprCXX.h:4238
UnresolvedSetIterator iterator
The iterator over UnresolvedSets.
LiteralOperatorKind getLiteralOperatorKind() const
Returns the kind of literal operator invocation which this expression represents.
Definition ExprCXX.cpp:999
const Expr * getCookedLiteral() const
Definition ExprCXX.h:696
const IdentifierInfo * getUDSuffix() const
Returns the ud-suffix specified for this literal.
Definition ExprCXX.cpp:1028
static UserDefinedLiteral * CreateEmpty(const ASTContext &Ctx, unsigned NumArgs, bool HasFPOptions, EmptyShell Empty)
Definition ExprCXX.cpp:984
SourceLocation getEndLoc() const
Definition ExprCXX.h:706
Expr * getCookedLiteral()
If this is not a raw user-defined literal, get the underlying cooked literal (representing the litera...
Definition ExprCXX.cpp:1020
SourceLocation getBeginLoc() const
Definition ExprCXX.h:700
friend class ASTStmtWriter
Definition ExprCXX.h:642
SourceLocation getUDSuffixLoc() const
Returns the location of a ud-suffix in the expression.
Definition ExprCXX.h:712
LiteralOperatorKind
The kind of literal operator which is invoked.
Definition ExprCXX.h:668
@ LOK_String
operator "" X (const CharT *, size_t)
Definition ExprCXX.h:682
@ LOK_Raw
Raw form: operator "" X (const char *)
Definition ExprCXX.h:670
@ LOK_Floating
operator "" X (long double)
Definition ExprCXX.h:679
@ LOK_Integer
operator "" X (unsigned long long)
Definition ExprCXX.h:676
@ LOK_Template
Raw form: operator "" X<cs...> ()
Definition ExprCXX.h:673
@ LOK_Character
operator "" X (CharT)
Definition ExprCXX.h:685
friend class ASTStmtReader
Definition ExprCXX.h:641
static bool classof(const Stmt *S)
Definition ExprCXX.h:717
Represent the declaration of a variable (in which case it is an lvalue) a function (in which case it ...
Definition Decl.h:712
Definition SPIR.cpp:47
const internal::VariadicAllOfMatcher< Decl > decl
Matches declarations.
const internal::VariadicDynCastAllOfMatcher< Stmt, CastExpr > castExpr
Matches any cast nodes of Clang's AST.
The JSON file list parser is used to communicate input to InstallAPI.
OverloadedOperatorKind
Enumeration specifying the different kinds of C++ overloaded operators.
bool isa(CodeGen::Address addr)
Definition Address.h:330
ArrayTypeTrait
Names for the array type traits.
Definition TypeTraits.h:42
@ ATT_Last
Definition TypeTraits.h:45
CanThrowResult
Possible results from evaluation of a noexcept expression.
AlignedAllocationMode alignedAllocationModeFromBool(bool IsAligned)
Definition ExprCXX.h:2269
CXXConstructionKind
Definition ExprCXX.h:1540
ExprObjectKind
A further classification of the kind of object referenced by an l-value or x-value.
Definition Specifiers.h:149
@ OK_Ordinary
An ordinary object is located at an address in memory.
Definition Specifiers.h:151
ExprDependence computeDependence(FullExpr *E)
@ Create
'create' clause, allowed on Compute and Combined constructs, plus 'data', 'enter data',...
nullptr
This class represents a compute construct, representing a 'Kind' of ‘parallel’, 'serial',...
bool isAlignedAllocation(AlignedAllocationMode Mode)
Definition ExprCXX.h:2265
AlignedAllocationMode
Definition ExprCXX.h:2263
StorageDuration
The storage duration for an object (per C++ [basic.stc]).
Definition Specifiers.h:339
@ SD_FullExpression
Full-expression storage duration (for temporaries).
Definition Specifiers.h:340
@ Result
The result type of a method or function.
Definition TypeBase.h:905
const FunctionProtoType * T
@ Keyword
The name has been typo-corrected to a keyword.
Definition Sema.h:560
bool isTypeAwareAllocation(TypeAwareAllocationMode Mode)
Definition ExprCXX.h:2253
CastKind
CastKind - The kind of operation required for a conversion.
SizedDeallocationMode sizedDeallocationModeFromBool(bool IsSized)
Definition ExprCXX.h:2279
@ TNK_Var_template
The name refers to a variable template whose specialization produces a variable.
@ TNK_Concept_template
The name refers to a concept.
LambdaCaptureDefault
The default, if any, capture method for a lambda expression.
Definition Lambda.h:22
SizedDeallocationMode
Definition ExprCXX.h:2273
ExprValueKind
The categorization of expression values, currently following the C++11 scheme.
Definition Specifiers.h:132
@ VK_PRValue
A pr-value expression (in the C++11 taxonomy) produces a temporary value.
Definition Specifiers.h:135
@ VK_LValue
An l-value expression is a reference to an object with independent storage.
Definition Specifiers.h:139
SmallVector< CXXBaseSpecifier *, 4 > CXXCastPath
A simple array of base specifiers.
Definition ASTContext.h:149
bool isSizedDeallocation(SizedDeallocationMode Mode)
Definition ExprCXX.h:2275
TypeAwareAllocationMode
Definition ExprCXX.h:2251
TypeAwareAllocationMode typeAwareAllocationModeFromBool(bool IsTypeAwareAllocation)
Definition ExprCXX.h:2258
U cast(CodeGen::Address addr)
Definition Address.h:327
@ None
The alignment was not explicit in code.
Definition ASTContext.h:178
@ Class
The "class" keyword introduces the elaborated-type-specifier.
Definition TypeBase.h:5864
TypeTrait
Names for traits that operate specifically on types.
Definition TypeTraits.h:21
CXXNewInitializationStyle
Definition ExprCXX.h:2240
@ Parens
New-expression has a C++98 paren-delimited initializer.
Definition ExprCXX.h:2245
@ Braces
New-expression has a C++11 list-initializer.
Definition ExprCXX.h:2248
#define false
Definition stdbool.h:26
Represents an explicit template argument list in C++, e.g., the "<int>" in "sort<int>".
SourceLocation LAngleLoc
The source location of the left angle bracket ('<').
void copyInto(const TemplateArgumentLoc *ArgArray, TemplateArgumentListInfo &List) const
unsigned NumTemplateArgs
The number of template arguments in TemplateArgs.
SourceLocation RAngleLoc
The source location of the right angle bracket ('>').
SourceLocation TemplateKWLoc
The source location of the template keyword; this is used as part of the representation of qualified ...
const Expr * RHS
The original right-hand side.
Definition ExprCXX.h:313
const Expr * InnerBinOp
The inner == or <=> operator expression.
Definition ExprCXX.h:315
BinaryOperatorKind Opcode
The original opcode, prior to rewriting.
Definition ExprCXX.h:309
const Expr * LHS
The original left-hand side.
Definition ExprCXX.h:311
DeclarationNameInfo - A collector data type for bundling together a DeclarationName and the correspon...
SourceLocation getBeginLoc() const
getBeginLoc - Retrieve the location of the first token.
SourceLocation getEndLoc() const LLVM_READONLY
ImplicitAllocationParameters(QualType AllocType, TypeAwareAllocationMode PassTypeIdentity, AlignedAllocationMode PassAlignment)
Definition ExprCXX.h:2284
AlignedAllocationMode PassAlignment
Definition ExprCXX.h:2307
ImplicitAllocationParameters(AlignedAllocationMode PassAlignment)
Definition ExprCXX.h:2292
TypeAwareAllocationMode PassTypeIdentity
Definition ExprCXX.h:2306
unsigned getNumImplicitArgs() const
Definition ExprCXX.h:2296
ImplicitDeallocationParameters(AlignedAllocationMode PassAlignment, SizedDeallocationMode PassSize)
Definition ExprCXX.h:2321
TypeAwareAllocationMode PassTypeIdentity
Definition ExprCXX.h:2338
SizedDeallocationMode PassSize
Definition ExprCXX.h:2340
ImplicitDeallocationParameters(QualType DeallocType, TypeAwareAllocationMode PassTypeIdentity, AlignedAllocationMode PassAlignment, SizedDeallocationMode PassSize)
Definition ExprCXX.h:2311
AlignedAllocationMode PassAlignment
Definition ExprCXX.h:2339
A placeholder type used to construct an empty shell of a type, that will be filled in later (e....
Definition Stmt.h:1412
static constexpr UnsignedOrNone fromInternalRepresentation(unsigned Rep)
The parameters to pass to a usual operator delete.
Definition ExprCXX.h:2344
TypeAwareAllocationMode TypeAwareDelete
Definition ExprCXX.h:2345
AlignedAllocationMode Alignment
Definition ExprCXX.h:2348