Thanks to visit codestin.com
Credit goes to clang.llvm.org

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 auto Children = const_cast<MSPropertyRefExpr *>(this)->children();
982 return const_child_range(Children.begin(), Children.end());
983 }
984
985 static bool classof(const Stmt *T) {
986 return T->getStmtClass() == MSPropertyRefExprClass;
987 }
988
989 Expr *getBaseExpr() const { return BaseExpr; }
990 MSPropertyDecl *getPropertyDecl() const { return TheDecl; }
991 bool isArrow() const { return IsArrow; }
992 SourceLocation getMemberLoc() const { return MemberLoc; }
993 NestedNameSpecifierLoc getQualifierLoc() const { return QualifierLoc; }
994};
995
996/// MS property subscript expression.
997/// MSVC supports 'property' attribute and allows to apply it to the
998/// declaration of an empty array in a class or structure definition.
999/// For example:
1000/// \code
1001/// __declspec(property(get=GetX, put=PutX)) int x[];
1002/// \endcode
1003/// The above statement indicates that x[] can be used with one or more array
1004/// indices. In this case, i=p->x[a][b] will be turned into i=p->GetX(a, b), and
1005/// p->x[a][b] = i will be turned into p->PutX(a, b, i).
1006/// This is a syntactic pseudo-object expression.
1008 friend class ASTStmtReader;
1009
1010 enum { BASE_EXPR, IDX_EXPR, NUM_SUBEXPRS = 2 };
1011
1012 Stmt *SubExprs[NUM_SUBEXPRS];
1013 SourceLocation RBracketLoc;
1014
1015 void setBase(Expr *Base) { SubExprs[BASE_EXPR] = Base; }
1016 void setIdx(Expr *Idx) { SubExprs[IDX_EXPR] = Idx; }
1017
1018public:
1020 ExprObjectKind OK, SourceLocation RBracketLoc)
1021 : Expr(MSPropertySubscriptExprClass, Ty, VK, OK),
1022 RBracketLoc(RBracketLoc) {
1023 SubExprs[BASE_EXPR] = Base;
1024 SubExprs[IDX_EXPR] = Idx;
1026 }
1027
1028 /// Create an empty array subscript expression.
1030 : Expr(MSPropertySubscriptExprClass, Shell) {}
1031
1032 Expr *getBase() { return cast<Expr>(SubExprs[BASE_EXPR]); }
1033 const Expr *getBase() const { return cast<Expr>(SubExprs[BASE_EXPR]); }
1034
1035 Expr *getIdx() { return cast<Expr>(SubExprs[IDX_EXPR]); }
1036 const Expr *getIdx() const { return cast<Expr>(SubExprs[IDX_EXPR]); }
1037
1038 SourceLocation getBeginLoc() const LLVM_READONLY {
1039 return getBase()->getBeginLoc();
1040 }
1041
1042 SourceLocation getEndLoc() const LLVM_READONLY { return RBracketLoc; }
1043
1044 SourceLocation getRBracketLoc() const { return RBracketLoc; }
1045 void setRBracketLoc(SourceLocation L) { RBracketLoc = L; }
1046
1047 SourceLocation getExprLoc() const LLVM_READONLY {
1048 return getBase()->getExprLoc();
1049 }
1050
1051 static bool classof(const Stmt *T) {
1052 return T->getStmtClass() == MSPropertySubscriptExprClass;
1053 }
1054
1055 // Iterators
1057 return child_range(&SubExprs[0], &SubExprs[0] + NUM_SUBEXPRS);
1058 }
1059
1061 return const_child_range(&SubExprs[0], &SubExprs[0] + NUM_SUBEXPRS);
1062 }
1063};
1064
1065/// A Microsoft C++ @c __uuidof expression, which gets
1066/// the _GUID that corresponds to the supplied type or expression.
1067///
1068/// This represents code like @c __uuidof(COMTYPE) or @c __uuidof(*comPtr)
1069class CXXUuidofExpr : public Expr {
1070 friend class ASTStmtReader;
1071
1072private:
1073 llvm::PointerUnion<Stmt *, TypeSourceInfo *> Operand;
1074 MSGuidDecl *Guid;
1075 SourceRange Range;
1076
1077public:
1079 SourceRange R)
1080 : Expr(CXXUuidofExprClass, Ty, VK_LValue, OK_Ordinary), Operand(Operand),
1081 Guid(Guid), Range(R) {
1083 }
1084
1086 : Expr(CXXUuidofExprClass, Ty, VK_LValue, OK_Ordinary), Operand(Operand),
1087 Guid(Guid), Range(R) {
1089 }
1090
1092 : Expr(CXXUuidofExprClass, Empty) {
1093 if (isExpr)
1094 Operand = (Expr*)nullptr;
1095 else
1096 Operand = (TypeSourceInfo*)nullptr;
1097 }
1098
1099 bool isTypeOperand() const { return isa<TypeSourceInfo *>(Operand); }
1100
1101 /// Retrieves the type operand of this __uuidof() expression after
1102 /// various required adjustments (removing reference types, cv-qualifiers).
1103 QualType getTypeOperand(ASTContext &Context) const;
1104
1105 /// Retrieve source information for the type operand.
1107 assert(isTypeOperand() && "Cannot call getTypeOperand for __uuidof(expr)");
1108 return cast<TypeSourceInfo *>(Operand);
1109 }
1111 assert(!isTypeOperand() && "Cannot call getExprOperand for __uuidof(type)");
1112 return static_cast<Expr *>(cast<Stmt *>(Operand));
1113 }
1114
1115 MSGuidDecl *getGuidDecl() const { return Guid; }
1116
1117 SourceLocation getBeginLoc() const LLVM_READONLY { return Range.getBegin(); }
1118 SourceLocation getEndLoc() const LLVM_READONLY { return Range.getEnd(); }
1119 SourceRange getSourceRange() const LLVM_READONLY { return Range; }
1120 void setSourceRange(SourceRange R) { Range = R; }
1121
1122 static bool classof(const Stmt *T) {
1123 return T->getStmtClass() == CXXUuidofExprClass;
1124 }
1125
1126 // Iterators
1128 if (isTypeOperand())
1130 auto **begin = reinterpret_cast<Stmt **>(&Operand);
1131 return child_range(begin, begin + 1);
1132 }
1133
1135 if (isTypeOperand())
1137 auto **begin =
1138 reinterpret_cast<Stmt **>(&const_cast<CXXUuidofExpr *>(this)->Operand);
1139 return const_child_range(begin, begin + 1);
1140 }
1141};
1142
1143/// Represents the \c this expression in C++.
1144///
1145/// This is a pointer to the object on which the current member function is
1146/// executing (C++ [expr.prim]p3). Example:
1147///
1148/// \code
1149/// class Foo {
1150/// public:
1151/// void bar();
1152/// void test() { this->bar(); }
1153/// };
1154/// \endcode
1155class CXXThisExpr : public Expr {
1156 CXXThisExpr(SourceLocation L, QualType Ty, bool IsImplicit, ExprValueKind VK)
1157 : Expr(CXXThisExprClass, Ty, VK, OK_Ordinary) {
1158 CXXThisExprBits.IsImplicit = IsImplicit;
1159 CXXThisExprBits.CapturedByCopyInLambdaWithExplicitObjectParameter = false;
1160 CXXThisExprBits.Loc = L;
1162 }
1163
1164 CXXThisExpr(EmptyShell Empty) : Expr(CXXThisExprClass, Empty) {}
1165
1166public:
1167 static CXXThisExpr *Create(const ASTContext &Ctx, SourceLocation L,
1168 QualType Ty, bool IsImplicit);
1169
1170 static CXXThisExpr *CreateEmpty(const ASTContext &Ctx);
1171
1174
1177
1178 bool isImplicit() const { return CXXThisExprBits.IsImplicit; }
1179 void setImplicit(bool I) { CXXThisExprBits.IsImplicit = I; }
1180
1182 return CXXThisExprBits.CapturedByCopyInLambdaWithExplicitObjectParameter;
1183 }
1184
1186 CXXThisExprBits.CapturedByCopyInLambdaWithExplicitObjectParameter = Set;
1188 }
1189
1190 static bool classof(const Stmt *T) {
1191 return T->getStmtClass() == CXXThisExprClass;
1192 }
1193
1194 // Iterators
1198
1202};
1203
1204/// A C++ throw-expression (C++ [except.throw]).
1205///
1206/// This handles 'throw' (for re-throwing the current exception) and
1207/// 'throw' assignment-expression. When assignment-expression isn't
1208/// present, Op will be null.
1209class CXXThrowExpr : public Expr {
1210 friend class ASTStmtReader;
1211
1212 /// The optional expression in the throw statement.
1213 Stmt *Operand;
1214
1215public:
1216 // \p Ty is the void type which is used as the result type of the
1217 // expression. The \p Loc is the location of the throw keyword.
1218 // \p Operand is the expression in the throw statement, and can be
1219 // null if not present.
1221 bool IsThrownVariableInScope)
1222 : Expr(CXXThrowExprClass, Ty, VK_PRValue, OK_Ordinary), Operand(Operand) {
1223 CXXThrowExprBits.ThrowLoc = Loc;
1224 CXXThrowExprBits.IsThrownVariableInScope = IsThrownVariableInScope;
1226 }
1227 CXXThrowExpr(EmptyShell Empty) : Expr(CXXThrowExprClass, Empty) {}
1228
1229 const Expr *getSubExpr() const { return cast_or_null<Expr>(Operand); }
1230 Expr *getSubExpr() { return cast_or_null<Expr>(Operand); }
1231
1232 SourceLocation getThrowLoc() const { return CXXThrowExprBits.ThrowLoc; }
1233
1234 /// Determines whether the variable thrown by this expression (if any!)
1235 /// is within the innermost try block.
1236 ///
1237 /// This information is required to determine whether the NRVO can apply to
1238 /// this variable.
1240 return CXXThrowExprBits.IsThrownVariableInScope;
1241 }
1242
1244 SourceLocation getEndLoc() const LLVM_READONLY {
1245 if (!getSubExpr())
1246 return getThrowLoc();
1247 return getSubExpr()->getEndLoc();
1248 }
1249
1250 static bool classof(const Stmt *T) {
1251 return T->getStmtClass() == CXXThrowExprClass;
1252 }
1253
1254 // Iterators
1256 return child_range(&Operand, Operand ? &Operand + 1 : &Operand);
1257 }
1258
1260 return const_child_range(&Operand, Operand ? &Operand + 1 : &Operand);
1261 }
1262};
1263
1264/// A default argument (C++ [dcl.fct.default]).
1265///
1266/// This wraps up a function call argument that was created from the
1267/// corresponding parameter's default argument, when the call did not
1268/// explicitly supply arguments for all of the parameters.
1269class CXXDefaultArgExpr final
1270 : public Expr,
1271 private llvm::TrailingObjects<CXXDefaultArgExpr, Expr *> {
1272 friend class ASTStmtReader;
1273 friend class ASTReader;
1274 friend TrailingObjects;
1275
1276 /// The parameter whose default is being used.
1277 ParmVarDecl *Param;
1278
1279 /// The context where the default argument expression was used.
1280 DeclContext *UsedContext;
1281
1282 CXXDefaultArgExpr(StmtClass SC, SourceLocation Loc, ParmVarDecl *Param,
1283 Expr *RewrittenExpr, DeclContext *UsedContext)
1284 : Expr(SC,
1285 Param->hasUnparsedDefaultArg()
1286 ? Param->getType().getNonReferenceType()
1287 : Param->getDefaultArg()->getType(),
1288 Param->getDefaultArg()->getValueKind(),
1289 Param->getDefaultArg()->getObjectKind()),
1290 Param(Param), UsedContext(UsedContext) {
1291 CXXDefaultArgExprBits.Loc = Loc;
1292 CXXDefaultArgExprBits.HasRewrittenInit = RewrittenExpr != nullptr;
1293 if (RewrittenExpr)
1294 *getTrailingObjects() = RewrittenExpr;
1296 }
1297
1298 CXXDefaultArgExpr(EmptyShell Empty, bool HasRewrittenInit)
1299 : Expr(CXXDefaultArgExprClass, Empty) {
1300 CXXDefaultArgExprBits.HasRewrittenInit = HasRewrittenInit;
1301 }
1302
1303public:
1304 static CXXDefaultArgExpr *CreateEmpty(const ASTContext &C,
1305 bool HasRewrittenInit);
1306
1307 // \p Param is the parameter whose default argument is used by this
1308 // expression.
1309 static CXXDefaultArgExpr *Create(const ASTContext &C, SourceLocation Loc,
1310 ParmVarDecl *Param, Expr *RewrittenExpr,
1311 DeclContext *UsedContext);
1312 // Retrieve the parameter that the argument was created from.
1313 const ParmVarDecl *getParam() const { return Param; }
1314 ParmVarDecl *getParam() { return Param; }
1315
1316 bool hasRewrittenInit() const {
1317 return CXXDefaultArgExprBits.HasRewrittenInit;
1318 }
1319
1320 // Retrieve the argument to the function call.
1321 Expr *getExpr();
1322 const Expr *getExpr() const {
1323 return const_cast<CXXDefaultArgExpr *>(this)->getExpr();
1324 }
1325
1327 return hasRewrittenInit() ? *getTrailingObjects() : nullptr;
1328 }
1329
1330 const Expr *getRewrittenExpr() const {
1331 return const_cast<CXXDefaultArgExpr *>(this)->getRewrittenExpr();
1332 }
1333
1334 // Retrieve the rewritten init expression (for an init expression containing
1335 // immediate calls) with the top level FullExpr and ConstantExpr stripped off.
1338 return const_cast<CXXDefaultArgExpr *>(this)->getAdjustedRewrittenExpr();
1339 }
1340
1341 const DeclContext *getUsedContext() const { return UsedContext; }
1342 DeclContext *getUsedContext() { return UsedContext; }
1343
1344 /// Retrieve the location where this default argument was actually used.
1346
1347 /// Default argument expressions have no representation in the
1348 /// source, so they have an empty source range.
1351
1353
1354 static bool classof(const Stmt *T) {
1355 return T->getStmtClass() == CXXDefaultArgExprClass;
1356 }
1357
1358 // Iterators
1362
1366};
1367
1368/// A use of a default initializer in a constructor or in aggregate
1369/// initialization.
1370///
1371/// This wraps a use of a C++ default initializer (technically,
1372/// a brace-or-equal-initializer for a non-static data member) when it
1373/// is implicitly used in a mem-initializer-list in a constructor
1374/// (C++11 [class.base.init]p8) or in aggregate initialization
1375/// (C++1y [dcl.init.aggr]p7).
1376class CXXDefaultInitExpr final
1377 : public Expr,
1378 private llvm::TrailingObjects<CXXDefaultInitExpr, Expr *> {
1379
1380 friend class ASTStmtReader;
1381 friend class ASTReader;
1382 friend TrailingObjects;
1383 /// The field whose default is being used.
1384 FieldDecl *Field;
1385
1386 /// The context where the default initializer expression was used.
1387 DeclContext *UsedContext;
1388
1389 CXXDefaultInitExpr(const ASTContext &Ctx, SourceLocation Loc,
1390 FieldDecl *Field, QualType Ty, DeclContext *UsedContext,
1391 Expr *RewrittenInitExpr);
1392
1393 CXXDefaultInitExpr(EmptyShell Empty, bool HasRewrittenInit)
1394 : Expr(CXXDefaultInitExprClass, Empty) {
1395 CXXDefaultInitExprBits.HasRewrittenInit = HasRewrittenInit;
1396 }
1397
1398public:
1400 bool HasRewrittenInit);
1401 /// \p Field is the non-static data member whose default initializer is used
1402 /// by this expression.
1403 static CXXDefaultInitExpr *Create(const ASTContext &Ctx, SourceLocation Loc,
1404 FieldDecl *Field, DeclContext *UsedContext,
1405 Expr *RewrittenInitExpr);
1406
1407 bool hasRewrittenInit() const {
1408 return CXXDefaultInitExprBits.HasRewrittenInit;
1409 }
1410
1411 /// Get the field whose initializer will be used.
1412 FieldDecl *getField() { return Field; }
1413 const FieldDecl *getField() const { return Field; }
1414
1415 /// Get the initialization expression that will be used.
1416 Expr *getExpr();
1417 const Expr *getExpr() const {
1418 return const_cast<CXXDefaultInitExpr *>(this)->getExpr();
1419 }
1420
1421 /// Retrieve the initializing expression with evaluated immediate calls, if
1422 /// any.
1423 const Expr *getRewrittenExpr() const {
1424 assert(hasRewrittenInit() && "expected a rewritten init expression");
1425 return *getTrailingObjects();
1426 }
1427
1428 /// Retrieve the initializing expression with evaluated immediate calls, if
1429 /// any.
1431 assert(hasRewrittenInit() && "expected a rewritten init expression");
1432 return *getTrailingObjects();
1433 }
1434
1435 const DeclContext *getUsedContext() const { return UsedContext; }
1436 DeclContext *getUsedContext() { return UsedContext; }
1437
1438 /// Retrieve the location where this default initializer expression was
1439 /// actually used.
1441
1444
1445 static bool classof(const Stmt *T) {
1446 return T->getStmtClass() == CXXDefaultInitExprClass;
1447 }
1448
1449 // Iterators
1453
1457};
1458
1459/// Represents a C++ temporary.
1460class CXXTemporary {
1461 /// The destructor that needs to be called.
1462 const CXXDestructorDecl *Destructor;
1463
1464 explicit CXXTemporary(const CXXDestructorDecl *destructor)
1465 : Destructor(destructor) {}
1466
1467public:
1468 static CXXTemporary *Create(const ASTContext &C,
1469 const CXXDestructorDecl *Destructor);
1470
1471 const CXXDestructorDecl *getDestructor() const { return Destructor; }
1472
1474 Destructor = Dtor;
1475 }
1476};
1477
1478/// Represents binding an expression to a temporary.
1479///
1480/// This ensures the destructor is called for the temporary. It should only be
1481/// needed for non-POD, non-trivially destructable class types. For example:
1482///
1483/// \code
1484/// struct S {
1485/// S() { } // User defined constructor makes S non-POD.
1486/// ~S() { } // User defined destructor makes it non-trivial.
1487/// };
1488/// void test() {
1489/// const S &s_ref = S(); // Requires a CXXBindTemporaryExpr.
1490/// }
1491/// \endcode
1492///
1493/// Destructor might be null if destructor declaration is not valid.
1494class CXXBindTemporaryExpr : public Expr {
1495 CXXTemporary *Temp = nullptr;
1496 Stmt *SubExpr = nullptr;
1497
1498 CXXBindTemporaryExpr(CXXTemporary *temp, Expr *SubExpr)
1499 : Expr(CXXBindTemporaryExprClass, SubExpr->getType(), VK_PRValue,
1500 OK_Ordinary),
1501 Temp(temp), SubExpr(SubExpr) {
1503 }
1504
1505public:
1507 : Expr(CXXBindTemporaryExprClass, Empty) {}
1508
1509 static CXXBindTemporaryExpr *Create(const ASTContext &C, CXXTemporary *Temp,
1510 Expr* SubExpr);
1511
1512 CXXTemporary *getTemporary() { return Temp; }
1513 const CXXTemporary *getTemporary() const { return Temp; }
1514 void setTemporary(CXXTemporary *T) { Temp = T; }
1515
1516 const Expr *getSubExpr() const { return cast<Expr>(SubExpr); }
1517 Expr *getSubExpr() { return cast<Expr>(SubExpr); }
1518 void setSubExpr(Expr *E) { SubExpr = E; }
1519
1520 SourceLocation getBeginLoc() const LLVM_READONLY {
1521 return SubExpr->getBeginLoc();
1522 }
1523
1524 SourceLocation getEndLoc() const LLVM_READONLY {
1525 return SubExpr->getEndLoc();
1526 }
1527
1528 // Implement isa/cast/dyncast/etc.
1529 static bool classof(const Stmt *T) {
1530 return T->getStmtClass() == CXXBindTemporaryExprClass;
1531 }
1532
1533 // Iterators
1534 child_range children() { return child_range(&SubExpr, &SubExpr + 1); }
1535
1537 return const_child_range(&SubExpr, &SubExpr + 1);
1538 }
1539};
1540
1547
1548/// Represents a call to a C++ constructor.
1549class CXXConstructExpr : public Expr {
1550 friend class ASTStmtReader;
1551
1552 /// A pointer to the constructor which will be ultimately called.
1553 CXXConstructorDecl *Constructor;
1554
1555 SourceRange ParenOrBraceRange;
1556
1557 /// The number of arguments.
1558 unsigned NumArgs;
1559
1560 // We would like to stash the arguments of the constructor call after
1561 // CXXConstructExpr. However CXXConstructExpr is used as a base class of
1562 // CXXTemporaryObjectExpr which makes the use of llvm::TrailingObjects
1563 // impossible.
1564 //
1565 // Instead we manually stash the trailing object after the full object
1566 // containing CXXConstructExpr (that is either CXXConstructExpr or
1567 // CXXTemporaryObjectExpr).
1568 //
1569 // The trailing objects are:
1570 //
1571 // * An array of getNumArgs() "Stmt *" for the arguments of the
1572 // constructor call.
1573
1574 /// Return a pointer to the start of the trailing arguments.
1575 /// Defined just after CXXTemporaryObjectExpr.
1576 inline Stmt **getTrailingArgs();
1577 const Stmt *const *getTrailingArgs() const {
1578 return const_cast<CXXConstructExpr *>(this)->getTrailingArgs();
1579 }
1580
1581protected:
1582 /// Build a C++ construction expression.
1584 CXXConstructorDecl *Ctor, bool Elidable,
1585 ArrayRef<Expr *> Args, bool HadMultipleCandidates,
1586 bool ListInitialization, bool StdInitListInitialization,
1587 bool ZeroInitialization, CXXConstructionKind ConstructKind,
1588 SourceRange ParenOrBraceRange);
1589
1590 /// Build an empty C++ construction expression.
1591 CXXConstructExpr(StmtClass SC, EmptyShell Empty, unsigned NumArgs);
1592
1593 /// Return the size in bytes of the trailing objects. Used by
1594 /// CXXTemporaryObjectExpr to allocate the right amount of storage.
1595 static unsigned sizeOfTrailingObjects(unsigned NumArgs) {
1596 return NumArgs * sizeof(Stmt *);
1597 }
1598
1599public:
1600 /// Create a C++ construction expression.
1601 static CXXConstructExpr *
1602 Create(const ASTContext &Ctx, QualType Ty, SourceLocation Loc,
1603 CXXConstructorDecl *Ctor, bool Elidable, ArrayRef<Expr *> Args,
1604 bool HadMultipleCandidates, bool ListInitialization,
1605 bool StdInitListInitialization, bool ZeroInitialization,
1606 CXXConstructionKind ConstructKind, SourceRange ParenOrBraceRange);
1607
1608 /// Create an empty C++ construction expression.
1609 static CXXConstructExpr *CreateEmpty(const ASTContext &Ctx, unsigned NumArgs);
1610
1611 /// Get the constructor that this expression will (ultimately) call.
1612 CXXConstructorDecl *getConstructor() const { return Constructor; }
1613
1616
1617 /// Whether this construction is elidable.
1618 bool isElidable() const { return CXXConstructExprBits.Elidable; }
1619 void setElidable(bool E) { CXXConstructExprBits.Elidable = E; }
1620
1621 /// Whether the referred constructor was resolved from
1622 /// an overloaded set having size greater than 1.
1624 return CXXConstructExprBits.HadMultipleCandidates;
1625 }
1627 CXXConstructExprBits.HadMultipleCandidates = V;
1628 }
1629
1630 /// Whether this constructor call was written as list-initialization.
1632 return CXXConstructExprBits.ListInitialization;
1633 }
1635 CXXConstructExprBits.ListInitialization = V;
1636 }
1637
1638 /// Whether this constructor call was written as list-initialization,
1639 /// but was interpreted as forming a std::initializer_list<T> from the list
1640 /// and passing that as a single constructor argument.
1641 /// See C++11 [over.match.list]p1 bullet 1.
1643 return CXXConstructExprBits.StdInitListInitialization;
1644 }
1646 CXXConstructExprBits.StdInitListInitialization = V;
1647 }
1648
1649 /// Whether this construction first requires
1650 /// zero-initialization before the initializer is called.
1652 return CXXConstructExprBits.ZeroInitialization;
1653 }
1654 void setRequiresZeroInitialization(bool ZeroInit) {
1655 CXXConstructExprBits.ZeroInitialization = ZeroInit;
1656 }
1657
1658 /// Determine whether this constructor is actually constructing
1659 /// a base class (rather than a complete object).
1661 return static_cast<CXXConstructionKind>(
1662 CXXConstructExprBits.ConstructionKind);
1663 }
1665 CXXConstructExprBits.ConstructionKind = llvm::to_underlying(CK);
1666 }
1667
1670 using arg_range = llvm::iterator_range<arg_iterator>;
1671 using const_arg_range = llvm::iterator_range<const_arg_iterator>;
1672
1675 return const_arg_range(arg_begin(), arg_end());
1676 }
1677
1678 arg_iterator arg_begin() { return getTrailingArgs(); }
1680 const_arg_iterator arg_begin() const { return getTrailingArgs(); }
1682
1683 Expr **getArgs() { return reinterpret_cast<Expr **>(getTrailingArgs()); }
1684 const Expr *const *getArgs() const {
1685 return reinterpret_cast<const Expr *const *>(getTrailingArgs());
1686 }
1687
1688 /// Return the number of arguments to the constructor call.
1689 unsigned getNumArgs() const { return NumArgs; }
1690
1691 /// Return the specified argument.
1692 Expr *getArg(unsigned Arg) {
1693 assert(Arg < getNumArgs() && "Arg access out of range!");
1694 return getArgs()[Arg];
1695 }
1696 const Expr *getArg(unsigned Arg) const {
1697 assert(Arg < getNumArgs() && "Arg access out of range!");
1698 return getArgs()[Arg];
1699 }
1700
1701 /// Set the specified argument.
1702 void setArg(unsigned Arg, Expr *ArgExpr) {
1703 assert(Arg < getNumArgs() && "Arg access out of range!");
1704 getArgs()[Arg] = ArgExpr;
1705 }
1706
1708 return CXXConstructExprBits.IsImmediateEscalating;
1709 }
1710
1712 CXXConstructExprBits.IsImmediateEscalating = Set;
1713 }
1714
1715 /// Returns the WarnUnusedResultAttr that is declared on the callee
1716 /// or its return type declaration, together with a NamedDecl that
1717 /// refers to the declaration the attribute is attached to.
1718 std::pair<const NamedDecl *, const WarnUnusedResultAttr *>
1721 }
1722
1723 /// Returns true if this call expression should warn on unused results.
1724 bool hasUnusedResultAttr(const ASTContext &Ctx) const {
1725 return getUnusedResultAttr(Ctx).second != nullptr;
1726 }
1727
1728 SourceLocation getBeginLoc() const LLVM_READONLY;
1729 SourceLocation getEndLoc() const LLVM_READONLY;
1730 SourceRange getParenOrBraceRange() const { return ParenOrBraceRange; }
1731 void setParenOrBraceRange(SourceRange Range) { ParenOrBraceRange = Range; }
1732
1733 static bool classof(const Stmt *T) {
1734 return T->getStmtClass() == CXXConstructExprClass ||
1735 T->getStmtClass() == CXXTemporaryObjectExprClass;
1736 }
1737
1738 // Iterators
1740 return child_range(getTrailingArgs(), getTrailingArgs() + getNumArgs());
1741 }
1742
1744 auto Children = const_cast<CXXConstructExpr *>(this)->children();
1745 return const_child_range(Children.begin(), Children.end());
1746 }
1747};
1748
1749/// Represents a call to an inherited base class constructor from an
1750/// inheriting constructor. This call implicitly forwards the arguments from
1751/// the enclosing context (an inheriting constructor) to the specified inherited
1752/// base class constructor.
1754private:
1755 CXXConstructorDecl *Constructor = nullptr;
1756
1757 /// The location of the using declaration.
1758 SourceLocation Loc;
1759
1760 /// Whether this is the construction of a virtual base.
1761 LLVM_PREFERRED_TYPE(bool)
1762 unsigned ConstructsVirtualBase : 1;
1763
1764 /// Whether the constructor is inherited from a virtual base class of the
1765 /// class that we construct.
1766 LLVM_PREFERRED_TYPE(bool)
1767 unsigned InheritedFromVirtualBase : 1;
1768
1769public:
1770 friend class ASTStmtReader;
1771
1772 /// Construct a C++ inheriting construction expression.
1774 CXXConstructorDecl *Ctor, bool ConstructsVirtualBase,
1775 bool InheritedFromVirtualBase)
1776 : Expr(CXXInheritedCtorInitExprClass, T, VK_PRValue, OK_Ordinary),
1777 Constructor(Ctor), Loc(Loc),
1778 ConstructsVirtualBase(ConstructsVirtualBase),
1779 InheritedFromVirtualBase(InheritedFromVirtualBase) {
1780 assert(!T->isDependentType());
1781 setDependence(ExprDependence::None);
1782 }
1783
1784 /// Construct an empty C++ inheriting construction expression.
1786 : Expr(CXXInheritedCtorInitExprClass, Empty),
1787 ConstructsVirtualBase(false), InheritedFromVirtualBase(false) {}
1788
1789 /// Get the constructor that this expression will call.
1790 CXXConstructorDecl *getConstructor() const { return Constructor; }
1791
1792 /// Determine whether this constructor is actually constructing
1793 /// a base class (rather than a complete object).
1794 bool constructsVBase() const { return ConstructsVirtualBase; }
1799
1800 /// Determine whether the inherited constructor is inherited from a
1801 /// virtual base of the object we construct. If so, we are not responsible
1802 /// for calling the inherited constructor (the complete object constructor
1803 /// does that), and so we don't need to pass any arguments.
1804 bool inheritedFromVBase() const { return InheritedFromVirtualBase; }
1805
1806 SourceLocation getLocation() const LLVM_READONLY { return Loc; }
1807 SourceLocation getBeginLoc() const LLVM_READONLY { return Loc; }
1808 SourceLocation getEndLoc() const LLVM_READONLY { return Loc; }
1809
1810 static bool classof(const Stmt *T) {
1811 return T->getStmtClass() == CXXInheritedCtorInitExprClass;
1812 }
1813
1817
1821};
1822
1823/// Represents an explicit C++ type conversion that uses "functional"
1824/// notation (C++ [expr.type.conv]).
1825///
1826/// Example:
1827/// \code
1828/// x = int(0.5);
1829/// \endcode
1830class CXXFunctionalCastExpr final
1831 : public ExplicitCastExpr,
1832 private llvm::TrailingObjects<CXXFunctionalCastExpr, CXXBaseSpecifier *,
1833 FPOptionsOverride> {
1834 SourceLocation LParenLoc;
1835 SourceLocation RParenLoc;
1836
1837 CXXFunctionalCastExpr(QualType ty, ExprValueKind VK,
1838 TypeSourceInfo *writtenTy, CastKind kind,
1839 Expr *castExpr, unsigned pathSize,
1840 FPOptionsOverride FPO, SourceLocation lParenLoc,
1841 SourceLocation rParenLoc)
1842 : ExplicitCastExpr(CXXFunctionalCastExprClass, ty, VK, kind, castExpr,
1843 pathSize, FPO.requiresTrailingStorage(), writtenTy),
1844 LParenLoc(lParenLoc), RParenLoc(rParenLoc) {
1845 if (hasStoredFPFeatures())
1846 *getTrailingFPFeatures() = FPO;
1847 }
1848
1849 explicit CXXFunctionalCastExpr(EmptyShell Shell, unsigned PathSize,
1850 bool HasFPFeatures)
1851 : ExplicitCastExpr(CXXFunctionalCastExprClass, Shell, PathSize,
1852 HasFPFeatures) {}
1853
1854 unsigned numTrailingObjects(OverloadToken<CXXBaseSpecifier *>) const {
1855 return path_size();
1856 }
1857
1858public:
1859 friend class CastExpr;
1861
1862 static CXXFunctionalCastExpr *
1863 Create(const ASTContext &Context, QualType T, ExprValueKind VK,
1864 TypeSourceInfo *Written, CastKind Kind, Expr *Op,
1865 const CXXCastPath *Path, FPOptionsOverride FPO, SourceLocation LPLoc,
1866 SourceLocation RPLoc);
1867 static CXXFunctionalCastExpr *
1868 CreateEmpty(const ASTContext &Context, unsigned PathSize, bool HasFPFeatures);
1869
1870 SourceLocation getLParenLoc() const { return LParenLoc; }
1871 void setLParenLoc(SourceLocation L) { LParenLoc = L; }
1872 SourceLocation getRParenLoc() const { return RParenLoc; }
1873 void setRParenLoc(SourceLocation L) { RParenLoc = L; }
1874
1875 /// Determine whether this expression models list-initialization.
1876 bool isListInitialization() const { return LParenLoc.isInvalid(); }
1877
1878 SourceLocation getBeginLoc() const LLVM_READONLY;
1879 SourceLocation getEndLoc() const LLVM_READONLY;
1880
1881 static bool classof(const Stmt *T) {
1882 return T->getStmtClass() == CXXFunctionalCastExprClass;
1883 }
1884};
1885
1886/// Represents a C++ functional cast expression that builds a
1887/// temporary object.
1888///
1889/// This expression type represents a C++ "functional" cast
1890/// (C++[expr.type.conv]) with N != 1 arguments that invokes a
1891/// constructor to build a temporary object. With N == 1 arguments the
1892/// functional cast expression will be represented by CXXFunctionalCastExpr.
1893/// Example:
1894/// \code
1895/// struct X { X(int, float); }
1896///
1897/// X create_X() {
1898/// return X(1, 3.14f); // creates a CXXTemporaryObjectExpr
1899/// };
1900/// \endcode
1901class CXXTemporaryObjectExpr final : public CXXConstructExpr {
1902 friend class ASTStmtReader;
1903
1904 // CXXTemporaryObjectExpr has some trailing objects belonging
1905 // to CXXConstructExpr. See the comment inside CXXConstructExpr
1906 // for more details.
1907
1908 TypeSourceInfo *TSI;
1909
1910 CXXTemporaryObjectExpr(CXXConstructorDecl *Cons, QualType Ty,
1912 SourceRange ParenOrBraceRange,
1913 bool HadMultipleCandidates, bool ListInitialization,
1914 bool StdInitListInitialization,
1915 bool ZeroInitialization);
1916
1917 CXXTemporaryObjectExpr(EmptyShell Empty, unsigned NumArgs);
1918
1919public:
1920 static CXXTemporaryObjectExpr *
1921 Create(const ASTContext &Ctx, CXXConstructorDecl *Cons, QualType Ty,
1923 SourceRange ParenOrBraceRange, bool HadMultipleCandidates,
1924 bool ListInitialization, bool StdInitListInitialization,
1925 bool ZeroInitialization);
1926
1927 static CXXTemporaryObjectExpr *CreateEmpty(const ASTContext &Ctx,
1928 unsigned NumArgs);
1929
1930 TypeSourceInfo *getTypeSourceInfo() const { return TSI; }
1931
1932 SourceLocation getBeginLoc() const LLVM_READONLY;
1933 SourceLocation getEndLoc() const LLVM_READONLY;
1934
1935 static bool classof(const Stmt *T) {
1936 return T->getStmtClass() == CXXTemporaryObjectExprClass;
1937 }
1938};
1939
1940Stmt **CXXConstructExpr::getTrailingArgs() {
1941 if (auto *E = dyn_cast<CXXTemporaryObjectExpr>(this))
1942 return reinterpret_cast<Stmt **>(E + 1);
1943 assert((getStmtClass() == CXXConstructExprClass) &&
1944 "Unexpected class deriving from CXXConstructExpr!");
1945 return reinterpret_cast<Stmt **>(this + 1);
1946}
1947
1948/// A C++ lambda expression, which produces a function object
1949/// (of unspecified type) that can be invoked later.
1950///
1951/// Example:
1952/// \code
1953/// void low_pass_filter(std::vector<double> &values, double cutoff) {
1954/// values.erase(std::remove_if(values.begin(), values.end(),
1955/// [=](double value) { return value > cutoff; });
1956/// }
1957/// \endcode
1958///
1959/// C++11 lambda expressions can capture local variables, either by copying
1960/// the values of those local variables at the time the function
1961/// object is constructed (not when it is called!) or by holding a
1962/// reference to the local variable. These captures can occur either
1963/// implicitly or can be written explicitly between the square
1964/// brackets ([...]) that start the lambda expression.
1965///
1966/// C++1y introduces a new form of "capture" called an init-capture that
1967/// includes an initializing expression (rather than capturing a variable),
1968/// and which can never occur implicitly.
1969class LambdaExpr final : public Expr,
1970 private llvm::TrailingObjects<LambdaExpr, Stmt *> {
1971 // LambdaExpr has some data stored in LambdaExprBits.
1972
1973 /// The source range that covers the lambda introducer ([...]).
1974 SourceRange IntroducerRange;
1975
1976 /// The source location of this lambda's capture-default ('=' or '&').
1977 SourceLocation CaptureDefaultLoc;
1978
1979 /// The location of the closing brace ('}') that completes
1980 /// the lambda.
1981 ///
1982 /// The location of the brace is also available by looking up the
1983 /// function call operator in the lambda class. However, it is
1984 /// stored here to improve the performance of getSourceRange(), and
1985 /// to avoid having to deserialize the function call operator from a
1986 /// module file just to determine the source range.
1987 SourceLocation ClosingBrace;
1988
1989 /// Construct a lambda expression.
1990 LambdaExpr(QualType T, SourceRange IntroducerRange,
1991 LambdaCaptureDefault CaptureDefault,
1992 SourceLocation CaptureDefaultLoc, bool ExplicitParams,
1993 bool ExplicitResultType, ArrayRef<Expr *> CaptureInits,
1994 SourceLocation ClosingBrace, bool ContainsUnexpandedParameterPack);
1995
1996 /// Construct an empty lambda expression.
1997 LambdaExpr(EmptyShell Empty, unsigned NumCaptures);
1998
1999 Stmt **getStoredStmts() { return getTrailingObjects(); }
2000 Stmt *const *getStoredStmts() const { return getTrailingObjects(); }
2001
2002 void initBodyIfNeeded() const;
2003
2004public:
2005 friend class ASTStmtReader;
2006 friend class ASTStmtWriter;
2008
2009 /// Construct a new lambda expression.
2010 static LambdaExpr *
2011 Create(const ASTContext &C, CXXRecordDecl *Class, SourceRange IntroducerRange,
2012 LambdaCaptureDefault CaptureDefault, SourceLocation CaptureDefaultLoc,
2013 bool ExplicitParams, bool ExplicitResultType,
2014 ArrayRef<Expr *> CaptureInits, SourceLocation ClosingBrace,
2015 bool ContainsUnexpandedParameterPack);
2016
2017 /// Construct a new lambda expression that will be deserialized from
2018 /// an external source.
2019 static LambdaExpr *CreateDeserialized(const ASTContext &C,
2020 unsigned NumCaptures);
2021
2022 /// Determine the default capture kind for this lambda.
2024 return static_cast<LambdaCaptureDefault>(LambdaExprBits.CaptureDefault);
2025 }
2026
2027 /// Retrieve the location of this lambda's capture-default, if any.
2028 SourceLocation getCaptureDefaultLoc() const { return CaptureDefaultLoc; }
2029
2030 /// Determine whether one of this lambda's captures is an init-capture.
2031 bool isInitCapture(const LambdaCapture *Capture) const;
2032
2033 /// An iterator that walks over the captures of the lambda,
2034 /// both implicit and explicit.
2036
2037 /// An iterator over a range of lambda captures.
2038 using capture_range = llvm::iterator_range<capture_iterator>;
2039
2040 /// Retrieve this lambda's captures.
2041 capture_range captures() const;
2042
2043 /// Retrieve an iterator pointing to the first lambda capture.
2045
2046 /// Retrieve an iterator pointing past the end of the
2047 /// sequence of lambda captures.
2049
2050 /// Determine the number of captures in this lambda.
2051 unsigned capture_size() const { return LambdaExprBits.NumCaptures; }
2052
2053 /// Retrieve this lambda's explicit captures.
2055
2056 /// Retrieve an iterator pointing to the first explicit
2057 /// lambda capture.
2059
2060 /// Retrieve an iterator pointing past the end of the sequence of
2061 /// explicit lambda captures.
2063
2064 /// Retrieve this lambda's implicit captures.
2066
2067 /// Retrieve an iterator pointing to the first implicit
2068 /// lambda capture.
2070
2071 /// Retrieve an iterator pointing past the end of the sequence of
2072 /// implicit lambda captures.
2074
2075 /// Iterator that walks over the capture initialization
2076 /// arguments.
2078
2079 /// Const iterator that walks over the capture initialization
2080 /// arguments.
2081 /// FIXME: This interface is prone to being used incorrectly.
2083
2084 /// Retrieve the initialization expressions for this lambda's captures.
2085 llvm::iterator_range<capture_init_iterator> capture_inits() {
2086 return llvm::make_range(capture_init_begin(), capture_init_end());
2087 }
2088
2089 /// Retrieve the initialization expressions for this lambda's captures.
2090 llvm::iterator_range<const_capture_init_iterator> capture_inits() const {
2091 return llvm::make_range(capture_init_begin(), capture_init_end());
2092 }
2093
2094 /// Retrieve the first initialization argument for this
2095 /// lambda expression (which initializes the first capture field).
2097 return reinterpret_cast<Expr **>(getStoredStmts());
2098 }
2099
2100 /// Retrieve the first initialization argument for this
2101 /// lambda expression (which initializes the first capture field).
2103 return reinterpret_cast<Expr *const *>(getStoredStmts());
2104 }
2105
2106 /// Retrieve the iterator pointing one past the last
2107 /// initialization argument for this lambda expression.
2111
2112 /// Retrieve the iterator pointing one past the last
2113 /// initialization argument for this lambda expression.
2117
2118 /// Retrieve the source range covering the lambda introducer,
2119 /// which contains the explicit capture list surrounded by square
2120 /// brackets ([...]).
2121 SourceRange getIntroducerRange() const { return IntroducerRange; }
2122
2123 /// Retrieve the class that corresponds to the lambda.
2124 ///
2125 /// This is the "closure type" (C++1y [expr.prim.lambda]), and stores the
2126 /// captures in its fields and provides the various operations permitted
2127 /// on a lambda (copying, calling).
2129
2130 /// Retrieve the function call operator associated with this
2131 /// lambda expression.
2133
2134 /// Retrieve the function template call operator associated with this
2135 /// lambda expression.
2137
2138 /// If this is a generic lambda expression, retrieve the template
2139 /// parameter list associated with it, or else return null.
2141
2142 /// Get the template parameters were explicitly specified (as opposed to being
2143 /// invented by use of an auto parameter).
2145
2146 /// Get the trailing requires clause, if any.
2148
2149 /// Whether this is a generic lambda.
2151
2152 /// Retrieve the body of the lambda. This will be most of the time
2153 /// a \p CompoundStmt, but can also be \p CoroutineBodyStmt wrapping
2154 /// a \p CompoundStmt. Note that unlike functions, lambda-expressions
2155 /// cannot have a function-try-block.
2156 Stmt *getBody() const;
2157
2158 /// Retrieve the \p CompoundStmt representing the body of the lambda.
2159 /// This is a convenience function for callers who do not need
2160 /// to handle node(s) which may wrap a \p CompoundStmt.
2161 const CompoundStmt *getCompoundStmtBody() const;
2163 const auto *ConstThis = this;
2164 return const_cast<CompoundStmt *>(ConstThis->getCompoundStmtBody());
2165 }
2166
2167 /// Determine whether the lambda is mutable, meaning that any
2168 /// captures values can be modified.
2169 bool isMutable() const;
2170
2171 /// Determine whether this lambda has an explicit parameter
2172 /// list vs. an implicit (empty) parameter list.
2173 bool hasExplicitParameters() const { return LambdaExprBits.ExplicitParams; }
2174
2175 /// Whether this lambda had its result type explicitly specified.
2177 return LambdaExprBits.ExplicitResultType;
2178 }
2179
2180 static bool classof(const Stmt *T) {
2181 return T->getStmtClass() == LambdaExprClass;
2182 }
2183
2184 SourceLocation getBeginLoc() const LLVM_READONLY {
2185 return IntroducerRange.getBegin();
2186 }
2187
2188 SourceLocation getEndLoc() const LLVM_READONLY { return ClosingBrace; }
2189
2190 /// Includes the captures and the body of the lambda.
2193};
2194
2195/// An expression "T()" which creates an rvalue of a non-class type T.
2196/// For non-void T, the rvalue is value-initialized.
2197/// See (C++98 [5.2.3p2]).
2199 friend class ASTStmtReader;
2200
2201 TypeSourceInfo *TypeInfo;
2202
2203public:
2204 /// Create an explicitly-written scalar-value initialization
2205 /// expression.
2207 SourceLocation RParenLoc)
2208 : Expr(CXXScalarValueInitExprClass, Type, VK_PRValue, OK_Ordinary),
2209 TypeInfo(TypeInfo) {
2210 CXXScalarValueInitExprBits.RParenLoc = RParenLoc;
2212 }
2213
2215 : Expr(CXXScalarValueInitExprClass, Shell) {}
2216
2218 return TypeInfo;
2219 }
2220
2222 return CXXScalarValueInitExprBits.RParenLoc;
2223 }
2224
2225 SourceLocation getBeginLoc() const LLVM_READONLY;
2227
2228 static bool classof(const Stmt *T) {
2229 return T->getStmtClass() == CXXScalarValueInitExprClass;
2230 }
2231
2232 // Iterators
2236
2240};
2241
2243 /// New-expression has no initializer as written.
2245
2246 /// New-expression has a C++98 paren-delimited initializer.
2248
2249 /// New-expression has a C++11 list-initializer.
2251};
2252
2253enum class TypeAwareAllocationMode : unsigned { No, Yes };
2254
2258
2259inline TypeAwareAllocationMode
2260typeAwareAllocationModeFromBool(bool IsTypeAwareAllocation) {
2261 return IsTypeAwareAllocation ? TypeAwareAllocationMode::Yes
2263}
2264
2265enum class AlignedAllocationMode : unsigned { No, Yes };
2266
2268 return Mode == AlignedAllocationMode::Yes;
2269}
2270
2274
2275enum class SizedDeallocationMode : unsigned { No, Yes };
2276
2278 return Mode == SizedDeallocationMode::Yes;
2279}
2280
2284
2311
2344
2345/// The parameters to pass to a usual operator delete.
2352
2353/// Represents a new-expression for memory allocation and constructor
2354/// calls, e.g: "new CXXNewExpr(foo)".
2355class CXXNewExpr final
2356 : public Expr,
2357 private llvm::TrailingObjects<CXXNewExpr, Stmt *, SourceRange> {
2358 friend class ASTStmtReader;
2359 friend class ASTStmtWriter;
2360 friend TrailingObjects;
2361
2362 /// Points to the allocation function used.
2363 FunctionDecl *OperatorNew;
2364
2365 /// Points to the deallocation function used in case of error. May be null.
2366 FunctionDecl *OperatorDelete;
2367
2368 /// The allocated type-source information, as written in the source.
2369 TypeSourceInfo *AllocatedTypeInfo;
2370
2371 /// Range of the entire new expression.
2372 SourceRange Range;
2373
2374 /// Source-range of a paren-delimited initializer.
2375 SourceRange DirectInitRange;
2376
2377 // CXXNewExpr is followed by several optional trailing objects.
2378 // They are in order:
2379 //
2380 // * An optional "Stmt *" for the array size expression.
2381 // Present if and ony if isArray().
2382 //
2383 // * An optional "Stmt *" for the init expression.
2384 // Present if and only if hasInitializer().
2385 //
2386 // * An array of getNumPlacementArgs() "Stmt *" for the placement new
2387 // arguments, if any.
2388 //
2389 // * An optional SourceRange for the range covering the parenthesized type-id
2390 // if the allocated type was expressed as a parenthesized type-id.
2391 // Present if and only if isParenTypeId().
2392 unsigned arraySizeOffset() const { return 0; }
2393 unsigned initExprOffset() const { return arraySizeOffset() + isArray(); }
2394 unsigned placementNewArgsOffset() const {
2395 return initExprOffset() + hasInitializer();
2396 }
2397
2398 unsigned numTrailingObjects(OverloadToken<Stmt *>) const {
2400 }
2401
2402 unsigned numTrailingObjects(OverloadToken<SourceRange>) const {
2403 return isParenTypeId();
2404 }
2405
2406 /// Build a c++ new expression.
2407 CXXNewExpr(bool IsGlobalNew, FunctionDecl *OperatorNew,
2408 FunctionDecl *OperatorDelete,
2409 const ImplicitAllocationParameters &IAP,
2410 bool UsualArrayDeleteWantsSize, ArrayRef<Expr *> PlacementArgs,
2411 SourceRange TypeIdParens, std::optional<Expr *> ArraySize,
2412 CXXNewInitializationStyle InitializationStyle, Expr *Initializer,
2413 QualType Ty, TypeSourceInfo *AllocatedTypeInfo, SourceRange Range,
2414 SourceRange DirectInitRange);
2415
2416 /// Build an empty c++ new expression.
2417 CXXNewExpr(EmptyShell Empty, bool IsArray, unsigned NumPlacementArgs,
2418 bool IsParenTypeId);
2419
2420public:
2421 /// Create a c++ new expression.
2422 static CXXNewExpr *
2423 Create(const ASTContext &Ctx, bool IsGlobalNew, FunctionDecl *OperatorNew,
2424 FunctionDecl *OperatorDelete, const ImplicitAllocationParameters &IAP,
2425 bool UsualArrayDeleteWantsSize, ArrayRef<Expr *> PlacementArgs,
2426 SourceRange TypeIdParens, std::optional<Expr *> ArraySize,
2427 CXXNewInitializationStyle InitializationStyle, Expr *Initializer,
2428 QualType Ty, TypeSourceInfo *AllocatedTypeInfo, SourceRange Range,
2429 SourceRange DirectInitRange);
2430
2431 /// Create an empty c++ new expression.
2432 static CXXNewExpr *CreateEmpty(const ASTContext &Ctx, bool IsArray,
2433 bool HasInit, unsigned NumPlacementArgs,
2434 bool IsParenTypeId);
2435
2437 return getType()->castAs<PointerType>()->getPointeeType();
2438 }
2439
2441 return AllocatedTypeInfo;
2442 }
2443
2444 /// True if the allocation result needs to be null-checked.
2445 ///
2446 /// C++11 [expr.new]p13:
2447 /// If the allocation function returns null, initialization shall
2448 /// not be done, the deallocation function shall not be called,
2449 /// and the value of the new-expression shall be null.
2450 ///
2451 /// C++ DR1748:
2452 /// If the allocation function is a reserved placement allocation
2453 /// function that returns null, the behavior is undefined.
2454 ///
2455 /// An allocation function is not allowed to return null unless it
2456 /// has a non-throwing exception-specification. The '03 rule is
2457 /// identical except that the definition of a non-throwing
2458 /// exception specification is just "is it throw()?".
2459 bool shouldNullCheckAllocation() const;
2460
2461 FunctionDecl *getOperatorNew() const { return OperatorNew; }
2462 void setOperatorNew(FunctionDecl *D) { OperatorNew = D; }
2463 FunctionDecl *getOperatorDelete() const { return OperatorDelete; }
2464 void setOperatorDelete(FunctionDecl *D) { OperatorDelete = D; }
2465
2466 bool isArray() const { return CXXNewExprBits.IsArray; }
2467
2468 /// This might return std::nullopt even if isArray() returns true,
2469 /// since there might not be an array size expression.
2470 /// If the result is not std::nullopt, it will never wrap a nullptr.
2471 std::optional<Expr *> getArraySize() {
2472 if (!isArray())
2473 return std::nullopt;
2474
2475 if (auto *Result =
2476 cast_or_null<Expr>(getTrailingObjects<Stmt *>()[arraySizeOffset()]))
2477 return Result;
2478
2479 return std::nullopt;
2480 }
2481
2482 /// This might return std::nullopt even if isArray() returns true,
2483 /// since there might not be an array size expression.
2484 /// If the result is not std::nullopt, it will never wrap a nullptr.
2485 std::optional<const Expr *> getArraySize() const {
2486 if (!isArray())
2487 return std::nullopt;
2488
2489 if (auto *Result =
2490 cast_or_null<Expr>(getTrailingObjects<Stmt *>()[arraySizeOffset()]))
2491 return Result;
2492
2493 return std::nullopt;
2494 }
2495
2496 unsigned getNumPlacementArgs() const {
2497 return CXXNewExprBits.NumPlacementArgs;
2498 }
2499
2501 return reinterpret_cast<Expr **>(getTrailingObjects<Stmt *>() +
2502 placementNewArgsOffset());
2503 }
2504
2505 Expr *getPlacementArg(unsigned I) {
2506 assert((I < getNumPlacementArgs()) && "Index out of range!");
2507 return getPlacementArgs()[I];
2508 }
2509 const Expr *getPlacementArg(unsigned I) const {
2510 return const_cast<CXXNewExpr *>(this)->getPlacementArg(I);
2511 }
2512
2513 unsigned getNumImplicitArgs() const {
2515 }
2516
2517 bool isParenTypeId() const { return CXXNewExprBits.IsParenTypeId; }
2519 return isParenTypeId() ? getTrailingObjects<SourceRange>()[0]
2520 : SourceRange();
2521 }
2522
2523 bool isGlobalNew() const { return CXXNewExprBits.IsGlobalNew; }
2524
2525 /// Whether this new-expression has any initializer at all.
2526 bool hasInitializer() const { return CXXNewExprBits.HasInitializer; }
2527
2528 /// The kind of initializer this new-expression has.
2530 return static_cast<CXXNewInitializationStyle>(
2531 CXXNewExprBits.StoredInitializationStyle);
2532 }
2533
2534 /// The initializer of this new-expression.
2536 return hasInitializer()
2537 ? cast<Expr>(getTrailingObjects<Stmt *>()[initExprOffset()])
2538 : nullptr;
2539 }
2540 const Expr *getInitializer() const {
2541 return hasInitializer()
2542 ? cast<Expr>(getTrailingObjects<Stmt *>()[initExprOffset()])
2543 : nullptr;
2544 }
2545
2546 /// Returns the CXXConstructExpr from this new-expression, or null.
2548 return dyn_cast_or_null<CXXConstructExpr>(getInitializer());
2549 }
2550
2551 /// Indicates whether the required alignment should be implicitly passed to
2552 /// the allocation function.
2553 bool passAlignment() const { return CXXNewExprBits.ShouldPassAlignment; }
2554
2555 /// Answers whether the usual array deallocation function for the
2556 /// allocated type expects the size of the allocation as a
2557 /// parameter.
2559 return CXXNewExprBits.UsualArrayDeleteWantsSize;
2560 }
2561
2562 /// Provides the full set of information about expected implicit
2563 /// parameters in this call
2570
2573
2574 llvm::iterator_range<arg_iterator> placement_arguments() {
2575 return llvm::make_range(placement_arg_begin(), placement_arg_end());
2576 }
2577
2578 llvm::iterator_range<const_arg_iterator> placement_arguments() const {
2579 return llvm::make_range(placement_arg_begin(), placement_arg_end());
2580 }
2581
2583 return getTrailingObjects<Stmt *>() + placementNewArgsOffset();
2584 }
2589 return getTrailingObjects<Stmt *>() + placementNewArgsOffset();
2590 }
2594
2596
2597 raw_arg_iterator raw_arg_begin() { return getTrailingObjects<Stmt *>(); }
2599 return raw_arg_begin() + numTrailingObjects(OverloadToken<Stmt *>());
2600 }
2602 return getTrailingObjects<Stmt *>();
2603 }
2605 return raw_arg_begin() + numTrailingObjects(OverloadToken<Stmt *>());
2606 }
2607
2608 SourceLocation getBeginLoc() const { return Range.getBegin(); }
2609 SourceLocation getEndLoc() const { return Range.getEnd(); }
2610
2611 SourceRange getDirectInitRange() const { return DirectInitRange; }
2612 SourceRange getSourceRange() const { return Range; }
2613
2614 static bool classof(const Stmt *T) {
2615 return T->getStmtClass() == CXXNewExprClass;
2616 }
2617
2618 // Iterators
2620
2622 return const_child_range(const_cast<CXXNewExpr *>(this)->children());
2623 }
2624};
2625
2626/// Represents a \c delete expression for memory deallocation and
2627/// destructor calls, e.g. "delete[] pArray".
2628class CXXDeleteExpr : public Expr {
2629 friend class ASTStmtReader;
2630
2631 /// Points to the operator delete overload that is used. Could be a member.
2632 FunctionDecl *OperatorDelete = nullptr;
2633
2634 /// The pointer expression to be deleted.
2635 Stmt *Argument = nullptr;
2636
2637public:
2638 CXXDeleteExpr(QualType Ty, bool GlobalDelete, bool ArrayForm,
2639 bool ArrayFormAsWritten, bool UsualArrayDeleteWantsSize,
2640 FunctionDecl *OperatorDelete, Expr *Arg, SourceLocation Loc)
2641 : Expr(CXXDeleteExprClass, Ty, VK_PRValue, OK_Ordinary),
2642 OperatorDelete(OperatorDelete), Argument(Arg) {
2643 CXXDeleteExprBits.GlobalDelete = GlobalDelete;
2644 CXXDeleteExprBits.ArrayForm = ArrayForm;
2645 CXXDeleteExprBits.ArrayFormAsWritten = ArrayFormAsWritten;
2646 CXXDeleteExprBits.UsualArrayDeleteWantsSize = UsualArrayDeleteWantsSize;
2647 CXXDeleteExprBits.Loc = Loc;
2649 }
2650
2651 explicit CXXDeleteExpr(EmptyShell Shell) : Expr(CXXDeleteExprClass, Shell) {}
2652
2653 bool isGlobalDelete() const { return CXXDeleteExprBits.GlobalDelete; }
2654 bool isArrayForm() const { return CXXDeleteExprBits.ArrayForm; }
2656 return CXXDeleteExprBits.ArrayFormAsWritten;
2657 }
2658
2659 /// Answers whether the usual array deallocation function for the
2660 /// allocated type expects the size of the allocation as a
2661 /// parameter. This can be true even if the actual deallocation
2662 /// function that we're using doesn't want a size.
2664 return CXXDeleteExprBits.UsualArrayDeleteWantsSize;
2665 }
2666
2667 FunctionDecl *getOperatorDelete() const { return OperatorDelete; }
2668
2669 Expr *getArgument() { return cast<Expr>(Argument); }
2670 const Expr *getArgument() const { return cast<Expr>(Argument); }
2671
2672 /// Retrieve the type being destroyed.
2673 ///
2674 /// If the type being destroyed is a dependent type which may or may not
2675 /// be a pointer, return an invalid type.
2676 QualType getDestroyedType() const;
2677
2679 SourceLocation getEndLoc() const LLVM_READONLY {
2680 return Argument->getEndLoc();
2681 }
2682
2683 static bool classof(const Stmt *T) {
2684 return T->getStmtClass() == CXXDeleteExprClass;
2685 }
2686
2687 // Iterators
2688 child_range children() { return child_range(&Argument, &Argument + 1); }
2689
2691 return const_child_range(&Argument, &Argument + 1);
2692 }
2693};
2694
2695/// Stores the type being destroyed by a pseudo-destructor expression.
2697 /// Either the type source information or the name of the type, if
2698 /// it couldn't be resolved due to type-dependence.
2699 llvm::PointerUnion<TypeSourceInfo *, const IdentifierInfo *> Type;
2700
2701 /// The starting source location of the pseudo-destructor type.
2702 SourceLocation Location;
2703
2704public:
2706
2708 : Type(II), Location(Loc) {}
2709
2711
2713 return Type.dyn_cast<TypeSourceInfo *>();
2714 }
2715
2717 return Type.dyn_cast<const IdentifierInfo *>();
2718 }
2719
2720 SourceLocation getLocation() const { return Location; }
2721};
2722
2723/// Represents a C++ pseudo-destructor (C++ [expr.pseudo]).
2724///
2725/// A pseudo-destructor is an expression that looks like a member access to a
2726/// destructor of a scalar type, except that scalar types don't have
2727/// destructors. For example:
2728///
2729/// \code
2730/// typedef int T;
2731/// void f(int *p) {
2732/// p->T::~T();
2733/// }
2734/// \endcode
2735///
2736/// Pseudo-destructors typically occur when instantiating templates such as:
2737///
2738/// \code
2739/// template<typename T>
2740/// void destroy(T* ptr) {
2741/// ptr->T::~T();
2742/// }
2743/// \endcode
2744///
2745/// for scalar types. A pseudo-destructor expression has no run-time semantics
2746/// beyond evaluating the base expression.
2748 friend class ASTStmtReader;
2749
2750 /// The base expression (that is being destroyed).
2751 Stmt *Base = nullptr;
2752
2753 /// Whether the operator was an arrow ('->'); otherwise, it was a
2754 /// period ('.').
2755 LLVM_PREFERRED_TYPE(bool)
2756 bool IsArrow : 1;
2757
2758 /// The location of the '.' or '->' operator.
2759 SourceLocation OperatorLoc;
2760
2761 /// The nested-name-specifier that follows the operator, if present.
2762 NestedNameSpecifierLoc QualifierLoc;
2763
2764 /// The type that precedes the '::' in a qualified pseudo-destructor
2765 /// expression.
2766 TypeSourceInfo *ScopeType = nullptr;
2767
2768 /// The location of the '::' in a qualified pseudo-destructor
2769 /// expression.
2770 SourceLocation ColonColonLoc;
2771
2772 /// The location of the '~'.
2773 SourceLocation TildeLoc;
2774
2775 /// The type being destroyed, or its name if we were unable to
2776 /// resolve the name.
2777 PseudoDestructorTypeStorage DestroyedType;
2778
2779public:
2780 CXXPseudoDestructorExpr(const ASTContext &Context,
2781 Expr *Base, bool isArrow, SourceLocation OperatorLoc,
2782 NestedNameSpecifierLoc QualifierLoc,
2783 TypeSourceInfo *ScopeType,
2784 SourceLocation ColonColonLoc,
2785 SourceLocation TildeLoc,
2786 PseudoDestructorTypeStorage DestroyedType);
2787
2789 : Expr(CXXPseudoDestructorExprClass, Shell), IsArrow(false) {}
2790
2791 Expr *getBase() const { return cast<Expr>(Base); }
2792
2793 /// Determines whether this member expression actually had
2794 /// a C++ nested-name-specifier prior to the name of the member, e.g.,
2795 /// x->Base::foo.
2796 bool hasQualifier() const { return QualifierLoc.hasQualifier(); }
2797
2798 /// Retrieves the nested-name-specifier that qualifies the type name,
2799 /// with source-location information.
2800 NestedNameSpecifierLoc getQualifierLoc() const { return QualifierLoc; }
2801
2802 /// If the member name was qualified, retrieves the
2803 /// nested-name-specifier that precedes the member name. Otherwise, returns
2804 /// null.
2806 return QualifierLoc.getNestedNameSpecifier();
2807 }
2808
2809 /// Determine whether this pseudo-destructor expression was written
2810 /// using an '->' (otherwise, it used a '.').
2811 bool isArrow() const { return IsArrow; }
2812
2813 /// Retrieve the location of the '.' or '->' operator.
2814 SourceLocation getOperatorLoc() const { return OperatorLoc; }
2815
2816 /// Retrieve the scope type in a qualified pseudo-destructor
2817 /// expression.
2818 ///
2819 /// Pseudo-destructor expressions can have extra qualification within them
2820 /// that is not part of the nested-name-specifier, e.g., \c p->T::~T().
2821 /// Here, if the object type of the expression is (or may be) a scalar type,
2822 /// \p T may also be a scalar type and, therefore, cannot be part of a
2823 /// nested-name-specifier. It is stored as the "scope type" of the pseudo-
2824 /// destructor expression.
2825 TypeSourceInfo *getScopeTypeInfo() const { return ScopeType; }
2826
2827 /// Retrieve the location of the '::' in a qualified pseudo-destructor
2828 /// expression.
2829 SourceLocation getColonColonLoc() const { return ColonColonLoc; }
2830
2831 /// Retrieve the location of the '~'.
2832 SourceLocation getTildeLoc() const { return TildeLoc; }
2833
2834 /// Retrieve the source location information for the type
2835 /// being destroyed.
2836 ///
2837 /// This type-source information is available for non-dependent
2838 /// pseudo-destructor expressions and some dependent pseudo-destructor
2839 /// expressions. Returns null if we only have the identifier for a
2840 /// dependent pseudo-destructor expression.
2842 return DestroyedType.getTypeSourceInfo();
2843 }
2844
2845 /// In a dependent pseudo-destructor expression for which we do not
2846 /// have full type information on the destroyed type, provides the name
2847 /// of the destroyed type.
2849 return DestroyedType.getIdentifier();
2850 }
2851
2852 /// Retrieve the type being destroyed.
2853 QualType getDestroyedType() const;
2854
2855 /// Retrieve the starting location of the type being destroyed.
2857 return DestroyedType.getLocation();
2858 }
2859
2860 /// Set the name of destroyed type for a dependent pseudo-destructor
2861 /// expression.
2863 DestroyedType = PseudoDestructorTypeStorage(II, Loc);
2864 }
2865
2866 /// Set the destroyed type.
2868 DestroyedType = PseudoDestructorTypeStorage(Info);
2869 }
2870
2871 SourceLocation getBeginLoc() const LLVM_READONLY {
2872 return Base->getBeginLoc();
2873 }
2874 SourceLocation getEndLoc() const LLVM_READONLY;
2875
2876 static bool classof(const Stmt *T) {
2877 return T->getStmtClass() == CXXPseudoDestructorExprClass;
2878 }
2879
2880 // Iterators
2881 child_range children() { return child_range(&Base, &Base + 1); }
2882
2884 return const_child_range(&Base, &Base + 1);
2885 }
2886};
2887
2888/// A type trait used in the implementation of various C++11 and
2889/// Library TR1 trait templates.
2890///
2891/// \code
2892/// __is_pod(int) == true
2893/// __is_enum(std::string) == false
2894/// __is_trivially_constructible(vector<int>, int*, int*)
2895/// \endcode
2896class TypeTraitExpr final
2897 : public Expr,
2898 private llvm::TrailingObjects<TypeTraitExpr, APValue, TypeSourceInfo *> {
2899 /// The location of the type trait keyword.
2900 SourceLocation Loc;
2901
2902 /// The location of the closing parenthesis.
2903 SourceLocation RParenLoc;
2904
2905 TypeTraitExpr(QualType T, SourceLocation Loc, TypeTrait Kind,
2907 std::variant<bool, APValue> Value);
2908
2909 TypeTraitExpr(EmptyShell Empty, bool IsStoredAsBool);
2910
2911 size_t numTrailingObjects(OverloadToken<TypeSourceInfo *>) const {
2912 return getNumArgs();
2913 }
2914
2915 size_t numTrailingObjects(OverloadToken<APValue>) const {
2916 return TypeTraitExprBits.IsBooleanTypeTrait ? 0 : 1;
2917 }
2918
2919public:
2920 friend class ASTStmtReader;
2921 friend class ASTStmtWriter;
2923
2924 /// Create a new type trait expression.
2925 static TypeTraitExpr *Create(const ASTContext &C, QualType T,
2926 SourceLocation Loc, TypeTrait Kind,
2928 SourceLocation RParenLoc,
2929 bool Value);
2930
2931 static TypeTraitExpr *Create(const ASTContext &C, QualType T,
2932 SourceLocation Loc, TypeTrait Kind,
2934 SourceLocation RParenLoc, APValue Value);
2935
2936 static TypeTraitExpr *CreateDeserialized(const ASTContext &C,
2937 bool IsStoredAsBool,
2938 unsigned NumArgs);
2939
2940 /// Determine which type trait this expression uses.
2942 return static_cast<TypeTrait>(TypeTraitExprBits.Kind);
2943 }
2944
2945 bool isStoredAsBoolean() const {
2946 return TypeTraitExprBits.IsBooleanTypeTrait;
2947 }
2948
2949 bool getBoolValue() const {
2950 assert(!isValueDependent() && TypeTraitExprBits.IsBooleanTypeTrait);
2951 return TypeTraitExprBits.Value;
2952 }
2953
2954 const APValue &getAPValue() const {
2955 assert(!isValueDependent() && !TypeTraitExprBits.IsBooleanTypeTrait);
2956 return *getTrailingObjects<APValue>();
2957 }
2958
2959 /// Determine the number of arguments to this type trait.
2960 unsigned getNumArgs() const { return TypeTraitExprBits.NumArgs; }
2961
2962 /// Retrieve the Ith argument.
2963 TypeSourceInfo *getArg(unsigned I) const {
2964 assert(I < getNumArgs() && "Argument out-of-range");
2965 return getArgs()[I];
2966 }
2967
2968 /// Retrieve the argument types.
2970 return getTrailingObjects<TypeSourceInfo *>(getNumArgs());
2971 }
2972
2973 SourceLocation getBeginLoc() const LLVM_READONLY { return Loc; }
2974 SourceLocation getEndLoc() const LLVM_READONLY { return RParenLoc; }
2975
2976 static bool classof(const Stmt *T) {
2977 return T->getStmtClass() == TypeTraitExprClass;
2978 }
2979
2980 // Iterators
2984
2988};
2989
2990/// An Embarcadero array type trait, as used in the implementation of
2991/// __array_rank and __array_extent.
2992///
2993/// Example:
2994/// \code
2995/// __array_rank(int[10][20]) == 2
2996/// __array_extent(int[10][20], 1) == 20
2997/// \endcode
2998class ArrayTypeTraitExpr : public Expr {
2999 /// The value of the type trait. Unspecified if dependent.
3000 uint64_t Value = 0;
3001
3002 /// The array dimension being queried, or -1 if not used.
3003 Expr *Dimension;
3004
3005 /// The location of the type trait keyword.
3006 SourceLocation Loc;
3007
3008 /// The location of the closing paren.
3009 SourceLocation RParen;
3010
3011 /// The type being queried.
3012 TypeSourceInfo *QueriedType = nullptr;
3013
3014public:
3015 friend class ASTStmtReader;
3016
3018 TypeSourceInfo *queried, uint64_t value, Expr *dimension,
3019 SourceLocation rparen, QualType ty)
3020 : Expr(ArrayTypeTraitExprClass, ty, VK_PRValue, OK_Ordinary),
3021 Value(value), Dimension(dimension), Loc(loc), RParen(rparen),
3022 QueriedType(queried) {
3023 assert(att <= ATT_Last && "invalid enum value!");
3024 ArrayTypeTraitExprBits.ATT = att;
3025 assert(static_cast<unsigned>(att) == ArrayTypeTraitExprBits.ATT &&
3026 "ATT overflow!");
3028 }
3029
3031 : Expr(ArrayTypeTraitExprClass, Empty) {
3032 ArrayTypeTraitExprBits.ATT = 0;
3033 }
3034
3035 SourceLocation getBeginLoc() const LLVM_READONLY { return Loc; }
3036 SourceLocation getEndLoc() const LLVM_READONLY { return RParen; }
3037
3039 return static_cast<ArrayTypeTrait>(ArrayTypeTraitExprBits.ATT);
3040 }
3041
3042 QualType getQueriedType() const { return QueriedType->getType(); }
3043
3044 TypeSourceInfo *getQueriedTypeSourceInfo() const { return QueriedType; }
3045
3046 uint64_t getValue() const { assert(!isTypeDependent()); return Value; }
3047
3048 Expr *getDimensionExpression() const { return Dimension; }
3049
3050 static bool classof(const Stmt *T) {
3051 return T->getStmtClass() == ArrayTypeTraitExprClass;
3052 }
3053
3054 // Iterators
3058
3062};
3063
3064/// An expression trait intrinsic.
3065///
3066/// Example:
3067/// \code
3068/// __is_lvalue_expr(std::cout) == true
3069/// __is_lvalue_expr(1) == false
3070/// \endcode
3072 /// The location of the type trait keyword.
3073 SourceLocation Loc;
3074
3075 /// The location of the closing paren.
3076 SourceLocation RParen;
3077
3078 /// The expression being queried.
3079 Expr* QueriedExpression = nullptr;
3080
3081public:
3082 friend class ASTStmtReader;
3083
3085 bool value, SourceLocation rparen, QualType resultType)
3086 : Expr(ExpressionTraitExprClass, resultType, VK_PRValue, OK_Ordinary),
3087 Loc(loc), RParen(rparen), QueriedExpression(queried) {
3089 ExpressionTraitExprBits.Value = value;
3090
3091 assert(et <= ET_Last && "invalid enum value!");
3092 assert(static_cast<unsigned>(et) == ExpressionTraitExprBits.ET &&
3093 "ET overflow!");
3095 }
3096
3098 : Expr(ExpressionTraitExprClass, Empty) {
3100 ExpressionTraitExprBits.Value = false;
3101 }
3102
3103 SourceLocation getBeginLoc() const LLVM_READONLY { return Loc; }
3104 SourceLocation getEndLoc() const LLVM_READONLY { return RParen; }
3105
3107 return static_cast<ExpressionTrait>(ExpressionTraitExprBits.ET);
3108 }
3109
3110 Expr *getQueriedExpression() const { return QueriedExpression; }
3111
3112 bool getValue() const { return ExpressionTraitExprBits.Value; }
3113
3114 static bool classof(const Stmt *T) {
3115 return T->getStmtClass() == ExpressionTraitExprClass;
3116 }
3117
3118 // Iterators
3122
3126};
3127
3128/// A reference to an overloaded function set, either an
3129/// \c UnresolvedLookupExpr or an \c UnresolvedMemberExpr.
3130class OverloadExpr : public Expr {
3131 friend class ASTStmtReader;
3132 friend class ASTStmtWriter;
3133
3134 /// The common name of these declarations.
3135 DeclarationNameInfo NameInfo;
3136
3137 /// The nested-name-specifier that qualifies the name, if any.
3138 NestedNameSpecifierLoc QualifierLoc;
3139
3140protected:
3141 OverloadExpr(StmtClass SC, const ASTContext &Context,
3142 NestedNameSpecifierLoc QualifierLoc,
3143 SourceLocation TemplateKWLoc,
3144 const DeclarationNameInfo &NameInfo,
3145 const TemplateArgumentListInfo *TemplateArgs,
3147 bool KnownDependent, bool KnownInstantiationDependent,
3148 bool KnownContainsUnexpandedParameterPack);
3149
3150 OverloadExpr(StmtClass SC, EmptyShell Empty, unsigned NumResults,
3151 bool HasTemplateKWAndArgsInfo);
3152
3153 /// Return the results. Defined after UnresolvedMemberExpr.
3156 return const_cast<OverloadExpr *>(this)->getTrailingResults();
3157 }
3158
3159 /// Return the optional template keyword and arguments info.
3160 /// Defined after UnresolvedMemberExpr.
3166
3167 /// Return the optional template arguments. Defined after
3168 /// UnresolvedMemberExpr.
3171 return const_cast<OverloadExpr *>(this)->getTrailingTemplateArgumentLoc();
3172 }
3173
3175 return OverloadExprBits.HasTemplateKWAndArgsInfo;
3176 }
3177
3178public:
3185
3186 /// Finds the overloaded expression in the given expression \p E of
3187 /// OverloadTy.
3188 ///
3189 /// \return the expression (which must be there) and true if it has
3190 /// the particular form of a member pointer expression
3191 static FindResult find(Expr *E) {
3192 assert(E->getType()->isSpecificBuiltinType(BuiltinType::Overload));
3193
3195 bool HasParen = isa<ParenExpr>(E);
3196
3197 E = E->IgnoreParens();
3198 if (isa<UnaryOperator>(E)) {
3199 assert(cast<UnaryOperator>(E)->getOpcode() == UO_AddrOf);
3200 E = cast<UnaryOperator>(E)->getSubExpr();
3201 auto *Ovl = cast<OverloadExpr>(E->IgnoreParens());
3202
3203 Result.HasFormOfMemberPointer = (E == Ovl && Ovl->getQualifier());
3204 Result.IsAddressOfOperand = true;
3205 Result.IsAddressOfOperandWithParen = HasParen;
3206 Result.Expression = Ovl;
3207 } else {
3208 Result.Expression = cast<OverloadExpr>(E);
3209 }
3210
3211 return Result;
3212 }
3213
3214 /// Gets the naming class of this lookup, if any.
3215 /// Defined after UnresolvedMemberExpr.
3216 inline CXXRecordDecl *getNamingClass();
3218 return const_cast<OverloadExpr *>(this)->getNamingClass();
3219 }
3220
3222
3229 llvm::iterator_range<decls_iterator> decls() const {
3230 return llvm::make_range(decls_begin(), decls_end());
3231 }
3232
3233 /// Gets the number of declarations in the unresolved set.
3234 unsigned getNumDecls() const { return OverloadExprBits.NumResults; }
3235
3236 /// Gets the full name info.
3237 const DeclarationNameInfo &getNameInfo() const { return NameInfo; }
3238
3239 /// Gets the name looked up.
3240 DeclarationName getName() const { return NameInfo.getName(); }
3241
3242 /// Gets the location of the name.
3243 SourceLocation getNameLoc() const { return NameInfo.getLoc(); }
3244
3245 /// Fetches the nested-name qualifier, if one was given.
3247 return QualifierLoc.getNestedNameSpecifier();
3248 }
3249
3250 /// Fetches the nested-name qualifier with source-location
3251 /// information, if one was given.
3252 NestedNameSpecifierLoc getQualifierLoc() const { return QualifierLoc; }
3253
3254 /// Retrieve the location of the template keyword preceding
3255 /// this name, if any.
3261
3262 /// Retrieve the location of the left angle bracket starting the
3263 /// explicit template argument list following the name, if any.
3269
3270 /// Retrieve the location of the right angle bracket ending the
3271 /// explicit template argument list following the name, if any.
3277
3278 /// Determines whether the name was preceded by the template keyword.
3280
3281 /// Determines whether this expression had explicit template arguments.
3284 return false;
3285 // FIXME: deduced function types can have "hidden" args and no <
3286 // investigate that further, but ultimately maybe we want to model concepts
3287 // reference with another kind of expression.
3290 : getLAngleLoc().isValid();
3291 }
3292
3293 bool isConceptReference() const {
3294 return getNumDecls() == 1 && [&]() {
3295 if (auto *TTP = dyn_cast_or_null<TemplateTemplateParmDecl>(
3296 getTrailingResults()->getDecl()))
3297 return TTP->templateParameterKind() == TNK_Concept_template;
3298 if (isa<ConceptDecl>(getTrailingResults()->getDecl()))
3299 return true;
3300 return false;
3301 }();
3302 }
3303
3304 bool isVarDeclReference() const {
3305 return getNumDecls() == 1 && [&]() {
3306 if (auto *TTP = dyn_cast_or_null<TemplateTemplateParmDecl>(
3307 getTrailingResults()->getDecl()))
3308 return TTP->templateParameterKind() == TNK_Var_template;
3309 if (isa<VarTemplateDecl>(getTrailingResults()->getDecl()))
3310 return true;
3311 return false;
3312 }();
3313 }
3314
3316 assert(getNumDecls() == 1);
3317 return dyn_cast_or_null<TemplateDecl>(getTrailingResults()->getDecl());
3318 }
3319
3321 assert(getNumDecls() == 1);
3322 return dyn_cast_or_null<TemplateTemplateParmDecl>(
3323 getTrailingResults()->getDecl());
3324 }
3325
3328 return nullptr;
3329 return const_cast<OverloadExpr *>(this)->getTrailingTemplateArgumentLoc();
3330 }
3331
3332 unsigned getNumTemplateArgs() const {
3334 return 0;
3335
3337 }
3338
3342
3343 /// Copies the template arguments into the given structure.
3348
3349 static bool classof(const Stmt *T) {
3350 return T->getStmtClass() == UnresolvedLookupExprClass ||
3351 T->getStmtClass() == UnresolvedMemberExprClass;
3352 }
3353};
3354
3355/// A reference to a name which we were able to look up during
3356/// parsing but could not resolve to a specific declaration.
3357///
3358/// This arises in several ways:
3359/// * we might be waiting for argument-dependent lookup;
3360/// * the name might resolve to an overloaded function;
3361/// * the name might resolve to a non-function template; for example, in the
3362/// following snippet, the return expression of the member function
3363/// 'foo()' might remain unresolved until instantiation:
3364///
3365/// \code
3366/// struct P {
3367/// template <class T> using I = T;
3368/// };
3369///
3370/// struct Q {
3371/// template <class T> int foo() {
3372/// return T::template I<int>;
3373/// }
3374/// };
3375/// \endcode
3376///
3377/// ...which is distinct from modeling function overloads, and therefore we use
3378/// a different builtin type 'UnresolvedTemplate' to avoid confusion. This is
3379/// done in Sema::BuildTemplateIdExpr.
3380///
3381/// and eventually:
3382/// * the lookup might have included a function template.
3383/// * the unresolved template gets transformed in an instantiation or gets
3384/// diagnosed for its direct use.
3385///
3386/// These never include UnresolvedUsingValueDecls, which are always class
3387/// members and therefore appear only in UnresolvedMemberLookupExprs.
3388class UnresolvedLookupExpr final
3389 : public OverloadExpr,
3390 private llvm::TrailingObjects<UnresolvedLookupExpr, DeclAccessPair,
3391 ASTTemplateKWAndArgsInfo,
3392 TemplateArgumentLoc> {
3393 friend class ASTStmtReader;
3394 friend class OverloadExpr;
3395 friend TrailingObjects;
3396
3397 /// The naming class (C++ [class.access.base]p5) of the lookup, if
3398 /// any. This can generally be recalculated from the context chain,
3399 /// but that can be fairly expensive for unqualified lookups.
3400 CXXRecordDecl *NamingClass;
3401
3402 // UnresolvedLookupExpr is followed by several trailing objects.
3403 // They are in order:
3404 //
3405 // * An array of getNumResults() DeclAccessPair for the results. These are
3406 // undesugared, which is to say, they may include UsingShadowDecls.
3407 // Access is relative to the naming class.
3408 //
3409 // * An optional ASTTemplateKWAndArgsInfo for the explicitly specified
3410 // template keyword and arguments. Present if and only if
3411 // hasTemplateKWAndArgsInfo().
3412 //
3413 // * An array of getNumTemplateArgs() TemplateArgumentLoc containing
3414 // location information for the explicitly specified template arguments.
3415
3416 UnresolvedLookupExpr(const ASTContext &Context, CXXRecordDecl *NamingClass,
3417 NestedNameSpecifierLoc QualifierLoc,
3418 SourceLocation TemplateKWLoc,
3419 const DeclarationNameInfo &NameInfo, bool RequiresADL,
3420 const TemplateArgumentListInfo *TemplateArgs,
3422 bool KnownDependent, bool KnownInstantiationDependent);
3423
3424 UnresolvedLookupExpr(EmptyShell Empty, unsigned NumResults,
3425 bool HasTemplateKWAndArgsInfo);
3426
3427 unsigned numTrailingObjects(OverloadToken<DeclAccessPair>) const {
3428 return getNumDecls();
3429 }
3430
3431 unsigned numTrailingObjects(OverloadToken<ASTTemplateKWAndArgsInfo>) const {
3432 return hasTemplateKWAndArgsInfo();
3433 }
3434
3435public:
3436 static UnresolvedLookupExpr *
3437 Create(const ASTContext &Context, CXXRecordDecl *NamingClass,
3438 NestedNameSpecifierLoc QualifierLoc,
3439 const DeclarationNameInfo &NameInfo, bool RequiresADL,
3440 UnresolvedSetIterator Begin, UnresolvedSetIterator End,
3441 bool KnownDependent, bool KnownInstantiationDependent);
3442
3443 // After canonicalization, there may be dependent template arguments in
3444 // CanonicalConverted But none of Args is dependent. When any of
3445 // CanonicalConverted dependent, KnownDependent is true.
3446 static UnresolvedLookupExpr *
3447 Create(const ASTContext &Context, CXXRecordDecl *NamingClass,
3448 NestedNameSpecifierLoc QualifierLoc, SourceLocation TemplateKWLoc,
3449 const DeclarationNameInfo &NameInfo, bool RequiresADL,
3450 const TemplateArgumentListInfo *Args, UnresolvedSetIterator Begin,
3451 UnresolvedSetIterator End, bool KnownDependent,
3452 bool KnownInstantiationDependent);
3453
3454 static UnresolvedLookupExpr *CreateEmpty(const ASTContext &Context,
3455 unsigned NumResults,
3456 bool HasTemplateKWAndArgsInfo,
3457 unsigned NumTemplateArgs);
3458
3459 /// True if this declaration should be extended by
3460 /// argument-dependent lookup.
3461 bool requiresADL() const { return UnresolvedLookupExprBits.RequiresADL; }
3462
3463 /// Gets the 'naming class' (in the sense of C++0x
3464 /// [class.access.base]p5) of the lookup. This is the scope
3465 /// that was looked in to find these results.
3466 CXXRecordDecl *getNamingClass() { return NamingClass; }
3467 const CXXRecordDecl *getNamingClass() const { return NamingClass; }
3468
3469 SourceLocation getBeginLoc() const LLVM_READONLY {
3471 return l.getBeginLoc();
3472 return getNameInfo().getBeginLoc();
3473 }
3474
3475 SourceLocation getEndLoc() const LLVM_READONLY {
3477 return getRAngleLoc();
3478 return getNameInfo().getEndLoc();
3479 }
3480
3484
3488
3489 static bool classof(const Stmt *T) {
3490 return T->getStmtClass() == UnresolvedLookupExprClass;
3491 }
3492};
3493
3494/// A qualified reference to a name whose declaration cannot
3495/// yet be resolved.
3496///
3497/// DependentScopeDeclRefExpr is similar to DeclRefExpr in that
3498/// it expresses a reference to a declaration such as
3499/// X<T>::value. The difference, however, is that an
3500/// DependentScopeDeclRefExpr node is used only within C++ templates when
3501/// the qualification (e.g., X<T>::) refers to a dependent type. In
3502/// this case, X<T>::value cannot resolve to a declaration because the
3503/// declaration will differ from one instantiation of X<T> to the
3504/// next. Therefore, DependentScopeDeclRefExpr keeps track of the
3505/// qualifier (X<T>::) and the name of the entity being referenced
3506/// ("value"). Such expressions will instantiate to a DeclRefExpr once the
3507/// declaration can be found.
3508class DependentScopeDeclRefExpr final
3509 : public Expr,
3510 private llvm::TrailingObjects<DependentScopeDeclRefExpr,
3511 ASTTemplateKWAndArgsInfo,
3512 TemplateArgumentLoc> {
3513 friend class ASTStmtReader;
3514 friend class ASTStmtWriter;
3515 friend TrailingObjects;
3516
3517 /// The nested-name-specifier that qualifies this unresolved
3518 /// declaration name.
3519 NestedNameSpecifierLoc QualifierLoc;
3520
3521 /// The name of the entity we will be referencing.
3522 DeclarationNameInfo NameInfo;
3523
3524 DependentScopeDeclRefExpr(QualType Ty, NestedNameSpecifierLoc QualifierLoc,
3525 SourceLocation TemplateKWLoc,
3526 const DeclarationNameInfo &NameInfo,
3527 const TemplateArgumentListInfo *Args);
3528
3529 size_t numTrailingObjects(OverloadToken<ASTTemplateKWAndArgsInfo>) const {
3530 return hasTemplateKWAndArgsInfo();
3531 }
3532
3533 bool hasTemplateKWAndArgsInfo() const {
3534 return DependentScopeDeclRefExprBits.HasTemplateKWAndArgsInfo;
3535 }
3536
3537public:
3538 static DependentScopeDeclRefExpr *
3539 Create(const ASTContext &Context, NestedNameSpecifierLoc QualifierLoc,
3540 SourceLocation TemplateKWLoc, const DeclarationNameInfo &NameInfo,
3541 const TemplateArgumentListInfo *TemplateArgs);
3542
3543 static DependentScopeDeclRefExpr *CreateEmpty(const ASTContext &Context,
3544 bool HasTemplateKWAndArgsInfo,
3545 unsigned NumTemplateArgs);
3546
3547 /// Retrieve the name that this expression refers to.
3548 const DeclarationNameInfo &getNameInfo() const { return NameInfo; }
3549
3550 /// Retrieve the name that this expression refers to.
3551 DeclarationName getDeclName() const { return NameInfo.getName(); }
3552
3553 /// Retrieve the location of the name within the expression.
3554 ///
3555 /// For example, in "X<T>::value" this is the location of "value".
3556 SourceLocation getLocation() const { return NameInfo.getLoc(); }
3557
3558 /// Retrieve the nested-name-specifier that qualifies the
3559 /// name, with source location information.
3560 NestedNameSpecifierLoc getQualifierLoc() const { return QualifierLoc; }
3561
3562 /// Retrieve the nested-name-specifier that qualifies this
3563 /// declaration.
3565 return QualifierLoc.getNestedNameSpecifier();
3566 }
3567
3568 /// Retrieve the location of the template keyword preceding
3569 /// this name, if any.
3571 if (!hasTemplateKWAndArgsInfo())
3572 return SourceLocation();
3573 return getTrailingObjects<ASTTemplateKWAndArgsInfo>()->TemplateKWLoc;
3574 }
3575
3576 /// Retrieve the location of the left angle bracket starting the
3577 /// explicit template argument list following the name, if any.
3579 if (!hasTemplateKWAndArgsInfo())
3580 return SourceLocation();
3581 return getTrailingObjects<ASTTemplateKWAndArgsInfo>()->LAngleLoc;
3582 }
3583
3584 /// Retrieve the location of the right angle bracket ending the
3585 /// explicit template argument list following the name, if any.
3587 if (!hasTemplateKWAndArgsInfo())
3588 return SourceLocation();
3589 return getTrailingObjects<ASTTemplateKWAndArgsInfo>()->RAngleLoc;
3590 }
3591
3592 /// Determines whether the name was preceded by the template keyword.
3594
3595 /// Determines whether this lookup had explicit template arguments.
3596 bool hasExplicitTemplateArgs() const { return getLAngleLoc().isValid(); }
3597
3598 /// Copies the template arguments (if present) into the given
3599 /// structure.
3602 getTrailingObjects<ASTTemplateKWAndArgsInfo>()->copyInto(
3603 getTrailingObjects<TemplateArgumentLoc>(), List);
3604 }
3605
3608 return nullptr;
3609
3610 return getTrailingObjects<TemplateArgumentLoc>();
3611 }
3612
3613 unsigned getNumTemplateArgs() const {
3615 return 0;
3616
3617 return getTrailingObjects<ASTTemplateKWAndArgsInfo>()->NumTemplateArgs;
3618 }
3619
3623
3624 /// Note: getBeginLoc() is the start of the whole DependentScopeDeclRefExpr,
3625 /// and differs from getLocation().getStart().
3626 SourceLocation getBeginLoc() const LLVM_READONLY {
3627 return QualifierLoc.getBeginLoc();
3628 }
3629
3630 SourceLocation getEndLoc() const LLVM_READONLY {
3632 return getRAngleLoc();
3633 return getLocation();
3634 }
3635
3636 static bool classof(const Stmt *T) {
3637 return T->getStmtClass() == DependentScopeDeclRefExprClass;
3638 }
3639
3643
3647};
3648
3649/// Represents an expression -- generally a full-expression -- that
3650/// introduces cleanups to be run at the end of the sub-expression's
3651/// evaluation. The most common source of expression-introduced
3652/// cleanups is temporary objects in C++, but several other kinds of
3653/// expressions can create cleanups, including basically every
3654/// call in ARC that returns an Objective-C pointer.
3655///
3656/// This expression also tracks whether the sub-expression contains a
3657/// potentially-evaluated block literal. The lifetime of a block
3658/// literal is the extent of the enclosing scope.
3659class ExprWithCleanups final
3660 : public FullExpr,
3661 private llvm::TrailingObjects<
3662 ExprWithCleanups,
3663 llvm::PointerUnion<BlockDecl *, CompoundLiteralExpr *>> {
3664public:
3665 /// The type of objects that are kept in the cleanup.
3666 /// It's useful to remember the set of blocks and block-scoped compound
3667 /// literals; we could also remember the set of temporaries, but there's
3668 /// currently no need.
3669 using CleanupObject = llvm::PointerUnion<BlockDecl *, CompoundLiteralExpr *>;
3670
3671private:
3672 friend class ASTStmtReader;
3673 friend TrailingObjects;
3674
3675 ExprWithCleanups(EmptyShell, unsigned NumObjects);
3676 ExprWithCleanups(Expr *SubExpr, bool CleanupsHaveSideEffects,
3677 ArrayRef<CleanupObject> Objects);
3678
3679public:
3680 static ExprWithCleanups *Create(const ASTContext &C, EmptyShell empty,
3681 unsigned numObjects);
3682
3683 static ExprWithCleanups *Create(const ASTContext &C, Expr *subexpr,
3684 bool CleanupsHaveSideEffects,
3685 ArrayRef<CleanupObject> objects);
3686
3688 return getTrailingObjects(getNumObjects());
3689 }
3690
3691 unsigned getNumObjects() const { return ExprWithCleanupsBits.NumObjects; }
3692
3693 CleanupObject getObject(unsigned i) const {
3694 assert(i < getNumObjects() && "Index out of range");
3695 return getObjects()[i];
3696 }
3697
3699 return ExprWithCleanupsBits.CleanupsHaveSideEffects;
3700 }
3701
3702 SourceLocation getBeginLoc() const LLVM_READONLY {
3703 return SubExpr->getBeginLoc();
3704 }
3705
3706 SourceLocation getEndLoc() const LLVM_READONLY {
3707 return SubExpr->getEndLoc();
3708 }
3709
3710 // Implement isa/cast/dyncast/etc.
3711 static bool classof(const Stmt *T) {
3712 return T->getStmtClass() == ExprWithCleanupsClass;
3713 }
3714
3715 // Iterators
3717
3719 return const_child_range(&SubExpr, &SubExpr + 1);
3720 }
3721};
3722
3723/// Describes an explicit type conversion that uses functional
3724/// notion but could not be resolved because one or more arguments are
3725/// type-dependent.
3726///
3727/// The explicit type conversions expressed by
3728/// CXXUnresolvedConstructExpr have the form <tt>T(a1, a2, ..., aN)</tt>,
3729/// where \c T is some type and \c a1, \c a2, ..., \c aN are values, and
3730/// either \c T is a dependent type or one or more of the <tt>a</tt>'s is
3731/// type-dependent. For example, this would occur in a template such
3732/// as:
3733///
3734/// \code
3735/// template<typename T, typename A1>
3736/// inline T make_a(const A1& a1) {
3737/// return T(a1);
3738/// }
3739/// \endcode
3740///
3741/// When the returned expression is instantiated, it may resolve to a
3742/// constructor call, conversion function call, or some kind of type
3743/// conversion.
3744class CXXUnresolvedConstructExpr final
3745 : public Expr,
3746 private llvm::TrailingObjects<CXXUnresolvedConstructExpr, Expr *> {
3747 friend class ASTStmtReader;
3748 friend TrailingObjects;
3749
3750 /// The type being constructed, and whether the construct expression models
3751 /// list initialization or not.
3752 llvm::PointerIntPair<TypeSourceInfo *, 1> TypeAndInitForm;
3753
3754 /// The location of the left parentheses ('(').
3755 SourceLocation LParenLoc;
3756
3757 /// The location of the right parentheses (')').
3758 SourceLocation RParenLoc;
3759
3760 CXXUnresolvedConstructExpr(QualType T, TypeSourceInfo *TSI,
3761 SourceLocation LParenLoc, ArrayRef<Expr *> Args,
3762 SourceLocation RParenLoc, bool IsListInit);
3763
3764 CXXUnresolvedConstructExpr(EmptyShell Empty, unsigned NumArgs)
3765 : Expr(CXXUnresolvedConstructExprClass, Empty) {
3766 CXXUnresolvedConstructExprBits.NumArgs = NumArgs;
3767 }
3768
3769public:
3771 Create(const ASTContext &Context, QualType T, TypeSourceInfo *TSI,
3772 SourceLocation LParenLoc, ArrayRef<Expr *> Args,
3773 SourceLocation RParenLoc, bool IsListInit);
3774
3775 static CXXUnresolvedConstructExpr *CreateEmpty(const ASTContext &Context,
3776 unsigned NumArgs);
3777
3778 /// Retrieve the type that is being constructed, as specified
3779 /// in the source code.
3781
3782 /// Retrieve the type source information for the type being
3783 /// constructed.
3785 return TypeAndInitForm.getPointer();
3786 }
3787
3788 /// Retrieve the location of the left parentheses ('(') that
3789 /// precedes the argument list.
3790 SourceLocation getLParenLoc() const { return LParenLoc; }
3791 void setLParenLoc(SourceLocation L) { LParenLoc = L; }
3792
3793 /// Retrieve the location of the right parentheses (')') that
3794 /// follows the argument list.
3795 SourceLocation getRParenLoc() const { return RParenLoc; }
3796 void setRParenLoc(SourceLocation L) { RParenLoc = L; }
3797
3798 /// Determine whether this expression models list-initialization.
3799 /// If so, there will be exactly one subexpression, which will be
3800 /// an InitListExpr.
3801 bool isListInitialization() const { return TypeAndInitForm.getInt(); }
3802
3803 /// Retrieve the number of arguments.
3804 unsigned getNumArgs() const { return CXXUnresolvedConstructExprBits.NumArgs; }
3805
3806 using arg_iterator = Expr **;
3807 using arg_range = llvm::iterator_range<arg_iterator>;
3808
3809 arg_iterator arg_begin() { return getTrailingObjects(); }
3812
3813 using const_arg_iterator = const Expr* const *;
3814 using const_arg_range = llvm::iterator_range<const_arg_iterator>;
3815
3816 const_arg_iterator arg_begin() const { return getTrailingObjects(); }
3819 return const_arg_range(arg_begin(), arg_end());
3820 }
3821
3822 Expr *getArg(unsigned I) {
3823 assert(I < getNumArgs() && "Argument index out-of-range");
3824 return arg_begin()[I];
3825 }
3826
3827 const Expr *getArg(unsigned I) const {
3828 assert(I < getNumArgs() && "Argument index out-of-range");
3829 return arg_begin()[I];
3830 }
3831
3832 void setArg(unsigned I, Expr *E) {
3833 assert(I < getNumArgs() && "Argument index out-of-range");
3834 arg_begin()[I] = E;
3835 }
3836
3837 SourceLocation getBeginLoc() const LLVM_READONLY;
3838 SourceLocation getEndLoc() const LLVM_READONLY {
3839 if (!RParenLoc.isValid() && getNumArgs() > 0)
3840 return getArg(getNumArgs() - 1)->getEndLoc();
3841 return RParenLoc;
3842 }
3843
3844 static bool classof(const Stmt *T) {
3845 return T->getStmtClass() == CXXUnresolvedConstructExprClass;
3846 }
3847
3848 // Iterators
3850 auto **begin = reinterpret_cast<Stmt **>(arg_begin());
3851 return child_range(begin, begin + getNumArgs());
3852 }
3853
3855 auto **begin = reinterpret_cast<Stmt **>(
3856 const_cast<CXXUnresolvedConstructExpr *>(this)->arg_begin());
3857 return const_child_range(begin, begin + getNumArgs());
3858 }
3859};
3860
3861/// Represents a C++ member access expression where the actual
3862/// member referenced could not be resolved because the base
3863/// expression or the member name was dependent.
3864///
3865/// Like UnresolvedMemberExprs, these can be either implicit or
3866/// explicit accesses. It is only possible to get one of these with
3867/// an implicit access if a qualifier is provided.
3868class CXXDependentScopeMemberExpr final
3869 : public Expr,
3870 private llvm::TrailingObjects<CXXDependentScopeMemberExpr,
3871 ASTTemplateKWAndArgsInfo,
3872 TemplateArgumentLoc, NamedDecl *> {
3873 friend class ASTStmtReader;
3874 friend class ASTStmtWriter;
3875 friend TrailingObjects;
3876
3877 /// The expression for the base pointer or class reference,
3878 /// e.g., the \c x in x.f. Can be null in implicit accesses.
3879 Stmt *Base;
3880
3881 /// The type of the base expression. Never null, even for
3882 /// implicit accesses.
3883 QualType BaseType;
3884
3885 /// The nested-name-specifier that precedes the member name, if any.
3886 /// FIXME: This could be in principle store as a trailing object.
3887 /// However the performance impact of doing so should be investigated first.
3888 NestedNameSpecifierLoc QualifierLoc;
3889
3890 /// The member to which this member expression refers, which
3891 /// can be name, overloaded operator, or destructor.
3892 ///
3893 /// FIXME: could also be a template-id
3894 DeclarationNameInfo MemberNameInfo;
3895
3896 // CXXDependentScopeMemberExpr is followed by several trailing objects,
3897 // some of which optional. They are in order:
3898 //
3899 // * An optional ASTTemplateKWAndArgsInfo for the explicitly specified
3900 // template keyword and arguments. Present if and only if
3901 // hasTemplateKWAndArgsInfo().
3902 //
3903 // * An array of getNumTemplateArgs() TemplateArgumentLoc containing location
3904 // information for the explicitly specified template arguments.
3905 //
3906 // * An optional NamedDecl *. In a qualified member access expression such
3907 // as t->Base::f, this member stores the resolves of name lookup in the
3908 // context of the member access expression, to be used at instantiation
3909 // time. Present if and only if hasFirstQualifierFoundInScope().
3910
3911 bool hasTemplateKWAndArgsInfo() const {
3912 return CXXDependentScopeMemberExprBits.HasTemplateKWAndArgsInfo;
3913 }
3914
3915 bool hasFirstQualifierFoundInScope() const {
3916 return CXXDependentScopeMemberExprBits.HasFirstQualifierFoundInScope;
3917 }
3918
3919 unsigned numTrailingObjects(OverloadToken<ASTTemplateKWAndArgsInfo>) const {
3920 return hasTemplateKWAndArgsInfo();
3921 }
3922
3923 unsigned numTrailingObjects(OverloadToken<TemplateArgumentLoc>) const {
3924 return getNumTemplateArgs();
3925 }
3926
3927 CXXDependentScopeMemberExpr(const ASTContext &Ctx, Expr *Base,
3928 QualType BaseType, bool IsArrow,
3929 SourceLocation OperatorLoc,
3930 NestedNameSpecifierLoc QualifierLoc,
3931 SourceLocation TemplateKWLoc,
3932 NamedDecl *FirstQualifierFoundInScope,
3933 DeclarationNameInfo MemberNameInfo,
3934 const TemplateArgumentListInfo *TemplateArgs);
3935
3936 CXXDependentScopeMemberExpr(EmptyShell Empty, bool HasTemplateKWAndArgsInfo,
3937 bool HasFirstQualifierFoundInScope);
3938
3939public:
3940 static CXXDependentScopeMemberExpr *
3941 Create(const ASTContext &Ctx, Expr *Base, QualType BaseType, bool IsArrow,
3942 SourceLocation OperatorLoc, NestedNameSpecifierLoc QualifierLoc,
3943 SourceLocation TemplateKWLoc, NamedDecl *FirstQualifierFoundInScope,
3944 DeclarationNameInfo MemberNameInfo,
3945 const TemplateArgumentListInfo *TemplateArgs);
3946
3947 static CXXDependentScopeMemberExpr *
3948 CreateEmpty(const ASTContext &Ctx, bool HasTemplateKWAndArgsInfo,
3949 unsigned NumTemplateArgs, bool HasFirstQualifierFoundInScope);
3950
3951 /// True if this is an implicit access, i.e. one in which the
3952 /// member being accessed was not written in the source. The source
3953 /// location of the operator is invalid in this case.
3954 bool isImplicitAccess() const {
3955 if (!Base)
3956 return true;
3957 return cast<Expr>(Base)->isImplicitCXXThis();
3958 }
3959
3960 /// Retrieve the base object of this member expressions,
3961 /// e.g., the \c x in \c x.m.
3962 Expr *getBase() const {
3963 assert(!isImplicitAccess());
3964 return cast<Expr>(Base);
3965 }
3966
3967 QualType getBaseType() const { return BaseType; }
3968
3969 /// Determine whether this member expression used the '->'
3970 /// operator; otherwise, it used the '.' operator.
3971 bool isArrow() const { return CXXDependentScopeMemberExprBits.IsArrow; }
3972
3973 /// Retrieve the location of the '->' or '.' operator.
3975 return CXXDependentScopeMemberExprBits.OperatorLoc;
3976 }
3977
3978 /// Retrieve the nested-name-specifier that qualifies the member name.
3980 return QualifierLoc.getNestedNameSpecifier();
3981 }
3982
3983 /// Retrieve the nested-name-specifier that qualifies the member
3984 /// name, with source location information.
3985 NestedNameSpecifierLoc getQualifierLoc() const { return QualifierLoc; }
3986
3987 /// Retrieve the first part of the nested-name-specifier that was
3988 /// found in the scope of the member access expression when the member access
3989 /// was initially parsed.
3990 ///
3991 /// This function only returns a useful result when member access expression
3992 /// uses a qualified member name, e.g., "x.Base::f". Here, the declaration
3993 /// returned by this function describes what was found by unqualified name
3994 /// lookup for the identifier "Base" within the scope of the member access
3995 /// expression itself. At template instantiation time, this information is
3996 /// combined with the results of name lookup into the type of the object
3997 /// expression itself (the class type of x).
3999 if (!hasFirstQualifierFoundInScope())
4000 return nullptr;
4001 return *getTrailingObjects<NamedDecl *>();
4002 }
4003
4004 /// Retrieve the name of the member that this expression refers to.
4006 return MemberNameInfo;
4007 }
4008
4009 /// Retrieve the name of the member that this expression refers to.
4010 DeclarationName getMember() const { return MemberNameInfo.getName(); }
4011
4012 // Retrieve the location of the name of the member that this
4013 // expression refers to.
4014 SourceLocation getMemberLoc() const { return MemberNameInfo.getLoc(); }
4015
4016 /// Retrieve the location of the template keyword preceding the
4017 /// member name, if any.
4019 if (!hasTemplateKWAndArgsInfo())
4020 return SourceLocation();
4021 return getTrailingObjects<ASTTemplateKWAndArgsInfo>()->TemplateKWLoc;
4022 }
4023
4024 /// Retrieve the location of the left angle bracket starting the
4025 /// explicit template argument list following the member name, if any.
4027 if (!hasTemplateKWAndArgsInfo())
4028 return SourceLocation();
4029 return getTrailingObjects<ASTTemplateKWAndArgsInfo>()->LAngleLoc;
4030 }
4031
4032 /// Retrieve the location of the right angle bracket ending the
4033 /// explicit template argument list following the member name, if any.
4035 if (!hasTemplateKWAndArgsInfo())
4036 return SourceLocation();
4037 return getTrailingObjects<ASTTemplateKWAndArgsInfo>()->RAngleLoc;
4038 }
4039
4040 /// Determines whether the member name was preceded by the template keyword.
4042
4043 /// Determines whether this member expression actually had a C++
4044 /// template argument list explicitly specified, e.g., x.f<int>.
4045 bool hasExplicitTemplateArgs() const { return getLAngleLoc().isValid(); }
4046
4047 /// Copies the template arguments (if present) into the given
4048 /// structure.
4051 getTrailingObjects<ASTTemplateKWAndArgsInfo>()->copyInto(
4052 getTrailingObjects<TemplateArgumentLoc>(), List);
4053 }
4054
4055 /// Retrieve the template arguments provided as part of this
4056 /// template-id.
4059 return nullptr;
4060
4061 return getTrailingObjects<TemplateArgumentLoc>();
4062 }
4063
4064 /// Retrieve the number of template arguments provided as part of this
4065 /// template-id.
4066 unsigned getNumTemplateArgs() const {
4068 return 0;
4069
4070 return getTrailingObjects<ASTTemplateKWAndArgsInfo>()->NumTemplateArgs;
4071 }
4072
4076
4077 SourceLocation getBeginLoc() const LLVM_READONLY {
4078 if (!isImplicitAccess())
4079 return Base->getBeginLoc();
4080 if (getQualifier())
4081 return getQualifierLoc().getBeginLoc();
4082 return MemberNameInfo.getBeginLoc();
4083 }
4084
4085 SourceLocation getEndLoc() const LLVM_READONLY {
4087 return getRAngleLoc();
4088 return MemberNameInfo.getEndLoc();
4089 }
4090
4091 static bool classof(const Stmt *T) {
4092 return T->getStmtClass() == CXXDependentScopeMemberExprClass;
4093 }
4094
4095 // Iterators
4097 if (isImplicitAccess())
4099 return child_range(&Base, &Base + 1);
4100 }
4101
4103 if (isImplicitAccess())
4105 return const_child_range(&Base, &Base + 1);
4106 }
4107};
4108
4109/// Represents a C++ member access expression for which lookup
4110/// produced a set of overloaded functions.
4111///
4112/// The member access may be explicit or implicit:
4113/// \code
4114/// struct A {
4115/// int a, b;
4116/// int explicitAccess() { return this->a + this->A::b; }
4117/// int implicitAccess() { return a + A::b; }
4118/// };
4119/// \endcode
4120///
4121/// In the final AST, an explicit access always becomes a MemberExpr.
4122/// An implicit access may become either a MemberExpr or a
4123/// DeclRefExpr, depending on whether the member is static.
4124class UnresolvedMemberExpr final
4125 : public OverloadExpr,
4126 private llvm::TrailingObjects<UnresolvedMemberExpr, DeclAccessPair,
4127 ASTTemplateKWAndArgsInfo,
4128 TemplateArgumentLoc> {
4129 friend class ASTStmtReader;
4130 friend class OverloadExpr;
4131 friend TrailingObjects;
4132
4133 /// The expression for the base pointer or class reference,
4134 /// e.g., the \c x in x.f.
4135 ///
4136 /// This can be null if this is an 'unbased' member expression.
4137 Stmt *Base;
4138
4139 /// The type of the base expression; never null.
4140 QualType BaseType;
4141
4142 /// The location of the '->' or '.' operator.
4143 SourceLocation OperatorLoc;
4144
4145 // UnresolvedMemberExpr is followed by several trailing objects.
4146 // They are in order:
4147 //
4148 // * An array of getNumResults() DeclAccessPair for the results. These are
4149 // undesugared, which is to say, they may include UsingShadowDecls.
4150 // Access is relative to the naming class.
4151 //
4152 // * An optional ASTTemplateKWAndArgsInfo for the explicitly specified
4153 // template keyword and arguments. Present if and only if
4154 // hasTemplateKWAndArgsInfo().
4155 //
4156 // * An array of getNumTemplateArgs() TemplateArgumentLoc containing
4157 // location information for the explicitly specified template arguments.
4158
4159 UnresolvedMemberExpr(const ASTContext &Context, bool HasUnresolvedUsing,
4160 Expr *Base, QualType BaseType, bool IsArrow,
4161 SourceLocation OperatorLoc,
4162 NestedNameSpecifierLoc QualifierLoc,
4163 SourceLocation TemplateKWLoc,
4164 const DeclarationNameInfo &MemberNameInfo,
4165 const TemplateArgumentListInfo *TemplateArgs,
4167
4168 UnresolvedMemberExpr(EmptyShell Empty, unsigned NumResults,
4169 bool HasTemplateKWAndArgsInfo);
4170
4171 unsigned numTrailingObjects(OverloadToken<DeclAccessPair>) const {
4172 return getNumDecls();
4173 }
4174
4175 unsigned numTrailingObjects(OverloadToken<ASTTemplateKWAndArgsInfo>) const {
4176 return hasTemplateKWAndArgsInfo();
4177 }
4178
4179public:
4180 static UnresolvedMemberExpr *
4181 Create(const ASTContext &Context, bool HasUnresolvedUsing, Expr *Base,
4182 QualType BaseType, bool IsArrow, SourceLocation OperatorLoc,
4183 NestedNameSpecifierLoc QualifierLoc, SourceLocation TemplateKWLoc,
4184 const DeclarationNameInfo &MemberNameInfo,
4185 const TemplateArgumentListInfo *TemplateArgs,
4186 UnresolvedSetIterator Begin, UnresolvedSetIterator End);
4187
4188 static UnresolvedMemberExpr *CreateEmpty(const ASTContext &Context,
4189 unsigned NumResults,
4190 bool HasTemplateKWAndArgsInfo,
4191 unsigned NumTemplateArgs);
4192
4193 /// True if this is an implicit access, i.e., one in which the
4194 /// member being accessed was not written in the source.
4195 ///
4196 /// The source location of the operator is invalid in this case.
4197 bool isImplicitAccess() const;
4198
4199 /// Retrieve the base object of this member expressions,
4200 /// e.g., the \c x in \c x.m.
4202 assert(!isImplicitAccess());
4203 return cast<Expr>(Base);
4204 }
4205 const Expr *getBase() const {
4206 assert(!isImplicitAccess());
4207 return cast<Expr>(Base);
4208 }
4209
4210 QualType getBaseType() const { return BaseType; }
4211
4212 /// Determine whether the lookup results contain an unresolved using
4213 /// declaration.
4214 bool hasUnresolvedUsing() const {
4215 return UnresolvedMemberExprBits.HasUnresolvedUsing;
4216 }
4217
4218 /// Determine whether this member expression used the '->'
4219 /// operator; otherwise, it used the '.' operator.
4220 bool isArrow() const { return UnresolvedMemberExprBits.IsArrow; }
4221
4222 /// Retrieve the location of the '->' or '.' operator.
4223 SourceLocation getOperatorLoc() const { return OperatorLoc; }
4224
4225 /// Retrieve the naming class of this lookup.
4228 return const_cast<UnresolvedMemberExpr *>(this)->getNamingClass();
4229 }
4230
4231 /// Retrieve the full name info for the member that this expression
4232 /// refers to.
4234
4235 /// Retrieve the name of the member that this expression refers to.
4237
4238 /// Retrieve the location of the name of the member that this
4239 /// expression refers to.
4241
4242 /// Return the preferred location (the member name) for the arrow when
4243 /// diagnosing a problem with this expression.
4244 SourceLocation getExprLoc() const LLVM_READONLY { return getMemberLoc(); }
4245
4246 SourceLocation getBeginLoc() const LLVM_READONLY {
4247 if (!isImplicitAccess())
4248 return Base->getBeginLoc();
4250 return l.getBeginLoc();
4251 return getMemberNameInfo().getBeginLoc();
4252 }
4253
4254 SourceLocation getEndLoc() const LLVM_READONLY {
4256 return getRAngleLoc();
4257 return getMemberNameInfo().getEndLoc();
4258 }
4259
4260 static bool classof(const Stmt *T) {
4261 return T->getStmtClass() == UnresolvedMemberExprClass;
4262 }
4263
4264 // Iterators
4266 if (isImplicitAccess())
4268 return child_range(&Base, &Base + 1);
4269 }
4270
4272 if (isImplicitAccess())
4274 return const_child_range(&Base, &Base + 1);
4275 }
4276};
4277
4279 if (auto *ULE = dyn_cast<UnresolvedLookupExpr>(this))
4280 return ULE->getTrailingObjects<DeclAccessPair>();
4281 return cast<UnresolvedMemberExpr>(this)->getTrailingObjects<DeclAccessPair>();
4282}
4283
4286 return nullptr;
4287
4288 if (auto *ULE = dyn_cast<UnresolvedLookupExpr>(this))
4289 return ULE->getTrailingObjects<ASTTemplateKWAndArgsInfo>();
4290 return cast<UnresolvedMemberExpr>(this)
4291 ->getTrailingObjects<ASTTemplateKWAndArgsInfo>();
4292}
4293
4295 if (auto *ULE = dyn_cast<UnresolvedLookupExpr>(this))
4296 return ULE->getTrailingObjects<TemplateArgumentLoc>();
4297 return cast<UnresolvedMemberExpr>(this)
4298 ->getTrailingObjects<TemplateArgumentLoc>();
4299}
4300
4302 if (auto *ULE = dyn_cast<UnresolvedLookupExpr>(this))
4303 return ULE->getNamingClass();
4304 return cast<UnresolvedMemberExpr>(this)->getNamingClass();
4305}
4306
4307/// Represents a C++11 noexcept expression (C++ [expr.unary.noexcept]).
4308///
4309/// The noexcept expression tests whether a given expression might throw. Its
4310/// result is a boolean constant.
4311class CXXNoexceptExpr : public Expr {
4312 friend class ASTStmtReader;
4313
4314 Stmt *Operand;
4315 SourceRange Range;
4316
4317public:
4320 : Expr(CXXNoexceptExprClass, Ty, VK_PRValue, OK_Ordinary),
4321 Operand(Operand), Range(Keyword, RParen) {
4322 CXXNoexceptExprBits.Value = Val == CT_Cannot;
4323 setDependence(computeDependence(this, Val));
4324 }
4325
4326 CXXNoexceptExpr(EmptyShell Empty) : Expr(CXXNoexceptExprClass, Empty) {}
4327
4328 Expr *getOperand() const { return static_cast<Expr *>(Operand); }
4329
4330 SourceLocation getBeginLoc() const { return Range.getBegin(); }
4331 SourceLocation getEndLoc() const { return Range.getEnd(); }
4332 SourceRange getSourceRange() const { return Range; }
4333
4334 bool getValue() const { return CXXNoexceptExprBits.Value; }
4335
4336 static bool classof(const Stmt *T) {
4337 return T->getStmtClass() == CXXNoexceptExprClass;
4338 }
4339
4340 // Iterators
4341 child_range children() { return child_range(&Operand, &Operand + 1); }
4342
4344 return const_child_range(&Operand, &Operand + 1);
4345 }
4346};
4347
4348/// Represents a C++11 pack expansion that produces a sequence of
4349/// expressions.
4350///
4351/// A pack expansion expression contains a pattern (which itself is an
4352/// expression) followed by an ellipsis. For example:
4353///
4354/// \code
4355/// template<typename F, typename ...Types>
4356/// void forward(F f, Types &&...args) {
4357/// f(static_cast<Types&&>(args)...);
4358/// }
4359/// \endcode
4360///
4361/// Here, the argument to the function object \c f is a pack expansion whose
4362/// pattern is \c static_cast<Types&&>(args). When the \c forward function
4363/// template is instantiated, the pack expansion will instantiate to zero or
4364/// or more function arguments to the function object \c f.
4365class PackExpansionExpr : public Expr {
4366 friend class ASTStmtReader;
4367 friend class ASTStmtWriter;
4368
4369 SourceLocation EllipsisLoc;
4370
4371 /// The number of expansions that will be produced by this pack
4372 /// expansion expression, if known.
4373 ///
4374 /// When zero, the number of expansions is not known. Otherwise, this value
4375 /// is the number of expansions + 1.
4376 unsigned NumExpansions;
4377
4378 Stmt *Pattern;
4379
4380public:
4382 UnsignedOrNone NumExpansions)
4383 : Expr(PackExpansionExprClass, Pattern->getType(),
4384 Pattern->getValueKind(), Pattern->getObjectKind()),
4385 EllipsisLoc(EllipsisLoc),
4386 NumExpansions(NumExpansions ? *NumExpansions + 1 : 0),
4387 Pattern(Pattern) {
4389 }
4390
4391 PackExpansionExpr(EmptyShell Empty) : Expr(PackExpansionExprClass, Empty) {}
4392
4393 /// Retrieve the pattern of the pack expansion.
4394 Expr *getPattern() { return reinterpret_cast<Expr *>(Pattern); }
4395
4396 /// Retrieve the pattern of the pack expansion.
4397 const Expr *getPattern() const { return reinterpret_cast<Expr *>(Pattern); }
4398
4399 /// Retrieve the location of the ellipsis that describes this pack
4400 /// expansion.
4401 SourceLocation getEllipsisLoc() const { return EllipsisLoc; }
4402
4403 /// Determine the number of expansions that will be produced when
4404 /// this pack expansion is instantiated, if already known.
4406 if (NumExpansions)
4407 return NumExpansions - 1;
4408
4409 return std::nullopt;
4410 }
4411
4412 SourceLocation getBeginLoc() const LLVM_READONLY {
4413 return Pattern->getBeginLoc();
4414 }
4415
4416 SourceLocation getEndLoc() const LLVM_READONLY { return EllipsisLoc; }
4417
4418 static bool classof(const Stmt *T) {
4419 return T->getStmtClass() == PackExpansionExprClass;
4420 }
4421
4422 // Iterators
4424 return child_range(&Pattern, &Pattern + 1);
4425 }
4426
4428 return const_child_range(&Pattern, &Pattern + 1);
4429 }
4430};
4431
4432/// Represents an expression that computes the length of a parameter
4433/// pack.
4434///
4435/// \code
4436/// template<typename ...Types>
4437/// struct count {
4438/// static const unsigned value = sizeof...(Types);
4439/// };
4440/// \endcode
4441class SizeOfPackExpr final
4442 : public Expr,
4443 private llvm::TrailingObjects<SizeOfPackExpr, TemplateArgument> {
4444 friend class ASTStmtReader;
4445 friend class ASTStmtWriter;
4446 friend TrailingObjects;
4447
4448 /// The location of the \c sizeof keyword.
4449 SourceLocation OperatorLoc;
4450
4451 /// The location of the name of the parameter pack.
4452 SourceLocation PackLoc;
4453
4454 /// The location of the closing parenthesis.
4455 SourceLocation RParenLoc;
4456
4457 /// The length of the parameter pack, if known.
4458 ///
4459 /// When this expression is not value-dependent, this is the length of
4460 /// the pack. When the expression was parsed rather than instantiated
4461 /// (and thus is value-dependent), this is zero.
4462 ///
4463 /// After partial substitution into a sizeof...(X) expression (for instance,
4464 /// within an alias template or during function template argument deduction),
4465 /// we store a trailing array of partially-substituted TemplateArguments,
4466 /// and this is the length of that array.
4467 unsigned Length;
4468
4469 /// The parameter pack.
4470 NamedDecl *Pack = nullptr;
4471
4472 /// Create an expression that computes the length of
4473 /// the given parameter pack.
4474 SizeOfPackExpr(QualType SizeType, SourceLocation OperatorLoc, NamedDecl *Pack,
4475 SourceLocation PackLoc, SourceLocation RParenLoc,
4476 UnsignedOrNone Length, ArrayRef<TemplateArgument> PartialArgs)
4477 : Expr(SizeOfPackExprClass, SizeType, VK_PRValue, OK_Ordinary),
4478 OperatorLoc(OperatorLoc), PackLoc(PackLoc), RParenLoc(RParenLoc),
4479 Length(Length ? *Length : PartialArgs.size()), Pack(Pack) {
4480 assert((!Length || PartialArgs.empty()) &&
4481 "have partial args for non-dependent sizeof... expression");
4482 auto *Args = getTrailingObjects();
4483 llvm::uninitialized_copy(PartialArgs, Args);
4484 setDependence(Length ? ExprDependence::None
4485 : ExprDependence::ValueInstantiation);
4486 }
4487
4488 /// Create an empty expression.
4489 SizeOfPackExpr(EmptyShell Empty, unsigned NumPartialArgs)
4490 : Expr(SizeOfPackExprClass, Empty), Length(NumPartialArgs) {}
4491
4492public:
4493 static SizeOfPackExpr *Create(ASTContext &Context, SourceLocation OperatorLoc,
4494 NamedDecl *Pack, SourceLocation PackLoc,
4495 SourceLocation RParenLoc,
4496 UnsignedOrNone Length = std::nullopt,
4497 ArrayRef<TemplateArgument> PartialArgs = {});
4498 static SizeOfPackExpr *CreateDeserialized(ASTContext &Context,
4499 unsigned NumPartialArgs);
4500
4501 /// Determine the location of the 'sizeof' keyword.
4502 SourceLocation getOperatorLoc() const { return OperatorLoc; }
4503
4504 /// Determine the location of the parameter pack.
4505 SourceLocation getPackLoc() const { return PackLoc; }
4506
4507 /// Determine the location of the right parenthesis.
4508 SourceLocation getRParenLoc() const { return RParenLoc; }
4509
4510 /// Retrieve the parameter pack.
4511 NamedDecl *getPack() const { return Pack; }
4512
4513 /// Retrieve the length of the parameter pack.
4514 ///
4515 /// This routine may only be invoked when the expression is not
4516 /// value-dependent.
4517 unsigned getPackLength() const {
4518 assert(!isValueDependent() &&
4519 "Cannot get the length of a value-dependent pack size expression");
4520 return Length;
4521 }
4522
4523 /// Determine whether this represents a partially-substituted sizeof...
4524 /// expression, such as is produced for:
4525 ///
4526 /// template<typename ...Ts> using X = int[sizeof...(Ts)];
4527 /// template<typename ...Us> void f(X<Us..., 1, 2, 3, Us...>);
4529 return isValueDependent() && Length;
4530 }
4531
4532 /// Get
4534 assert(isPartiallySubstituted());
4535 return getTrailingObjects(Length);
4536 }
4537
4538 SourceLocation getBeginLoc() const LLVM_READONLY { return OperatorLoc; }
4539 SourceLocation getEndLoc() const LLVM_READONLY { return RParenLoc; }
4540
4541 static bool classof(const Stmt *T) {
4542 return T->getStmtClass() == SizeOfPackExprClass;
4543 }
4544
4545 // Iterators
4549
4553};
4554
4555class PackIndexingExpr final
4556 : public Expr,
4557 private llvm::TrailingObjects<PackIndexingExpr, Expr *> {
4558 friend class ASTStmtReader;
4559 friend class ASTStmtWriter;
4560 friend TrailingObjects;
4561
4562 SourceLocation EllipsisLoc;
4563
4564 // The location of the closing bracket
4565 SourceLocation RSquareLoc;
4566
4567 // The pack being indexed, followed by the index
4568 Stmt *SubExprs[2];
4569
4570 PackIndexingExpr(QualType Type, SourceLocation EllipsisLoc,
4571 SourceLocation RSquareLoc, Expr *PackIdExpr, Expr *IndexExpr,
4572 ArrayRef<Expr *> SubstitutedExprs = {},
4573 bool FullySubstituted = false)
4574 : Expr(PackIndexingExprClass, Type, VK_LValue, OK_Ordinary),
4575 EllipsisLoc(EllipsisLoc), RSquareLoc(RSquareLoc),
4576 SubExprs{PackIdExpr, IndexExpr} {
4577 PackIndexingExprBits.TransformedExpressions = SubstitutedExprs.size();
4578 PackIndexingExprBits.FullySubstituted = FullySubstituted;
4579 llvm::uninitialized_copy(SubstitutedExprs, getTrailingObjects());
4580
4584 }
4585
4586 /// Create an empty expression.
4587 PackIndexingExpr(EmptyShell Empty) : Expr(PackIndexingExprClass, Empty) {}
4588
4589 unsigned numTrailingObjects(OverloadToken<Expr *>) const {
4590 return PackIndexingExprBits.TransformedExpressions;
4591 }
4592
4593public:
4594 static PackIndexingExpr *Create(ASTContext &Context,
4595 SourceLocation EllipsisLoc,
4596 SourceLocation RSquareLoc, Expr *PackIdExpr,
4597 Expr *IndexExpr, std::optional<int64_t> Index,
4598 ArrayRef<Expr *> SubstitutedExprs = {},
4599 bool FullySubstituted = false);
4600 static PackIndexingExpr *CreateDeserialized(ASTContext &Context,
4601 unsigned NumTransformedExprs);
4602
4603 // The index expression and all elements of the pack have been substituted.
4604 bool isFullySubstituted() const {
4605 return PackIndexingExprBits.FullySubstituted;
4606 }
4607
4608 /// Determine if the expression was expanded to empty.
4609 bool expandsToEmptyPack() const {
4610 return isFullySubstituted() &&
4611 PackIndexingExprBits.TransformedExpressions == 0;
4612 }
4613
4614 /// Determine the location of the 'sizeof' keyword.
4615 SourceLocation getEllipsisLoc() const { return EllipsisLoc; }
4616
4617 /// Determine the location of the parameter pack.
4618 SourceLocation getPackLoc() const { return SubExprs[0]->getBeginLoc(); }
4619
4620 /// Determine the location of the right parenthesis.
4621 SourceLocation getRSquareLoc() const { return RSquareLoc; }
4622
4623 SourceLocation getBeginLoc() const LLVM_READONLY { return getPackLoc(); }
4624 SourceLocation getEndLoc() const LLVM_READONLY { return RSquareLoc; }
4625
4626 Expr *getPackIdExpression() const { return cast<Expr>(SubExprs[0]); }
4627
4628 NamedDecl *getPackDecl() const;
4629
4630 Expr *getIndexExpr() const { return cast<Expr>(SubExprs[1]); }
4631
4634 return std::nullopt;
4636 auto Index = CE->getResultAsAPSInt();
4637 assert(Index.isNonNegative() && "Invalid index");
4638 return static_cast<unsigned>(Index.getExtValue());
4639 }
4640
4643 assert(Index && "extracting the indexed expression of a dependant pack");
4644 return getTrailingObjects()[*Index];
4645 }
4646
4647 /// Return the trailing expressions, regardless of the expansion.
4649 return getTrailingObjects(PackIndexingExprBits.TransformedExpressions);
4650 }
4651
4652 static bool classof(const Stmt *T) {
4653 return T->getStmtClass() == PackIndexingExprClass;
4654 }
4655
4656 // Iterators
4657 child_range children() { return child_range(SubExprs, SubExprs + 2); }
4658
4660 return const_child_range(SubExprs, SubExprs + 2);
4661 }
4662};
4663
4664/// Represents a reference to a non-type template parameter
4665/// that has been substituted with a template argument.
4666class SubstNonTypeTemplateParmExpr : public Expr {
4667 friend class ASTReader;
4668 friend class ASTStmtReader;
4669
4670 /// The replacement expression.
4671 Stmt *Replacement;
4672
4673 /// The associated declaration and a flag indicating if it was a reference
4674 /// parameter. For class NTTPs, we can't determine that based on the value
4675 /// category alone.
4676 llvm::PointerIntPair<Decl *, 1, bool> AssociatedDeclAndRef;
4677
4678 unsigned Index : 15;
4679 unsigned PackIndex : 15;
4680 LLVM_PREFERRED_TYPE(bool)
4681 unsigned Final : 1;
4682
4683 explicit SubstNonTypeTemplateParmExpr(EmptyShell Empty)
4684 : Expr(SubstNonTypeTemplateParmExprClass, Empty) {}
4685
4686public:
4688 SourceLocation Loc, Expr *Replacement,
4689 Decl *AssociatedDecl, unsigned Index,
4690 UnsignedOrNone PackIndex, bool RefParam,
4691 bool Final)
4692 : Expr(SubstNonTypeTemplateParmExprClass, Ty, ValueKind, OK_Ordinary),
4693 Replacement(Replacement),
4694 AssociatedDeclAndRef(AssociatedDecl, RefParam), Index(Index),
4695 PackIndex(PackIndex.toInternalRepresentation()), Final(Final) {
4696 assert(AssociatedDecl != nullptr);
4699 }
4700
4702 return SubstNonTypeTemplateParmExprBits.NameLoc;
4703 }
4706
4707 Expr *getReplacement() const { return cast<Expr>(Replacement); }
4708
4709 /// A template-like entity which owns the whole pattern being substituted.
4710 /// This will own a set of template parameters.
4711 Decl *getAssociatedDecl() const { return AssociatedDeclAndRef.getPointer(); }
4712
4713 /// Returns the index of the replaced parameter in the associated declaration.
4714 /// This should match the result of `getParameter()->getIndex()`.
4715 unsigned getIndex() const { return Index; }
4716
4720
4721 // This substitution is Final, which means the substitution is fully
4722 // sugared: it doesn't need to be resugared later.
4723 bool getFinal() const { return Final; }
4724
4726
4727 bool isReferenceParameter() const { return AssociatedDeclAndRef.getInt(); }
4728
4729 /// Determine the substituted type of the template parameter.
4730 QualType getParameterType(const ASTContext &Ctx) const;
4731
4732 static bool classof(const Stmt *s) {
4733 return s->getStmtClass() == SubstNonTypeTemplateParmExprClass;
4734 }
4735
4736 // Iterators
4737 child_range children() { return child_range(&Replacement, &Replacement + 1); }
4738
4740 return const_child_range(&Replacement, &Replacement + 1);
4741 }
4742};
4743
4744/// Represents a reference to a non-type template parameter pack that
4745/// has been substituted with a non-template argument pack.
4746///
4747/// When a pack expansion in the source code contains multiple parameter packs
4748/// and those parameter packs correspond to different levels of template
4749/// parameter lists, this node is used to represent a non-type template
4750/// parameter pack from an outer level, which has already had its argument pack
4751/// substituted but that still lives within a pack expansion that itself
4752/// could not be instantiated. When actually performing a substitution into
4753/// that pack expansion (e.g., when all template parameters have corresponding
4754/// arguments), this type will be replaced with the appropriate underlying
4755/// expression at the current pack substitution index.
4756class SubstNonTypeTemplateParmPackExpr : public Expr {
4757 friend class ASTReader;
4758 friend class ASTStmtReader;
4759
4760 /// The non-type template parameter pack itself.
4761 Decl *AssociatedDecl;
4762
4763 /// A pointer to the set of template arguments that this
4764 /// parameter pack is instantiated with.
4765 const TemplateArgument *Arguments;
4766
4767 /// The number of template arguments in \c Arguments.
4768 unsigned NumArguments : 15;
4769
4770 LLVM_PREFERRED_TYPE(bool)
4771 unsigned Final : 1;
4772
4773 unsigned Index : 16;
4774
4775 /// The location of the non-type template parameter pack reference.
4776 SourceLocation NameLoc;
4777
4778 explicit SubstNonTypeTemplateParmPackExpr(EmptyShell Empty)
4779 : Expr(SubstNonTypeTemplateParmPackExprClass, Empty) {}
4780
4781public:
4783 SourceLocation NameLoc,
4784 const TemplateArgument &ArgPack,
4785 Decl *AssociatedDecl, unsigned Index,
4786 bool Final);
4787
4788 /// A template-like entity which owns the whole pattern being substituted.
4789 /// This will own a set of template parameters.
4790 Decl *getAssociatedDecl() const { return AssociatedDecl; }
4791
4792 /// Returns the index of the replaced parameter in the associated declaration.
4793 /// This should match the result of `getParameterPack()->getIndex()`.
4794 unsigned getIndex() const { return Index; }
4795
4796 // This substitution will be Final, which means the substitution will be fully
4797 // sugared: it doesn't need to be resugared later.
4798 bool getFinal() const { return Final; }
4799
4800 /// Retrieve the non-type template parameter pack being substituted.
4802
4803 /// Retrieve the location of the parameter pack name.
4804 SourceLocation getParameterPackLocation() const { return NameLoc; }
4805
4806 /// Retrieve the template argument pack containing the substituted
4807 /// template arguments.
4809
4810 SourceLocation getBeginLoc() const LLVM_READONLY { return NameLoc; }
4811 SourceLocation getEndLoc() const LLVM_READONLY { return NameLoc; }
4812
4813 static bool classof(const Stmt *T) {
4814 return T->getStmtClass() == SubstNonTypeTemplateParmPackExprClass;
4815 }
4816
4817 // Iterators
4821
4825};
4826
4827/// Represents a reference to a function parameter pack, init-capture pack,
4828/// or binding pack that has been substituted but not yet expanded.
4829///
4830/// When a pack expansion contains multiple parameter packs at different levels,
4831/// this node is used to represent a function parameter pack at an outer level
4832/// which we have already substituted to refer to expanded parameters, but where
4833/// the containing pack expansion cannot yet be expanded.
4834///
4835/// \code
4836/// template<typename...Ts> struct S {
4837/// template<typename...Us> auto f(Ts ...ts) -> decltype(g(Us(ts)...));
4838/// };
4839/// template struct S<int, int>;
4840/// \endcode
4841class FunctionParmPackExpr final
4842 : public Expr,
4843 private llvm::TrailingObjects<FunctionParmPackExpr, ValueDecl *> {
4844 friend class ASTReader;
4845 friend class ASTStmtReader;
4846 friend TrailingObjects;
4847
4848 /// The function parameter pack which was referenced.
4849 ValueDecl *ParamPack;
4850
4851 /// The location of the function parameter pack reference.
4852 SourceLocation NameLoc;
4853
4854 /// The number of expansions of this pack.
4855 unsigned NumParameters;
4856
4857 FunctionParmPackExpr(QualType T, ValueDecl *ParamPack, SourceLocation NameLoc,
4858 unsigned NumParams, ValueDecl *const *Params);
4859
4860public:
4861 static FunctionParmPackExpr *Create(const ASTContext &Context, QualType T,
4862 ValueDecl *ParamPack,
4863 SourceLocation NameLoc,
4864 ArrayRef<ValueDecl *> Params);
4865 static FunctionParmPackExpr *CreateEmpty(const ASTContext &Context,
4866 unsigned NumParams);
4867
4868 /// Get the parameter pack which this expression refers to.
4869 ValueDecl *getParameterPack() const { return ParamPack; }
4870
4871 /// Get the location of the parameter pack.
4872 SourceLocation getParameterPackLocation() const { return NameLoc; }
4873
4874 /// Iterators over the parameters which the parameter pack expanded
4875 /// into.
4876 using iterator = ValueDecl *const *;
4877 iterator begin() const { return getTrailingObjects(); }
4878 iterator end() const { return begin() + NumParameters; }
4879
4880 /// Get the number of parameters in this parameter pack.
4881 unsigned getNumExpansions() const { return NumParameters; }
4882
4883 /// Get an expansion of the parameter pack by index.
4884 ValueDecl *getExpansion(unsigned I) const { return begin()[I]; }
4885
4886 SourceLocation getBeginLoc() const LLVM_READONLY { return NameLoc; }
4887 SourceLocation getEndLoc() const LLVM_READONLY { return NameLoc; }
4888
4889 static bool classof(const Stmt *T) {
4890 return T->getStmtClass() == FunctionParmPackExprClass;
4891 }
4892
4896
4900};
4901
4902/// Represents a prvalue temporary that is written into memory so that
4903/// a reference can bind to it.
4904///
4905/// Prvalue expressions are materialized when they need to have an address
4906/// in memory for a reference to bind to. This happens when binding a
4907/// reference to the result of a conversion, e.g.,
4908///
4909/// \code
4910/// const int &r = 1.0;
4911/// \endcode
4912///
4913/// Here, 1.0 is implicitly converted to an \c int. That resulting \c int is
4914/// then materialized via a \c MaterializeTemporaryExpr, and the reference
4915/// binds to the temporary. \c MaterializeTemporaryExprs are always glvalues
4916/// (either an lvalue or an xvalue, depending on the kind of reference binding
4917/// to it), maintaining the invariant that references always bind to glvalues.
4918///
4919/// Reference binding and copy-elision can both extend the lifetime of a
4920/// temporary. When either happens, the expression will also track the
4921/// declaration which is responsible for the lifetime extension.
4923private:
4924 friend class ASTStmtReader;
4925 friend class ASTStmtWriter;
4926
4927 llvm::PointerUnion<Stmt *, LifetimeExtendedTemporaryDecl *> State;
4928
4929public:
4931 bool BoundToLvalueReference,
4932 LifetimeExtendedTemporaryDecl *MTD = nullptr);
4933
4935 : Expr(MaterializeTemporaryExprClass, Empty) {}
4936
4937 /// Retrieve the temporary-generating subexpression whose value will
4938 /// be materialized into a glvalue.
4939 Expr *getSubExpr() const {
4940 return cast<Expr>(
4941 isa<Stmt *>(State)
4942 ? cast<Stmt *>(State)
4943 : cast<LifetimeExtendedTemporaryDecl *>(State)->getTemporaryExpr());
4944 }
4945
4946 /// Retrieve the storage duration for the materialized temporary.
4948 return isa<Stmt *>(State) ? SD_FullExpression
4950 ->getStorageDuration();
4951 }
4952
4953 /// Get the storage for the constant value of a materialized temporary
4954 /// of static storage duration.
4955 APValue *getOrCreateValue(bool MayCreate) const {
4957 "the temporary has not been lifetime extended");
4958 return cast<LifetimeExtendedTemporaryDecl *>(State)->getOrCreateValue(
4959 MayCreate);
4960 }
4961
4967 return State.dyn_cast<LifetimeExtendedTemporaryDecl *>();
4968 }
4969
4970 /// Get the declaration which triggered the lifetime-extension of this
4971 /// temporary, if any.
4973 return isa<Stmt *>(State) ? nullptr
4975 ->getExtendingDecl();
4976 }
4978 return const_cast<MaterializeTemporaryExpr *>(this)->getExtendingDecl();
4979 }
4980
4981 void setExtendingDecl(ValueDecl *ExtendedBy, unsigned ManglingNumber);
4982
4983 unsigned getManglingNumber() const {
4984 return isa<Stmt *>(State) ? 0
4986 ->getManglingNumber();
4987 }
4988
4989 /// Determine whether this materialized temporary is bound to an
4990 /// lvalue reference; otherwise, it's bound to an rvalue reference.
4991 bool isBoundToLvalueReference() const { return isLValue(); }
4992
4993 /// Determine whether this temporary object is usable in constant
4994 /// expressions, as specified in C++20 [expr.const]p4.
4995 bool isUsableInConstantExpressions(const ASTContext &Context) const;
4996
4997 SourceLocation getBeginLoc() const LLVM_READONLY {
4998 return getSubExpr()->getBeginLoc();
4999 }
5000
5001 SourceLocation getEndLoc() const LLVM_READONLY {
5002 return getSubExpr()->getEndLoc();
5003 }
5004
5005 static bool classof(const Stmt *T) {
5006 return T->getStmtClass() == MaterializeTemporaryExprClass;
5007 }
5008
5009 // Iterators
5011 return isa<Stmt *>(State)
5012 ? child_range(State.getAddrOfPtr1(), State.getAddrOfPtr1() + 1)
5013 : cast<LifetimeExtendedTemporaryDecl *>(State)->childrenExpr();
5014 }
5015
5017 return isa<Stmt *>(State)
5018 ? const_child_range(State.getAddrOfPtr1(),
5019 State.getAddrOfPtr1() + 1)
5020 : const_cast<const LifetimeExtendedTemporaryDecl *>(
5022 ->childrenExpr();
5023 }
5024};
5025
5026/// Represents a folding of a pack over an operator.
5027///
5028/// This expression is always dependent and represents a pack expansion of the
5029/// forms:
5030///
5031/// ( expr op ... )
5032/// ( ... op expr )
5033/// ( expr op ... op expr )
5034class CXXFoldExpr : public Expr {
5035 friend class ASTStmtReader;
5036 friend class ASTStmtWriter;
5037
5038 enum SubExpr { Callee, LHS, RHS, Count };
5039
5040 SourceLocation LParenLoc;
5041 SourceLocation EllipsisLoc;
5042 SourceLocation RParenLoc;
5043 // When 0, the number of expansions is not known. Otherwise, this is one more
5044 // than the number of expansions.
5045 UnsignedOrNone NumExpansions = std::nullopt;
5046 Stmt *SubExprs[SubExpr::Count];
5047
5048public:
5050 SourceLocation LParenLoc, Expr *LHS, BinaryOperatorKind Opcode,
5051 SourceLocation EllipsisLoc, Expr *RHS, SourceLocation RParenLoc,
5052 UnsignedOrNone NumExpansions);
5053
5054 CXXFoldExpr(EmptyShell Empty) : Expr(CXXFoldExprClass, Empty) {}
5055
5057 return static_cast<UnresolvedLookupExpr *>(SubExprs[SubExpr::Callee]);
5058 }
5059 Expr *getLHS() const { return static_cast<Expr*>(SubExprs[SubExpr::LHS]); }
5060 Expr *getRHS() const { return static_cast<Expr*>(SubExprs[SubExpr::RHS]); }
5061
5062 /// Does this produce a right-associated sequence of operators?
5063 bool isRightFold() const {
5065 }
5066
5067 /// Does this produce a left-associated sequence of operators?
5068 bool isLeftFold() const { return !isRightFold(); }
5069
5070 /// Get the pattern, that is, the operand that contains an unexpanded pack.
5071 Expr *getPattern() const { return isLeftFold() ? getRHS() : getLHS(); }
5072
5073 /// Get the operand that doesn't contain a pack, for a binary fold.
5074 Expr *getInit() const { return isLeftFold() ? getLHS() : getRHS(); }
5075
5076 SourceLocation getLParenLoc() const { return LParenLoc; }
5077 SourceLocation getRParenLoc() const { return RParenLoc; }
5078 SourceLocation getEllipsisLoc() const { return EllipsisLoc; }
5080
5081 UnsignedOrNone getNumExpansions() const { return NumExpansions; }
5082
5083 SourceLocation getBeginLoc() const LLVM_READONLY {
5084 if (LParenLoc.isValid())
5085 return LParenLoc;
5086 if (isLeftFold())
5087 return getEllipsisLoc();
5088 return getLHS()->getBeginLoc();
5089 }
5090
5091 SourceLocation getEndLoc() const LLVM_READONLY {
5092 if (RParenLoc.isValid())
5093 return RParenLoc;
5094 if (isRightFold())
5095 return getEllipsisLoc();
5096 return getRHS()->getEndLoc();
5097 }
5098
5099 static bool classof(const Stmt *T) {
5100 return T->getStmtClass() == CXXFoldExprClass;
5101 }
5102
5103 // Iterators
5105 return child_range(SubExprs, SubExprs + SubExpr::Count);
5106 }
5107
5109 return const_child_range(SubExprs, SubExprs + SubExpr::Count);
5110 }
5111};
5112
5113/// Represents a list-initialization with parenthesis.
5114///
5115/// As per P0960R3, this is a C++20 feature that allows aggregate to
5116/// be initialized with a parenthesized list of values:
5117/// ```
5118/// struct A {
5119/// int a;
5120/// double b;
5121/// };
5122///
5123/// void foo() {
5124/// A a1(0); // Well-formed in C++20
5125/// A a2(1.5, 1.0); // Well-formed in C++20
5126/// }
5127/// ```
5128/// It has some sort of similiarity to braced
5129/// list-initialization, with some differences such as
5130/// it allows narrowing conversion whilst braced
5131/// list-initialization doesn't.
5132/// ```
5133/// struct A {
5134/// char a;
5135/// };
5136/// void foo() {
5137/// A a(1.5); // Well-formed in C++20
5138/// A b{1.5}; // Ill-formed !
5139/// }
5140/// ```
5141class CXXParenListInitExpr final
5142 : public Expr,
5143 private llvm::TrailingObjects<CXXParenListInitExpr, Expr *> {
5144 friend class TrailingObjects;
5145 friend class ASTStmtReader;
5146 friend class ASTStmtWriter;
5147
5148 unsigned NumExprs;
5149 unsigned NumUserSpecifiedExprs;
5150 SourceLocation InitLoc, LParenLoc, RParenLoc;
5151 llvm::PointerUnion<Expr *, FieldDecl *> ArrayFillerOrUnionFieldInit;
5152
5153 CXXParenListInitExpr(ArrayRef<Expr *> Args, QualType T,
5154 unsigned NumUserSpecifiedExprs, SourceLocation InitLoc,
5155 SourceLocation LParenLoc, SourceLocation RParenLoc)
5156 : Expr(CXXParenListInitExprClass, T, getValueKindForType(T), OK_Ordinary),
5157 NumExprs(Args.size()), NumUserSpecifiedExprs(NumUserSpecifiedExprs),
5158 InitLoc(InitLoc), LParenLoc(LParenLoc), RParenLoc(RParenLoc) {
5159 llvm::copy(Args, getTrailingObjects());
5160 assert(NumExprs >= NumUserSpecifiedExprs &&
5161 "number of user specified inits is greater than the number of "
5162 "passed inits");
5164 }
5165
5166 size_t numTrailingObjects(OverloadToken<Expr *>) const { return NumExprs; }
5167
5168public:
5169 static CXXParenListInitExpr *
5170 Create(ASTContext &C, ArrayRef<Expr *> Args, QualType T,
5171 unsigned NumUserSpecifiedExprs, SourceLocation InitLoc,
5172 SourceLocation LParenLoc, SourceLocation RParenLoc);
5173
5174 static CXXParenListInitExpr *CreateEmpty(ASTContext &C, unsigned numExprs,
5175 EmptyShell Empty);
5176
5177 explicit CXXParenListInitExpr(EmptyShell Empty, unsigned NumExprs)
5178 : Expr(CXXParenListInitExprClass, Empty), NumExprs(NumExprs),
5179 NumUserSpecifiedExprs(0) {}
5180
5182
5184 return getTrailingObjects(NumExprs);
5185 }
5186
5187 ArrayRef<Expr *> getInitExprs() const { return getTrailingObjects(NumExprs); }
5188
5190 return getTrailingObjects(NumUserSpecifiedExprs);
5191 }
5192
5194 return getTrailingObjects(NumUserSpecifiedExprs);
5195 }
5196
5197 SourceLocation getBeginLoc() const LLVM_READONLY { return LParenLoc; }
5198
5199 SourceLocation getEndLoc() const LLVM_READONLY { return RParenLoc; }
5200
5201 SourceLocation getInitLoc() const LLVM_READONLY { return InitLoc; }
5202
5203 SourceRange getSourceRange() const LLVM_READONLY {
5204 return SourceRange(getBeginLoc(), getEndLoc());
5205 }
5206
5207 void setArrayFiller(Expr *E) { ArrayFillerOrUnionFieldInit = E; }
5208
5210 return dyn_cast_if_present<Expr *>(ArrayFillerOrUnionFieldInit);
5211 }
5212
5213 const Expr *getArrayFiller() const {
5214 return dyn_cast_if_present<Expr *>(ArrayFillerOrUnionFieldInit);
5215 }
5216
5218 ArrayFillerOrUnionFieldInit = FD;
5219 }
5220
5222 return dyn_cast_if_present<FieldDecl *>(ArrayFillerOrUnionFieldInit);
5223 }
5224
5226 return dyn_cast_if_present<FieldDecl *>(ArrayFillerOrUnionFieldInit);
5227 }
5228
5230 Stmt **Begin = reinterpret_cast<Stmt **>(getTrailingObjects());
5231 return child_range(Begin, Begin + NumExprs);
5232 }
5233
5235 Stmt *const *Begin = reinterpret_cast<Stmt *const *>(getTrailingObjects());
5236 return const_child_range(Begin, Begin + NumExprs);
5237 }
5238
5239 static bool classof(const Stmt *T) {
5240 return T->getStmtClass() == CXXParenListInitExprClass;
5241 }
5242};
5243
5244/// Represents an expression that might suspend coroutine execution;
5245/// either a co_await or co_yield expression.
5246///
5247/// Evaluation of this expression first evaluates its 'ready' expression. If
5248/// that returns 'false':
5249/// -- execution of the coroutine is suspended
5250/// -- the 'suspend' expression is evaluated
5251/// -- if the 'suspend' expression returns 'false', the coroutine is
5252/// resumed
5253/// -- otherwise, control passes back to the resumer.
5254/// If the coroutine is not suspended, or when it is resumed, the 'resume'
5255/// expression is evaluated, and its result is the result of the overall
5256/// expression.
5258 friend class ASTStmtReader;
5259
5260 SourceLocation KeywordLoc;
5261
5262 enum SubExpr { Operand, Common, Ready, Suspend, Resume, Count };
5263
5264 Stmt *SubExprs[SubExpr::Count];
5265 OpaqueValueExpr *OpaqueValue = nullptr;
5266
5267public:
5268 // These types correspond to the three C++ 'await_suspend' return variants
5270
5272 Expr *Common, Expr *Ready, Expr *Suspend, Expr *Resume,
5273 OpaqueValueExpr *OpaqueValue)
5274 : Expr(SC, Resume->getType(), Resume->getValueKind(),
5275 Resume->getObjectKind()),
5276 KeywordLoc(KeywordLoc), OpaqueValue(OpaqueValue) {
5277 SubExprs[SubExpr::Operand] = Operand;
5278 SubExprs[SubExpr::Common] = Common;
5279 SubExprs[SubExpr::Ready] = Ready;
5280 SubExprs[SubExpr::Suspend] = Suspend;
5281 SubExprs[SubExpr::Resume] = Resume;
5283 }
5284
5286 Expr *Operand, Expr *Common)
5287 : Expr(SC, Ty, VK_PRValue, OK_Ordinary), KeywordLoc(KeywordLoc) {
5288 assert(Common->isTypeDependent() && Ty->isDependentType() &&
5289 "wrong constructor for non-dependent co_await/co_yield expression");
5290 SubExprs[SubExpr::Operand] = Operand;
5291 SubExprs[SubExpr::Common] = Common;
5292 SubExprs[SubExpr::Ready] = nullptr;
5293 SubExprs[SubExpr::Suspend] = nullptr;
5294 SubExprs[SubExpr::Resume] = nullptr;
5296 }
5297
5299 SubExprs[SubExpr::Operand] = nullptr;
5300 SubExprs[SubExpr::Common] = nullptr;
5301 SubExprs[SubExpr::Ready] = nullptr;
5302 SubExprs[SubExpr::Suspend] = nullptr;
5303 SubExprs[SubExpr::Resume] = nullptr;
5304 }
5305
5307 return static_cast<Expr*>(SubExprs[SubExpr::Common]);
5308 }
5309
5310 /// getOpaqueValue - Return the opaque value placeholder.
5311 OpaqueValueExpr *getOpaqueValue() const { return OpaqueValue; }
5312
5314 return static_cast<Expr*>(SubExprs[SubExpr::Ready]);
5315 }
5316
5318 return static_cast<Expr*>(SubExprs[SubExpr::Suspend]);
5319 }
5320
5322 return static_cast<Expr*>(SubExprs[SubExpr::Resume]);
5323 }
5324
5325 // The syntactic operand written in the code
5326 Expr *getOperand() const {
5327 return static_cast<Expr *>(SubExprs[SubExpr::Operand]);
5328 }
5329
5331 auto *SuspendExpr = getSuspendExpr();
5332 assert(SuspendExpr);
5333
5334 auto SuspendType = SuspendExpr->getType();
5335
5336 if (SuspendType->isVoidType())
5338 if (SuspendType->isBooleanType())
5340
5341 // Void pointer is the type of handle.address(), which is returned
5342 // from the await suspend wrapper so that the temporary coroutine handle
5343 // value won't go to the frame by mistake
5344 assert(SuspendType->isVoidPointerType());
5346 }
5347
5348 SourceLocation getKeywordLoc() const { return KeywordLoc; }
5349
5350 SourceLocation getBeginLoc() const LLVM_READONLY { return KeywordLoc; }
5351
5352 SourceLocation getEndLoc() const LLVM_READONLY {
5353 return getOperand()->getEndLoc();
5354 }
5355
5357 return child_range(SubExprs, SubExprs + SubExpr::Count);
5358 }
5359
5361 return const_child_range(SubExprs, SubExprs + SubExpr::Count);
5362 }
5363
5364 static bool classof(const Stmt *T) {
5365 return T->getStmtClass() == CoawaitExprClass ||
5366 T->getStmtClass() == CoyieldExprClass;
5367 }
5368};
5369
5370/// Represents a 'co_await' expression.
5372 friend class ASTStmtReader;
5373
5374public:
5375 CoawaitExpr(SourceLocation CoawaitLoc, Expr *Operand, Expr *Common,
5376 Expr *Ready, Expr *Suspend, Expr *Resume,
5377 OpaqueValueExpr *OpaqueValue, bool IsImplicit = false)
5378 : CoroutineSuspendExpr(CoawaitExprClass, CoawaitLoc, Operand, Common,
5379 Ready, Suspend, Resume, OpaqueValue) {
5380 CoawaitBits.IsImplicit = IsImplicit;
5381 }
5382
5383 CoawaitExpr(SourceLocation CoawaitLoc, QualType Ty, Expr *Operand,
5384 Expr *Common, bool IsImplicit = false)
5385 : CoroutineSuspendExpr(CoawaitExprClass, CoawaitLoc, Ty, Operand,
5386 Common) {
5387 CoawaitBits.IsImplicit = IsImplicit;
5388 }
5389
5392
5393 bool isImplicit() const { return CoawaitBits.IsImplicit; }
5394 void setIsImplicit(bool value = true) { CoawaitBits.IsImplicit = value; }
5395
5396 static bool classof(const Stmt *T) {
5397 return T->getStmtClass() == CoawaitExprClass;
5398 }
5399};
5400
5401/// Represents a 'co_await' expression while the type of the promise
5402/// is dependent.
5404 friend class ASTStmtReader;
5405
5406 SourceLocation KeywordLoc;
5407 Stmt *SubExprs[2];
5408
5409public:
5411 UnresolvedLookupExpr *OpCoawait)
5412 : Expr(DependentCoawaitExprClass, Ty, VK_PRValue, OK_Ordinary),
5413 KeywordLoc(KeywordLoc) {
5414 // NOTE: A co_await expression is dependent on the coroutines promise
5415 // type and may be dependent even when the `Op` expression is not.
5416 assert(Ty->isDependentType() &&
5417 "wrong constructor for non-dependent co_await/co_yield expression");
5418 SubExprs[0] = Op;
5419 SubExprs[1] = OpCoawait;
5421 }
5422
5424 : Expr(DependentCoawaitExprClass, Empty) {}
5425
5426 Expr *getOperand() const { return cast<Expr>(SubExprs[0]); }
5427
5431
5432 SourceLocation getKeywordLoc() const { return KeywordLoc; }
5433
5434 SourceLocation getBeginLoc() const LLVM_READONLY { return KeywordLoc; }
5435
5436 SourceLocation getEndLoc() const LLVM_READONLY {
5437 return getOperand()->getEndLoc();
5438 }
5439
5440 child_range children() { return child_range(SubExprs, SubExprs + 2); }
5441
5443 return const_child_range(SubExprs, SubExprs + 2);
5444 }
5445
5446 static bool classof(const Stmt *T) {
5447 return T->getStmtClass() == DependentCoawaitExprClass;
5448 }
5449};
5450
5451/// Represents a 'co_yield' expression.
5453 friend class ASTStmtReader;
5454
5455public:
5456 CoyieldExpr(SourceLocation CoyieldLoc, Expr *Operand, Expr *Common,
5457 Expr *Ready, Expr *Suspend, Expr *Resume,
5458 OpaqueValueExpr *OpaqueValue)
5459 : CoroutineSuspendExpr(CoyieldExprClass, CoyieldLoc, Operand, Common,
5460 Ready, Suspend, Resume, OpaqueValue) {}
5461 CoyieldExpr(SourceLocation CoyieldLoc, QualType Ty, Expr *Operand,
5462 Expr *Common)
5463 : CoroutineSuspendExpr(CoyieldExprClass, CoyieldLoc, Ty, Operand,
5464 Common) {}
5467
5468 static bool classof(const Stmt *T) {
5469 return T->getStmtClass() == CoyieldExprClass;
5470 }
5471};
5472
5473/// Represents a C++2a __builtin_bit_cast(T, v) expression. Used to implement
5474/// std::bit_cast. These can sometimes be evaluated as part of a constant
5475/// expression, but otherwise CodeGen to a simple memcpy in general.
5477 : public ExplicitCastExpr,
5478 private llvm::TrailingObjects<BuiltinBitCastExpr, CXXBaseSpecifier *> {
5479 friend class ASTStmtReader;
5480 friend class CastExpr;
5481 friend TrailingObjects;
5482
5483 SourceLocation KWLoc;
5484 SourceLocation RParenLoc;
5485
5486public:
5488 TypeSourceInfo *DstType, SourceLocation KWLoc,
5489 SourceLocation RParenLoc)
5490 : ExplicitCastExpr(BuiltinBitCastExprClass, T, VK, CK, SrcExpr, 0, false,
5491 DstType),
5492 KWLoc(KWLoc), RParenLoc(RParenLoc) {}
5494 : ExplicitCastExpr(BuiltinBitCastExprClass, Empty, 0, false) {}
5495
5496 SourceLocation getBeginLoc() const LLVM_READONLY { return KWLoc; }
5497 SourceLocation getEndLoc() const LLVM_READONLY { return RParenLoc; }
5498
5499 static bool classof(const Stmt *T) {
5500 return T->getStmtClass() == BuiltinBitCastExprClass;
5501 }
5502};
5503
5504} // namespace clang
5505
5506#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.
SmallVector< AnnotatedLine *, 1 > Children
If this token starts a block, this contains all the unwrapped lines in it.
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:3017
uint64_t getValue() const
Definition ExprCXX.h:3046
SourceLocation getEndLoc() const LLVM_READONLY
Definition ExprCXX.h:3036
ArrayTypeTrait getTrait() const
Definition ExprCXX.h:3038
QualType getQueriedType() const
Definition ExprCXX.h:3042
Expr * getDimensionExpression() const
Definition ExprCXX.h:3048
ArrayTypeTraitExpr(EmptyShell Empty)
Definition ExprCXX.h:3030
child_range children()
Definition ExprCXX.h:3055
const_child_range children() const
Definition ExprCXX.h:3059
static bool classof(const Stmt *T)
Definition ExprCXX.h:3050
TypeSourceInfo * getQueriedTypeSourceInfo() const
Definition ExprCXX.h:3044
friend class ASTStmtReader
Definition ExprCXX.h:3015
SourceLocation getBeginLoc() const LLVM_READONLY
Definition ExprCXX.h:3035
StringRef getOpcodeStr() const
Definition Expr.h:4038
static bool classof(const Stmt *T)
Definition ExprCXX.h:5499
SourceLocation getEndLoc() const LLVM_READONLY
Definition ExprCXX.h:5497
BuiltinBitCastExpr(EmptyShell Empty)
Definition ExprCXX.h:5493
BuiltinBitCastExpr(QualType T, ExprValueKind VK, CastKind CK, Expr *SrcExpr, TypeSourceInfo *DstType, SourceLocation KWLoc, SourceLocation RParenLoc)
Definition ExprCXX.h:5487
friend class ASTStmtReader
Definition ExprCXX.h:5479
SourceLocation getBeginLoc() const LLVM_READONLY
Definition ExprCXX.h:5496
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:1494
CXXBindTemporaryExpr(EmptyShell Empty)
Definition ExprCXX.h:1506
static bool classof(const Stmt *T)
Definition ExprCXX.h:1529
void setTemporary(CXXTemporary *T)
Definition ExprCXX.h:1514
const_child_range children() const
Definition ExprCXX.h:1536
CXXTemporary * getTemporary()
Definition ExprCXX.h:1512
const CXXTemporary * getTemporary() const
Definition ExprCXX.h:1513
const Expr * getSubExpr() const
Definition ExprCXX.h:1516
SourceLocation getEndLoc() const LLVM_READONLY
Definition ExprCXX.h:1524
SourceLocation getBeginLoc() const LLVM_READONLY
Definition ExprCXX.h:1520
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:1549
arg_iterator arg_begin()
Definition ExprCXX.h:1678
bool hasUnusedResultAttr(const ASTContext &Ctx) const
Returns true if this call expression should warn on unused results.
Definition ExprCXX.h:1724
SourceRange getParenOrBraceRange() const
Definition ExprCXX.h:1730
void setElidable(bool E)
Definition ExprCXX.h:1619
const_arg_iterator arg_end() const
Definition ExprCXX.h:1681
void setStdInitListInitialization(bool V)
Definition ExprCXX.h:1645
void setConstructionKind(CXXConstructionKind CK)
Definition ExprCXX.h:1664
ExprIterator arg_iterator
Definition ExprCXX.h:1668
void setIsImmediateEscalating(bool Set)
Definition ExprCXX.h:1711
llvm::iterator_range< arg_iterator > arg_range
Definition ExprCXX.h:1670
bool isElidable() const
Whether this construction is elidable.
Definition ExprCXX.h:1618
bool hadMultipleCandidates() const
Whether the referred constructor was resolved from an overloaded set having size greater than 1.
Definition ExprCXX.h:1623
ConstExprIterator const_arg_iterator
Definition ExprCXX.h:1669
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:1719
child_range children()
Definition ExprCXX.h:1739
Expr * getArg(unsigned Arg)
Return the specified argument.
Definition ExprCXX.h:1692
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:1673
bool isStdInitListInitialization() const
Whether this constructor call was written as list-initialization, but was interpreted as forming a st...
Definition ExprCXX.h:1642
void setListInitialization(bool V)
Definition ExprCXX.h:1634
bool isImmediateEscalating() const
Definition ExprCXX.h:1707
bool requiresZeroInitialization() const
Whether this construction first requires zero-initialization before the initializer is called.
Definition ExprCXX.h:1651
void setRequiresZeroInitialization(bool ZeroInit)
Definition ExprCXX.h:1654
SourceLocation getLocation() const
Definition ExprCXX.h:1614
const_arg_range arguments() const
Definition ExprCXX.h:1674
arg_iterator arg_end()
Definition ExprCXX.h:1679
static unsigned sizeOfTrailingObjects(unsigned NumArgs)
Return the size in bytes of the trailing objects.
Definition ExprCXX.h:1595
void setArg(unsigned Arg, Expr *ArgExpr)
Set the specified argument.
Definition ExprCXX.h:1702
SourceLocation getEndLoc() const LLVM_READONLY
Definition ExprCXX.cpp:581
llvm::iterator_range< const_arg_iterator > const_arg_range
Definition ExprCXX.h:1671
SourceLocation getBeginLoc() const LLVM_READONLY
Definition ExprCXX.cpp:575
void setParenOrBraceRange(SourceRange Range)
Definition ExprCXX.h:1731
const_arg_iterator arg_begin() const
Definition ExprCXX.h:1680
const_child_range children() const
Definition ExprCXX.h:1743
CXXConstructorDecl * getConstructor() const
Get the constructor that this expression will (ultimately) call.
Definition ExprCXX.h:1612
bool isListInitialization() const
Whether this constructor call was written as list-initialization.
Definition ExprCXX.h:1631
unsigned getNumArgs() const
Return the number of arguments to the constructor call.
Definition ExprCXX.h:1689
CXXConstructionKind getConstructionKind() const
Determine whether this constructor is actually constructing a base class (rather than a complete obje...
Definition ExprCXX.h:1660
void setHadMultipleCandidates(bool V)
Definition ExprCXX.h:1626
void setLocation(SourceLocation Loc)
Definition ExprCXX.h:1615
friend class ASTStmtReader
Definition ExprCXX.h:1550
const Expr * getArg(unsigned Arg) const
Definition ExprCXX.h:1696
const Expr *const * getArgs() const
Definition ExprCXX.h:1684
static bool classof(const Stmt *T)
Definition ExprCXX.h:1733
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:1271
SourceLocation getEndLoc() const
Definition ExprCXX.h:1350
const_child_range children() const
Definition ExprCXX.h:1363
SourceLocation getBeginLoc() const
Default argument expressions have no representation in the source, so they have an empty source range...
Definition ExprCXX.h:1349
SourceLocation getUsedLocation() const
Retrieve the location where this default argument was actually used.
Definition ExprCXX.h:1345
ParmVarDecl * getParam()
Definition ExprCXX.h:1314
const ParmVarDecl * getParam() const
Definition ExprCXX.h:1313
friend class ASTReader
Definition ExprCXX.h:1273
const Expr * getExpr() const
Definition ExprCXX.h:1322
Expr * getAdjustedRewrittenExpr()
Definition ExprCXX.cpp:1055
const Expr * getAdjustedRewrittenExpr() const
Definition ExprCXX.h:1337
DeclContext * getUsedContext()
Definition ExprCXX.h:1342
SourceLocation getExprLoc() const
Definition ExprCXX.h:1352
const DeclContext * getUsedContext() const
Definition ExprCXX.h:1341
const Expr * getRewrittenExpr() const
Definition ExprCXX.h:1330
static bool classof(const Stmt *T)
Definition ExprCXX.h:1354
static CXXDefaultArgExpr * CreateEmpty(const ASTContext &C, bool HasRewrittenInit)
Definition ExprCXX.cpp:1032
child_range children()
Definition ExprCXX.h:1359
friend class ASTStmtReader
Definition ExprCXX.h:1272
bool hasRewrittenInit() const
Definition ExprCXX.h:1316
A use of a default initializer in a constructor or in aggregate initialization.
Definition ExprCXX.h:1378
static bool classof(const Stmt *T)
Definition ExprCXX.h:1445
const DeclContext * getUsedContext() const
Definition ExprCXX.h:1435
child_range children()
Definition ExprCXX.h:1450
const FieldDecl * getField() const
Definition ExprCXX.h:1413
const Expr * getRewrittenExpr() const
Retrieve the initializing expression with evaluated immediate calls, if any.
Definition ExprCXX.h:1423
const Expr * getExpr() const
Definition ExprCXX.h:1417
bool hasRewrittenInit() const
Definition ExprCXX.h:1407
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:1412
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:1430
SourceLocation getBeginLoc() const
Definition ExprCXX.h:1442
SourceLocation getEndLoc() const
Definition ExprCXX.h:1443
const_child_range children() const
Definition ExprCXX.h:1454
DeclContext * getUsedContext()
Definition ExprCXX.h:1436
SourceLocation getUsedLocation() const
Retrieve the location where this default initializer expression was actually used.
Definition ExprCXX.h:1440
friend class ASTStmtReader
Definition ExprCXX.h:1380
static bool classof(const Stmt *T)
Definition ExprCXX.h:2683
child_range children()
Definition ExprCXX.h:2688
FunctionDecl * getOperatorDelete() const
Definition ExprCXX.h:2667
SourceLocation getEndLoc() const LLVM_READONLY
Definition ExprCXX.h:2679
bool isArrayForm() const
Definition ExprCXX.h:2654
CXXDeleteExpr(EmptyShell Shell)
Definition ExprCXX.h:2651
const_child_range children() const
Definition ExprCXX.h:2690
SourceLocation getBeginLoc() const
Definition ExprCXX.h:2678
const Expr * getArgument() const
Definition ExprCXX.h:2670
bool isGlobalDelete() const
Definition ExprCXX.h:2653
friend class ASTStmtReader
Definition ExprCXX.h:2629
bool doesUsualArrayDeleteWantSize() const
Answers whether the usual array deallocation function for the allocated type expects the size of the ...
Definition ExprCXX.h:2663
QualType getDestroyedType() const
Retrieve the type being destroyed.
Definition ExprCXX.cpp:338
bool isArrayFormAsWritten() const
Definition ExprCXX.h:2655
CXXDeleteExpr(QualType Ty, bool GlobalDelete, bool ArrayForm, bool ArrayFormAsWritten, bool UsualArrayDeleteWantsSize, FunctionDecl *OperatorDelete, Expr *Arg, SourceLocation Loc)
Definition ExprCXX.h:2638
bool isArrow() const
Determine whether this member expression used the '->' operator; otherwise, it used the '.
Definition ExprCXX.h:3971
SourceLocation getOperatorLoc() const
Retrieve the location of the '->' or '.' operator.
Definition ExprCXX.h:3974
NestedNameSpecifier getQualifier() const
Retrieve the nested-name-specifier that qualifies the member name.
Definition ExprCXX.h:3979
SourceLocation getLAngleLoc() const
Retrieve the location of the left angle bracket starting the explicit template argument list followin...
Definition ExprCXX.h:4026
SourceLocation getTemplateKeywordLoc() const
Retrieve the location of the template keyword preceding the member name, if any.
Definition ExprCXX.h:4018
const DeclarationNameInfo & getMemberNameInfo() const
Retrieve the name of the member that this expression refers to.
Definition ExprCXX.h:4005
SourceLocation getBeginLoc() const LLVM_READONLY
Definition ExprCXX.h:4077
void copyTemplateArgumentsInto(TemplateArgumentListInfo &List) const
Copies the template arguments (if present) into the given structure.
Definition ExprCXX.h:4049
unsigned getNumTemplateArgs() const
Retrieve the number of template arguments provided as part of this template-id.
Definition ExprCXX.h:4066
const TemplateArgumentLoc * getTemplateArgs() const
Retrieve the template arguments provided as part of this template-id.
Definition ExprCXX.h:4057
bool hasExplicitTemplateArgs() const
Determines whether this member expression actually had a C++ template argument list explicitly specif...
Definition ExprCXX.h:4045
static CXXDependentScopeMemberExpr * CreateEmpty(const ASTContext &Ctx, bool HasTemplateKWAndArgsInfo, unsigned NumTemplateArgs, bool HasFirstQualifierFoundInScope)
Definition ExprCXX.cpp:1571
SourceLocation getMemberLoc() const
Definition ExprCXX.h:4014
static bool classof(const Stmt *T)
Definition ExprCXX.h:4091
SourceLocation getRAngleLoc() const
Retrieve the location of the right angle bracket ending the explicit template argument list following...
Definition ExprCXX.h:4034
DeclarationName getMember() const
Retrieve the name of the member that this expression refers to.
Definition ExprCXX.h:4010
SourceLocation getEndLoc() const LLVM_READONLY
Definition ExprCXX.h:4085
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:3998
Expr * getBase() const
Retrieve the base object of this member expressions, e.g., the x in x.m.
Definition ExprCXX.h:3962
NestedNameSpecifierLoc getQualifierLoc() const
Retrieve the nested-name-specifier that qualifies the member name, with source location information.
Definition ExprCXX.h:3985
const_child_range children() const
Definition ExprCXX.h:4102
bool hasTemplateKeyword() const
Determines whether the member name was preceded by the template keyword.
Definition ExprCXX.h:4041
bool isImplicitAccess() const
True if this is an implicit access, i.e.
Definition ExprCXX.h:3954
ArrayRef< TemplateArgumentLoc > template_arguments() const
Definition ExprCXX.h:4073
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:5099
SourceLocation getBeginLoc() const LLVM_READONLY
Definition ExprCXX.h:5083
UnresolvedLookupExpr * getCallee() const
Definition ExprCXX.h:5056
Expr * getInit() const
Get the operand that doesn't contain a pack, for a binary fold.
Definition ExprCXX.h:5074
CXXFoldExpr(EmptyShell Empty)
Definition ExprCXX.h:5054
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:5091
Expr * getRHS() const
Definition ExprCXX.h:5060
const_child_range children() const
Definition ExprCXX.h:5108
SourceLocation getLParenLoc() const
Definition ExprCXX.h:5076
SourceLocation getEllipsisLoc() const
Definition ExprCXX.h:5078
bool isLeftFold() const
Does this produce a left-associated sequence of operators?
Definition ExprCXX.h:5068
UnsignedOrNone getNumExpansions() const
Definition ExprCXX.h:5081
child_range children()
Definition ExprCXX.h:5104
bool isRightFold() const
Does this produce a right-associated sequence of operators?
Definition ExprCXX.h:5063
friend class ASTStmtWriter
Definition ExprCXX.h:5036
Expr * getPattern() const
Get the pattern, that is, the operand that contains an unexpanded pack.
Definition ExprCXX.h:5071
Expr * getLHS() const
Definition ExprCXX.h:5059
friend class ASTStmtReader
Definition ExprCXX.h:5035
SourceLocation getRParenLoc() const
Definition ExprCXX.h:5077
BinaryOperatorKind getOperator() const
Definition ExprCXX.h:5079
void setLParenLoc(SourceLocation L)
Definition ExprCXX.h:1871
SourceLocation getLParenLoc() const
Definition ExprCXX.h:1870
static CXXFunctionalCastExpr * CreateEmpty(const ASTContext &Context, unsigned PathSize, bool HasFPFeatures)
Definition ExprCXX.cpp:934
SourceLocation getRParenLoc() const
Definition ExprCXX.h:1872
SourceLocation getBeginLoc() const LLVM_READONLY
Definition ExprCXX.cpp:944
void setRParenLoc(SourceLocation L)
Definition ExprCXX.h:1873
static bool classof(const Stmt *T)
Definition ExprCXX.h:1881
bool isListInitialization() const
Determine whether this expression models list-initialization.
Definition ExprCXX.h:1876
SourceLocation getEndLoc() const LLVM_READONLY
Definition ExprCXX.cpp:948
CXXInheritedCtorInitExpr(EmptyShell Empty)
Construct an empty C++ inheriting construction expression.
Definition ExprCXX.h:1785
const_child_range children() const
Definition ExprCXX.h:1818
CXXConstructionKind getConstructionKind() const
Definition ExprCXX.h:1795
SourceLocation getBeginLoc() const LLVM_READONLY
Definition ExprCXX.h:1807
static bool classof(const Stmt *T)
Definition ExprCXX.h:1810
bool constructsVBase() const
Determine whether this constructor is actually constructing a base class (rather than a complete obje...
Definition ExprCXX.h:1794
CXXConstructorDecl * getConstructor() const
Get the constructor that this expression will call.
Definition ExprCXX.h:1790
CXXInheritedCtorInitExpr(SourceLocation Loc, QualType T, CXXConstructorDecl *Ctor, bool ConstructsVirtualBase, bool InheritedFromVirtualBase)
Construct a C++ inheriting construction expression.
Definition ExprCXX.h:1773
SourceLocation getLocation() const LLVM_READONLY
Definition ExprCXX.h:1806
SourceLocation getEndLoc() const LLVM_READONLY
Definition ExprCXX.h:1808
bool inheritedFromVBase() const
Determine whether the inherited constructor is inherited from a virtual base of the object we constru...
Definition ExprCXX.h:1804
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:2466
SourceRange getDirectInitRange() const
Definition ExprCXX.h:2611
llvm::iterator_range< arg_iterator > placement_arguments()
Definition ExprCXX.h:2574
ExprIterator arg_iterator
Definition ExprCXX.h:2571
QualType getAllocatedType() const
Definition ExprCXX.h:2436
unsigned getNumImplicitArgs() const
Definition ExprCXX.h:2513
arg_iterator placement_arg_end()
Definition ExprCXX.h:2585
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:2485
const_arg_iterator placement_arg_begin() const
Definition ExprCXX.h:2588
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:2471
SourceLocation getEndLoc() const
Definition ExprCXX.h:2609
CXXNewInitializationStyle getInitializationStyle() const
The kind of initializer this new-expression has.
Definition ExprCXX.h:2529
ImplicitAllocationParameters implicitAllocationParameters() const
Provides the full set of information about expected implicit parameters in this call.
Definition ExprCXX.h:2564
Expr * getPlacementArg(unsigned I)
Definition ExprCXX.h:2505
bool hasInitializer() const
Whether this new-expression has any initializer at all.
Definition ExprCXX.h:2526
const Expr * getInitializer() const
Definition ExprCXX.h:2540
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:2509
static bool classof(const Stmt *T)
Definition ExprCXX.h:2614
SourceLocation getBeginLoc() const
Definition ExprCXX.h:2608
Stmt ** raw_arg_iterator
Definition ExprCXX.h:2595
void setOperatorDelete(FunctionDecl *D)
Definition ExprCXX.h:2464
bool passAlignment() const
Indicates whether the required alignment should be implicitly passed to the allocation function.
Definition ExprCXX.h:2553
FunctionDecl * getOperatorDelete() const
Definition ExprCXX.h:2463
unsigned getNumPlacementArgs() const
Definition ExprCXX.h:2496
const CXXConstructExpr * getConstructExpr() const
Returns the CXXConstructExpr from this new-expression, or null.
Definition ExprCXX.h:2547
llvm::iterator_range< const_arg_iterator > placement_arguments() const
Definition ExprCXX.h:2578
const_arg_iterator placement_arg_end() const
Definition ExprCXX.h:2591
TypeSourceInfo * getAllocatedTypeSourceInfo() const
Definition ExprCXX.h:2440
SourceRange getSourceRange() const
Definition ExprCXX.h:2612
SourceRange getTypeIdParens() const
Definition ExprCXX.h:2518
Expr ** getPlacementArgs()
Definition ExprCXX.h:2500
bool isParenTypeId() const
Definition ExprCXX.h:2517
raw_arg_iterator raw_arg_end()
Definition ExprCXX.h:2598
child_range children()
Definition ExprCXX.h:2619
bool doesUsualArrayDeleteWantSize() const
Answers whether the usual array deallocation function for the allocated type expects the size of the ...
Definition ExprCXX.h:2558
const_arg_iterator raw_arg_end() const
Definition ExprCXX.h:2604
const_child_range children() const
Definition ExprCXX.h:2621
friend class ASTStmtWriter
Definition ExprCXX.h:2359
arg_iterator placement_arg_begin()
Definition ExprCXX.h:2582
raw_arg_iterator raw_arg_begin()
Definition ExprCXX.h:2597
void setOperatorNew(FunctionDecl *D)
Definition ExprCXX.h:2462
friend class ASTStmtReader
Definition ExprCXX.h:2358
FunctionDecl * getOperatorNew() const
Definition ExprCXX.h:2461
const_arg_iterator raw_arg_begin() const
Definition ExprCXX.h:2601
ConstExprIterator const_arg_iterator
Definition ExprCXX.h:2572
bool isGlobalNew() const
Definition ExprCXX.h:2523
Expr * getInitializer()
The initializer of this new-expression.
Definition ExprCXX.h:2535
bool getValue() const
Definition ExprCXX.h:4334
static bool classof(const Stmt *T)
Definition ExprCXX.h:4336
const_child_range children() const
Definition ExprCXX.h:4343
SourceLocation getEndLoc() const
Definition ExprCXX.h:4331
Expr * getOperand() const
Definition ExprCXX.h:4328
SourceLocation getBeginLoc() const
Definition ExprCXX.h:4330
SourceRange getSourceRange() const
Definition ExprCXX.h:4332
CXXNoexceptExpr(EmptyShell Empty)
Definition ExprCXX.h:4326
CXXNoexceptExpr(QualType Ty, Expr *Operand, CanThrowResult Val, SourceLocation Keyword, SourceLocation RParen)
Definition ExprCXX.h:4318
child_range children()
Definition ExprCXX.h:4341
friend class ASTStmtReader
Definition ExprCXX.h:4312
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:5187
SourceRange getSourceRange() const LLVM_READONLY
Definition ExprCXX.h:5203
const_child_range children() const
Definition ExprCXX.h:5234
void setInitializedFieldInUnion(FieldDecl *FD)
Definition ExprCXX.h:5217
SourceLocation getEndLoc() const LLVM_READONLY
Definition ExprCXX.h:5199
SourceLocation getInitLoc() const LLVM_READONLY
Definition ExprCXX.h:5201
MutableArrayRef< Expr * > getInitExprs()
Definition ExprCXX.h:5183
ArrayRef< Expr * > getUserSpecifiedInitExprs()
Definition ExprCXX.h:5189
ArrayRef< Expr * > getUserSpecifiedInitExprs() const
Definition ExprCXX.h:5193
CXXParenListInitExpr(EmptyShell Empty, unsigned NumExprs)
Definition ExprCXX.h:5177
friend class TrailingObjects
Definition ExprCXX.h:5144
static CXXParenListInitExpr * CreateEmpty(ASTContext &C, unsigned numExprs, EmptyShell Empty)
Definition ExprCXX.cpp:1996
const FieldDecl * getInitializedFieldInUnion() const
Definition ExprCXX.h:5225
SourceLocation getBeginLoc() const LLVM_READONLY
Definition ExprCXX.h:5197
static bool classof(const Stmt *T)
Definition ExprCXX.h:5239
FieldDecl * getInitializedFieldInUnion()
Definition ExprCXX.h:5221
const Expr * getArrayFiller() const
Definition ExprCXX.h:5213
void setArrayFiller(Expr *E)
Definition ExprCXX.h:5207
TypeSourceInfo * getDestroyedTypeInfo() const
Retrieve the source location information for the type being destroyed.
Definition ExprCXX.h:2841
SourceLocation getBeginLoc() const LLVM_READONLY
Definition ExprCXX.h:2871
bool isArrow() const
Determine whether this pseudo-destructor expression was written using an '->' (otherwise,...
Definition ExprCXX.h:2811
TypeSourceInfo * getScopeTypeInfo() const
Retrieve the scope type in a qualified pseudo-destructor expression.
Definition ExprCXX.h:2825
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:2876
SourceLocation getTildeLoc() const
Retrieve the location of the '~'.
Definition ExprCXX.h:2832
NestedNameSpecifierLoc getQualifierLoc() const
Retrieves the nested-name-specifier that qualifies the type name, with source-location information.
Definition ExprCXX.h:2800
SourceLocation getEndLoc() const LLVM_READONLY
Definition ExprCXX.cpp:392
SourceLocation getDestroyedTypeLoc() const
Retrieve the starting location of the type being destroyed.
Definition ExprCXX.h:2856
SourceLocation getColonColonLoc() const
Retrieve the location of the '::' in a qualified pseudo-destructor expression.
Definition ExprCXX.h:2829
const_child_range children() const
Definition ExprCXX.h:2883
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:2814
NestedNameSpecifier getQualifier() const
If the member name was qualified, retrieves the nested-name-specifier that precedes the member name.
Definition ExprCXX.h:2805
void setDestroyedType(IdentifierInfo *II, SourceLocation Loc)
Set the name of destroyed type for a dependent pseudo-destructor expression.
Definition ExprCXX.h:2862
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:2848
void setDestroyedType(TypeSourceInfo *Info)
Set the destroyed type.
Definition ExprCXX.h:2867
bool hasQualifier() const
Determines whether this member expression actually had a C++ nested-name-specifier prior to the name ...
Definition ExprCXX.h:2796
CXXPseudoDestructorExpr(EmptyShell Shell)
Definition ExprCXX.h:2788
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:2214
const_child_range children() const
Definition ExprCXX.h:2237
TypeSourceInfo * getTypeSourceInfo() const
Definition ExprCXX.h:2217
SourceLocation getBeginLoc() const LLVM_READONLY
Definition ExprCXX.cpp:223
static bool classof(const Stmt *T)
Definition ExprCXX.h:2228
SourceLocation getEndLoc() const
Definition ExprCXX.h:2226
SourceLocation getRParenLoc() const
Definition ExprCXX.h:2221
CXXScalarValueInitExpr(QualType Type, TypeSourceInfo *TypeInfo, SourceLocation RParenLoc)
Create an explicitly-written scalar-value initialization expression.
Definition ExprCXX.h:2206
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:1930
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:1935
SourceLocation getBeginLoc() const LLVM_READONLY
Definition ExprCXX.cpp:1169
Represents a C++ temporary.
Definition ExprCXX.h:1460
const CXXDestructorDecl * getDestructor() const
Definition ExprCXX.h:1471
void setDestructor(const CXXDestructorDecl *Dtor)
Definition ExprCXX.h:1473
void setCapturedByCopyInLambdaWithExplicitObjectParameter(bool Set)
Definition ExprCXX.h:1185
SourceLocation getBeginLoc() const
Definition ExprCXX.h:1175
void setLocation(SourceLocation L)
Definition ExprCXX.h:1173
SourceLocation getEndLoc() const
Definition ExprCXX.h:1176
bool isCapturedByCopyInLambdaWithExplicitObjectParameter() const
Definition ExprCXX.h:1181
static CXXThisExpr * CreateEmpty(const ASTContext &Ctx)
Definition ExprCXX.cpp:1591
void setImplicit(bool I)
Definition ExprCXX.h:1179
child_range children()
Definition ExprCXX.h:1195
bool isImplicit() const
Definition ExprCXX.h:1178
static bool classof(const Stmt *T)
Definition ExprCXX.h:1190
const_child_range children() const
Definition ExprCXX.h:1199
SourceLocation getLocation() const
Definition ExprCXX.h:1172
CXXThrowExpr(EmptyShell Empty)
Definition ExprCXX.h:1227
const_child_range children() const
Definition ExprCXX.h:1259
SourceLocation getEndLoc() const LLVM_READONLY
Definition ExprCXX.h:1244
const Expr * getSubExpr() const
Definition ExprCXX.h:1229
CXXThrowExpr(Expr *Operand, QualType Ty, SourceLocation Loc, bool IsThrownVariableInScope)
Definition ExprCXX.h:1220
SourceLocation getThrowLoc() const
Definition ExprCXX.h:1232
Expr * getSubExpr()
Definition ExprCXX.h:1230
SourceLocation getBeginLoc() const
Definition ExprCXX.h:1243
bool isThrownVariableInScope() const
Determines whether the variable thrown by this expression (if any!) is within the innermost try block...
Definition ExprCXX.h:1239
static bool classof(const Stmt *T)
Definition ExprCXX.h:1250
child_range children()
Definition ExprCXX.h:1255
friend class ASTStmtReader
Definition ExprCXX.h:1210
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:3746
const_child_range children() const
Definition ExprCXX.h:3854
const Expr *const * const_arg_iterator
Definition ExprCXX.h:3813
void setRParenLoc(SourceLocation L)
Definition ExprCXX.h:3796
void setArg(unsigned I, Expr *E)
Definition ExprCXX.h:3832
SourceLocation getLParenLoc() const
Retrieve the location of the left parentheses ('(') that precedes the argument list.
Definition ExprCXX.h:3790
bool isListInitialization() const
Determine whether this expression models list-initialization.
Definition ExprCXX.h:3801
TypeSourceInfo * getTypeSourceInfo() const
Retrieve the type source information for the type being constructed.
Definition ExprCXX.h:3784
const_arg_range arguments() const
Definition ExprCXX.h:3818
QualType getTypeAsWritten() const
Retrieve the type that is being constructed, as specified in the source code.
Definition ExprCXX.h:3780
const_arg_iterator arg_end() const
Definition ExprCXX.h:3817
SourceLocation getEndLoc() const LLVM_READONLY
Definition ExprCXX.h:3838
llvm::iterator_range< const_arg_iterator > const_arg_range
Definition ExprCXX.h:3814
void setLParenLoc(SourceLocation L)
Definition ExprCXX.h:3791
const Expr * getArg(unsigned I) const
Definition ExprCXX.h:3827
SourceLocation getRParenLoc() const
Retrieve the location of the right parentheses (')') that follows the argument list.
Definition ExprCXX.h:3795
SourceLocation getBeginLoc() const LLVM_READONLY
Definition ExprCXX.cpp:1504
unsigned getNumArgs() const
Retrieve the number of arguments.
Definition ExprCXX.h:3804
static bool classof(const Stmt *T)
Definition ExprCXX.h:3844
static CXXUnresolvedConstructExpr * CreateEmpty(const ASTContext &Context, unsigned NumArgs)
Definition ExprCXX.cpp:1498
llvm::iterator_range< arg_iterator > arg_range
Definition ExprCXX.h:3807
const_arg_iterator arg_begin() const
Definition ExprCXX.h:3816
child_range children()
Definition ExprCXX.h:1127
SourceLocation getBeginLoc() const LLVM_READONLY
Definition ExprCXX.h:1117
static bool classof(const Stmt *T)
Definition ExprCXX.h:1122
const_child_range children() const
Definition ExprCXX.h:1134
Expr * getExprOperand() const
Definition ExprCXX.h:1110
CXXUuidofExpr(QualType Ty, TypeSourceInfo *Operand, MSGuidDecl *Guid, SourceRange R)
Definition ExprCXX.h:1078
MSGuidDecl * getGuidDecl() const
Definition ExprCXX.h:1115
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:1099
CXXUuidofExpr(QualType Ty, Expr *Operand, MSGuidDecl *Guid, SourceRange R)
Definition ExprCXX.h:1085
TypeSourceInfo * getTypeOperandSourceInfo() const
Retrieve source information for the type operand.
Definition ExprCXX.h:1106
void setSourceRange(SourceRange R)
Definition ExprCXX.h:1120
friend class ASTStmtReader
Definition ExprCXX.h:1070
SourceRange getSourceRange() const LLVM_READONLY
Definition ExprCXX.h:1119
SourceLocation getEndLoc() const LLVM_READONLY
Definition ExprCXX.h:1118
CXXUuidofExpr(EmptyShell Empty, bool isExpr)
Definition ExprCXX.h:1091
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:1469
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:2048
unsigned path_size() const
Definition Expr.h:3679
bool hasStoredFPFeatures() const
Definition Expr.h:3709
void setIsImplicit(bool value=true)
Definition ExprCXX.h:5394
bool isImplicit() const
Definition ExprCXX.h:5393
static bool classof(const Stmt *T)
Definition ExprCXX.h:5396
CoawaitExpr(EmptyShell Empty)
Definition ExprCXX.h:5390
friend class ASTStmtReader
Definition ExprCXX.h:5372
CoawaitExpr(SourceLocation CoawaitLoc, QualType Ty, Expr *Operand, Expr *Common, bool IsImplicit=false)
Definition ExprCXX.h:5383
CoawaitExpr(SourceLocation CoawaitLoc, Expr *Operand, Expr *Common, Expr *Ready, Expr *Suspend, Expr *Resume, OpaqueValueExpr *OpaqueValue, bool IsImplicit=false)
Definition ExprCXX.h:5375
CompoundStmt - This represents a group of statements like { stmt stmt }.
Definition Stmt.h:1720
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:397
SuspendReturnType getSuspendReturnType() const
Definition ExprCXX.h:5330
CoroutineSuspendExpr(StmtClass SC, SourceLocation KeywordLoc, Expr *Operand, Expr *Common, Expr *Ready, Expr *Suspend, Expr *Resume, OpaqueValueExpr *OpaqueValue)
Definition ExprCXX.h:5271
Expr * getReadyExpr() const
Definition ExprCXX.h:5313
SourceLocation getKeywordLoc() const
Definition ExprCXX.h:5348
Expr * getResumeExpr() const
Definition ExprCXX.h:5321
SourceLocation getBeginLoc() const LLVM_READONLY
Definition ExprCXX.h:5350
Expr * getSuspendExpr() const
Definition ExprCXX.h:5317
CoroutineSuspendExpr(StmtClass SC, SourceLocation KeywordLoc, QualType Ty, Expr *Operand, Expr *Common)
Definition ExprCXX.h:5285
static bool classof(const Stmt *T)
Definition ExprCXX.h:5364
OpaqueValueExpr * getOpaqueValue() const
getOpaqueValue - Return the opaque value placeholder.
Definition ExprCXX.h:5311
Expr * getCommonExpr() const
Definition ExprCXX.h:5306
Expr * getOperand() const
Definition ExprCXX.h:5326
const_child_range children() const
Definition ExprCXX.h:5360
CoroutineSuspendExpr(StmtClass SC, EmptyShell Empty)
Definition ExprCXX.h:5298
SourceLocation getEndLoc() const LLVM_READONLY
Definition ExprCXX.h:5352
CoyieldExpr(EmptyShell Empty)
Definition ExprCXX.h:5465
CoyieldExpr(SourceLocation CoyieldLoc, Expr *Operand, Expr *Common, Expr *Ready, Expr *Suspend, Expr *Resume, OpaqueValueExpr *OpaqueValue)
Definition ExprCXX.h:5456
static bool classof(const Stmt *T)
Definition ExprCXX.h:5468
CoyieldExpr(SourceLocation CoyieldLoc, QualType Ty, Expr *Operand, Expr *Common)
Definition ExprCXX.h:5461
friend class ASTStmtReader
Definition ExprCXX.h:5453
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:5446
DependentCoawaitExpr(EmptyShell Empty)
Definition ExprCXX.h:5423
SourceLocation getEndLoc() const LLVM_READONLY
Definition ExprCXX.h:5436
const_child_range children() const
Definition ExprCXX.h:5442
Expr * getOperand() const
Definition ExprCXX.h:5426
SourceLocation getBeginLoc() const LLVM_READONLY
Definition ExprCXX.h:5434
DependentCoawaitExpr(SourceLocation KeywordLoc, QualType Ty, Expr *Op, UnresolvedLookupExpr *OpCoawait)
Definition ExprCXX.h:5410
SourceLocation getKeywordLoc() const
Definition ExprCXX.h:5432
UnresolvedLookupExpr * getOperatorCoawaitLookup() const
Definition ExprCXX.h:5428
SourceLocation getRAngleLoc() const
Retrieve the location of the right angle bracket ending the explicit template argument list following...
Definition ExprCXX.h:3586
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:3560
SourceLocation getLocation() const
Retrieve the location of the name within the expression.
Definition ExprCXX.h:3556
SourceLocation getLAngleLoc() const
Retrieve the location of the left angle bracket starting the explicit template argument list followin...
Definition ExprCXX.h:3578
ArrayRef< TemplateArgumentLoc > template_arguments() const
Definition ExprCXX.h:3620
const_child_range children() const
Definition ExprCXX.h:3644
static bool classof(const Stmt *T)
Definition ExprCXX.h:3636
bool hasExplicitTemplateArgs() const
Determines whether this lookup had explicit template arguments.
Definition ExprCXX.h:3596
SourceLocation getEndLoc() const LLVM_READONLY
Definition ExprCXX.h:3630
SourceLocation getBeginLoc() const LLVM_READONLY
Note: getBeginLoc() is the start of the whole DependentScopeDeclRefExpr, and differs from getLocation...
Definition ExprCXX.h:3626
NestedNameSpecifier getQualifier() const
Retrieve the nested-name-specifier that qualifies this declaration.
Definition ExprCXX.h:3564
SourceLocation getTemplateKeywordLoc() const
Retrieve the location of the template keyword preceding this name, if any.
Definition ExprCXX.h:3570
bool hasTemplateKeyword() const
Determines whether the name was preceded by the template keyword.
Definition ExprCXX.h:3593
unsigned getNumTemplateArgs() const
Definition ExprCXX.h:3613
DeclarationName getDeclName() const
Retrieve the name that this expression refers to.
Definition ExprCXX.h:3551
TemplateArgumentLoc const * getTemplateArgs() const
Definition ExprCXX.h:3606
void copyTemplateArgumentsInto(TemplateArgumentListInfo &List) const
Copies the template arguments (if present) into the given structure.
Definition ExprCXX.h:3600
const DeclarationNameInfo & getNameInfo() const
Retrieve the name that this expression refers to.
Definition ExprCXX.h:3548
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:3698
static bool classof(const Stmt *T)
Definition ExprCXX.h:3711
CleanupObject getObject(unsigned i) const
Definition ExprCXX.h:3693
child_range children()
Definition ExprCXX.h:3716
ArrayRef< CleanupObject > getObjects() const
Definition ExprCXX.h:3687
unsigned getNumObjects() const
Definition ExprCXX.h:3691
SourceLocation getEndLoc() const LLVM_READONLY
Definition ExprCXX.h:3706
friend class ASTStmtReader
Definition ExprCXX.h:3672
const_child_range children() const
Definition ExprCXX.h:3718
llvm::PointerUnion< BlockDecl *, CompoundLiteralExpr * > CleanupObject
The type of objects that are kept in the cleanup.
Definition ExprCXX.h:3669
SourceLocation getBeginLoc() const LLVM_READONLY
Definition ExprCXX.h:3702
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:1630
bool isImplicitCXXThis() const
Whether this expression is an implicit reference to 'this' in C++.
Definition Expr.cpp:3290
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:3081
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:273
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:3084
static bool classof(const Stmt *T)
Definition ExprCXX.h:3114
ExpressionTraitExpr(EmptyShell Empty)
Definition ExprCXX.h:3097
SourceLocation getBeginLoc() const LLVM_READONLY
Definition ExprCXX.h:3103
Expr * getQueriedExpression() const
Definition ExprCXX.h:3110
ExpressionTrait getTrait() const
Definition ExprCXX.h:3106
friend class ASTStmtReader
Definition ExprCXX.h:3082
SourceLocation getEndLoc() const LLVM_READONLY
Definition ExprCXX.h:3104
const_child_range children() const
Definition ExprCXX.h:3123
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:4897
ValueDecl * getExpansion(unsigned I) const
Get an expansion of the parameter pack by index.
Definition ExprCXX.h:4884
SourceLocation getEndLoc() const LLVM_READONLY
Definition ExprCXX.h:4887
ValueDecl *const * iterator
Iterators over the parameters which the parameter pack expanded into.
Definition ExprCXX.h:4876
ValueDecl * getParameterPack() const
Get the parameter pack which this expression refers to.
Definition ExprCXX.h:4869
iterator end() const
Definition ExprCXX.h:4878
SourceLocation getBeginLoc() const LLVM_READONLY
Definition ExprCXX.h:4886
unsigned getNumExpansions() const
Get the number of parameters in this parameter pack.
Definition ExprCXX.h:4881
static bool classof(const Stmt *T)
Definition ExprCXX.h:4889
SourceLocation getParameterPackLocation() const
Get the location of the parameter pack.
Definition ExprCXX.h:4872
static FunctionParmPackExpr * CreateEmpty(const ASTContext &Context, unsigned NumParams)
Definition ExprCXX.cpp:1824
iterator begin() const
Definition ExprCXX.h:4877
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:2090
Expr ** capture_init_iterator
Iterator that walks over the capture initialization arguments.
Definition ExprCXX.h:2077
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:2188
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:2173
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:2102
bool isGenericLambda() const
Whether this is a generic lambda.
Definition ExprCXX.h:2150
SourceRange getIntroducerRange() const
Retrieve the source range covering the lambda introducer, which contains the explicit capture list su...
Definition ExprCXX.h:2121
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:2007
CompoundStmt * getCompoundStmtBody()
Definition ExprCXX.h:2162
unsigned capture_size() const
Determine the number of captures in this lambda.
Definition ExprCXX.h:2051
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:2114
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:2176
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:2038
SourceLocation getCaptureDefaultLoc() const
Retrieve the location of this lambda's capture-default, if any.
Definition ExprCXX.h:2028
capture_init_iterator capture_init_end()
Retrieve the iterator pointing one past the last initialization argument for this lambda expression.
Definition ExprCXX.h:2108
friend class ASTStmtWriter
Definition ExprCXX.h:2006
const LambdaCapture * capture_iterator
An iterator that walks over the captures of the lambda, both implicit and explicit.
Definition ExprCXX.h:2035
Expr *const * const_capture_init_iterator
Const iterator that walks over the capture initialization arguments.
Definition ExprCXX.h:2082
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:2085
friend class ASTStmtReader
Definition ExprCXX.h:2005
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:2184
static bool classof(const Stmt *T)
Definition ExprCXX.h:2180
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:2096
LambdaCaptureDefault getCaptureDefault() const
Determine the default capture kind for this lambda.
Definition ExprCXX.h:2023
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:3308
A global _GUID constant.
Definition DeclCXX.h:4398
An instance of this class represents the declaration of a property member.
Definition DeclCXX.h:4344
const_child_range children() const
Definition ExprCXX.h:980
NestedNameSpecifierLoc getQualifierLoc() const
Definition ExprCXX.h:993
MSPropertyRefExpr(EmptyShell Empty)
Definition ExprCXX.h:955
bool isArrow() const
Definition ExprCXX.h:991
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:990
Expr * getBaseExpr() const
Definition ExprCXX.h:989
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:985
SourceLocation getBeginLoc() const
Definition ExprCXX.h:965
friend class ASTStmtReader
Definition ExprCXX.h:944
SourceLocation getMemberLoc() const
Definition ExprCXX.h:992
static bool classof(const Stmt *T)
Definition ExprCXX.h:1051
const Expr * getIdx() const
Definition ExprCXX.h:1036
void setRBracketLoc(SourceLocation L)
Definition ExprCXX.h:1045
SourceLocation getEndLoc() const LLVM_READONLY
Definition ExprCXX.h:1042
MSPropertySubscriptExpr(Expr *Base, Expr *Idx, QualType Ty, ExprValueKind VK, ExprObjectKind OK, SourceLocation RBracketLoc)
Definition ExprCXX.h:1019
SourceLocation getExprLoc() const LLVM_READONLY
Definition ExprCXX.h:1047
const_child_range children() const
Definition ExprCXX.h:1060
MSPropertySubscriptExpr(EmptyShell Shell)
Create an empty array subscript expression.
Definition ExprCXX.h:1029
const Expr * getBase() const
Definition ExprCXX.h:1033
SourceLocation getBeginLoc() const LLVM_READONLY
Definition ExprCXX.h:1038
SourceLocation getRBracketLoc() const
Definition ExprCXX.h:1044
MaterializeTemporaryExpr(QualType T, Expr *Temporary, bool BoundToLvalueReference, LifetimeExtendedTemporaryDecl *MTD=nullptr)
Definition ExprCXX.cpp:1830
const LifetimeExtendedTemporaryDecl * getLifetimeExtendedTemporaryDecl() const
Definition ExprCXX.h:4966
StorageDuration getStorageDuration() const
Retrieve the storage duration for the materialized temporary.
Definition ExprCXX.h:4947
Expr * getSubExpr() const
Retrieve the temporary-generating subexpression whose value will be materialized into a glvalue.
Definition ExprCXX.h:4939
APValue * getOrCreateValue(bool MayCreate) const
Get the storage for the constant value of a materialized temporary of static storage duration.
Definition ExprCXX.h:4955
bool isBoundToLvalueReference() const
Determine whether this materialized temporary is bound to an lvalue reference; otherwise,...
Definition ExprCXX.h:4991
ValueDecl * getExtendingDecl()
Get the declaration which triggered the lifetime-extension of this temporary, if any.
Definition ExprCXX.h:4972
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:4934
LifetimeExtendedTemporaryDecl * getLifetimeExtendedTemporaryDecl()
Definition ExprCXX.h:4962
void setExtendingDecl(ValueDecl *ExtendedBy, unsigned ManglingNumber)
Definition ExprCXX.cpp:1844
SourceLocation getEndLoc() const LLVM_READONLY
Definition ExprCXX.h:5001
const ValueDecl * getExtendingDecl() const
Definition ExprCXX.h:4977
static bool classof(const Stmt *T)
Definition ExprCXX.h:5005
SourceLocation getBeginLoc() const LLVM_READONLY
Definition ExprCXX.h:4997
unsigned getManglingNumber() const
Definition ExprCXX.h:4983
const_child_range children() const
Definition ExprCXX.h:5016
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:3349
ASTTemplateKWAndArgsInfo * getTrailingASTTemplateKWAndArgsInfo()
Return the optional template keyword and arguments info.
Definition ExprCXX.h:4284
bool isVarDeclReference() const
Definition ExprCXX.h:3304
bool hasExplicitTemplateArgs() const
Determines whether this expression had explicit template arguments.
Definition ExprCXX.h:3282
static FindResult find(Expr *E)
Finds the overloaded expression in the given expression E of OverloadTy.
Definition ExprCXX.h:3191
NestedNameSpecifier getQualifier() const
Fetches the nested-name qualifier, if one was given.
Definition ExprCXX.h:3246
SourceLocation getLAngleLoc() const
Retrieve the location of the left angle bracket starting the explicit template argument list followin...
Definition ExprCXX.h:3264
const DeclarationNameInfo & getNameInfo() const
Gets the full name info.
Definition ExprCXX.h:3237
const CXXRecordDecl * getNamingClass() const
Definition ExprCXX.h:3217
SourceLocation getNameLoc() const
Gets the location of the name.
Definition ExprCXX.h:3243
UnresolvedSetImpl::iterator decls_iterator
Definition ExprCXX.h:3221
decls_iterator decls_begin() const
Definition ExprCXX.h:3223
CXXRecordDecl * getNamingClass()
Gets the naming class of this lookup, if any.
Definition ExprCXX.h:4301
unsigned getNumDecls() const
Gets the number of declarations in the unresolved set.
Definition ExprCXX.h:3234
TemplateDecl * getTemplateDecl() const
Definition ExprCXX.h:3315
TemplateTemplateParmDecl * getTemplateTemplateDecl() const
Definition ExprCXX.h:3320
SourceLocation getTemplateKeywordLoc() const
Retrieve the location of the template keyword preceding this name, if any.
Definition ExprCXX.h:3256
NestedNameSpecifierLoc getQualifierLoc() const
Fetches the nested-name qualifier with source-location information, if one was given.
Definition ExprCXX.h:3252
const ASTTemplateKWAndArgsInfo * getTrailingASTTemplateKWAndArgsInfo() const
Definition ExprCXX.h:3162
TemplateArgumentLoc const * getTemplateArgs() const
Definition ExprCXX.h:3326
llvm::iterator_range< decls_iterator > decls() const
Definition ExprCXX.h:3229
friend class ASTStmtWriter
Definition ExprCXX.h:3132
void copyTemplateArgumentsInto(TemplateArgumentListInfo &List) const
Copies the template arguments into the given structure.
Definition ExprCXX.h:3344
TemplateArgumentLoc * getTrailingTemplateArgumentLoc()
Return the optional template arguments.
Definition ExprCXX.h:4294
DeclAccessPair * getTrailingResults()
Return the results. Defined after UnresolvedMemberExpr.
Definition ExprCXX.h:4278
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:3155
bool isConceptReference() const
Definition ExprCXX.h:3293
friend class ASTStmtReader
Definition ExprCXX.h:3131
bool hasTemplateKWAndArgsInfo() const
Definition ExprCXX.h:3174
decls_iterator decls_end() const
Definition ExprCXX.h:3226
unsigned getNumTemplateArgs() const
Definition ExprCXX.h:3332
const TemplateArgumentLoc * getTrailingTemplateArgumentLoc() const
Definition ExprCXX.h:3170
DeclarationName getName() const
Gets the name looked up.
Definition ExprCXX.h:3240
SourceLocation getRAngleLoc() const
Retrieve the location of the right angle bracket ending the explicit template argument list following...
Definition ExprCXX.h:3272
bool hasTemplateKeyword() const
Determines whether the name was preceded by the template keyword.
Definition ExprCXX.h:3279
ArrayRef< TemplateArgumentLoc > template_arguments() const
Definition ExprCXX.h:3339
Expr * getPattern()
Retrieve the pattern of the pack expansion.
Definition ExprCXX.h:4394
const Expr * getPattern() const
Retrieve the pattern of the pack expansion.
Definition ExprCXX.h:4397
UnsignedOrNone getNumExpansions() const
Determine the number of expansions that will be produced when this pack expansion is instantiated,...
Definition ExprCXX.h:4405
child_range children()
Definition ExprCXX.h:4423
SourceLocation getBeginLoc() const LLVM_READONLY
Definition ExprCXX.h:4412
SourceLocation getEndLoc() const LLVM_READONLY
Definition ExprCXX.h:4416
friend class ASTStmtWriter
Definition ExprCXX.h:4367
PackExpansionExpr(Expr *Pattern, SourceLocation EllipsisLoc, UnsignedOrNone NumExpansions)
Definition ExprCXX.h:4381
const_child_range children() const
Definition ExprCXX.h:4427
friend class ASTStmtReader
Definition ExprCXX.h:4366
SourceLocation getEllipsisLoc() const
Retrieve the location of the ellipsis that describes this pack expansion.
Definition ExprCXX.h:4401
PackExpansionExpr(EmptyShell Empty)
Definition ExprCXX.h:4391
static bool classof(const Stmt *T)
Definition ExprCXX.h:4418
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:4615
Expr * getIndexExpr() const
Definition ExprCXX.h:4630
child_range children()
Definition ExprCXX.h:4657
ArrayRef< Expr * > getExpressions() const
Return the trailing expressions, regardless of the expansion.
Definition ExprCXX.h:4648
SourceLocation getEndLoc() const LLVM_READONLY
Definition ExprCXX.h:4624
SourceLocation getPackLoc() const
Determine the location of the parameter pack.
Definition ExprCXX.h:4618
SourceLocation getRSquareLoc() const
Determine the location of the right parenthesis.
Definition ExprCXX.h:4621
bool expandsToEmptyPack() const
Determine if the expression was expanded to empty.
Definition ExprCXX.h:4609
Expr * getPackIdExpression() const
Definition ExprCXX.h:4626
friend class ASTStmtWriter
Definition ExprCXX.h:4559
Expr * getSelectedExpr() const
Definition ExprCXX.h:4641
static bool classof(const Stmt *T)
Definition ExprCXX.h:4652
bool isFullySubstituted() const
Definition ExprCXX.h:4604
UnsignedOrNone getSelectedIndex() const
Definition ExprCXX.h:4632
friend class ASTStmtReader
Definition ExprCXX.h:4558
const_child_range children() const
Definition ExprCXX.h:4659
SourceLocation getBeginLoc() const LLVM_READONLY
Definition ExprCXX.h:4623
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:2696
PseudoDestructorTypeStorage(const IdentifierInfo *II, SourceLocation Loc)
Definition ExprCXX.h:2707
const IdentifierInfo * getIdentifier() const
Definition ExprCXX.h:2716
SourceLocation getLocation() const
Definition ExprCXX.h:2720
TypeSourceInfo * getTypeSourceInfo() const
Definition ExprCXX.h:2712
A (possibly-)qualified type.
Definition TypeBase.h:937
Represents an expression that computes the length of a parameter pack.
Definition ExprCXX.h:4443
SourceLocation getPackLoc() const
Determine the location of the parameter pack.
Definition ExprCXX.h:4505
child_range children()
Definition ExprCXX.h:4546
static bool classof(const Stmt *T)
Definition ExprCXX.h:4541
SourceLocation getEndLoc() const LLVM_READONLY
Definition ExprCXX.h:4539
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:4528
const_child_range children() const
Definition ExprCXX.h:4550
SourceLocation getBeginLoc() const LLVM_READONLY
Definition ExprCXX.h:4538
ArrayRef< TemplateArgument > getPartialArguments() const
Get.
Definition ExprCXX.h:4533
SourceLocation getOperatorLoc() const
Determine the location of the 'sizeof' keyword.
Definition ExprCXX.h:4502
friend class ASTStmtWriter
Definition ExprCXX.h:4445
SourceLocation getRParenLoc() const
Determine the location of the right parenthesis.
Definition ExprCXX.h:4508
NamedDecl * getPack() const
Retrieve the parameter pack.
Definition ExprCXX.h:4511
friend class ASTStmtReader
Definition ExprCXX.h:4444
unsigned getPackLength() const
Retrieve the length of the parameter pack.
Definition ExprCXX.h:4517
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:358
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:346
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:4711
UnsignedOrNone getPackIndex() const
Definition ExprCXX.h:4717
SourceLocation getEndLoc() const
Definition ExprCXX.h:4705
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:4739
unsigned getIndex() const
Returns the index of the replaced parameter in the associated declaration.
Definition ExprCXX.h:4715
SubstNonTypeTemplateParmExpr(QualType Ty, ExprValueKind ValueKind, SourceLocation Loc, Expr *Replacement, Decl *AssociatedDecl, unsigned Index, UnsignedOrNone PackIndex, bool RefParam, bool Final)
Definition ExprCXX.h:4687
SourceLocation getNameLoc() const
Definition ExprCXX.h:4701
NonTypeTemplateParmDecl * getParameter() const
Definition ExprCXX.cpp:1728
SourceLocation getBeginLoc() const
Definition ExprCXX.h:4704
static bool classof(const Stmt *s)
Definition ExprCXX.h:4732
Represents a reference to a non-type template parameter pack that has been substituted with a non-tem...
Definition ExprCXX.h:4756
SourceLocation getBeginLoc() const LLVM_READONLY
Definition ExprCXX.h:4810
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:4804
const_child_range children() const
Definition ExprCXX.h:4822
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:4790
static bool classof(const Stmt *T)
Definition ExprCXX.h:4813
unsigned getIndex() const
Returns the index of the replaced parameter in the associated declaration.
Definition ExprCXX.h:4794
SourceLocation getEndLoc() const LLVM_READONLY
Definition ExprCXX.h:4811
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:8258
QualType getType() const
Return the type wrapped by this type source info.
Definition TypeBase.h:8269
bool getBoolValue() const
Definition ExprCXX.h:2949
ArrayRef< TypeSourceInfo * > getArgs() const
Retrieve the argument types.
Definition ExprCXX.h:2969
child_range children()
Definition ExprCXX.h:2981
SourceLocation getEndLoc() const LLVM_READONLY
Definition ExprCXX.h:2974
TypeSourceInfo * getArg(unsigned I) const
Retrieve the Ith argument.
Definition ExprCXX.h:2963
const_child_range children() const
Definition ExprCXX.h:2985
unsigned getNumArgs() const
Determine the number of arguments to this type trait.
Definition ExprCXX.h:2960
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:2941
friend class ASTStmtWriter
Definition ExprCXX.h:2921
SourceLocation getBeginLoc() const LLVM_READONLY
Definition ExprCXX.h:2973
const APValue & getAPValue() const
Definition ExprCXX.h:2954
friend class ASTStmtReader
Definition ExprCXX.h:2920
static bool classof(const Stmt *T)
Definition ExprCXX.h:2976
bool isStoredAsBoolean() const
Definition ExprCXX.h:2945
The base class of the type hierarchy.
Definition TypeBase.h:1833
const T * castAs() const
Member-template castAs<specific type>.
Definition TypeBase.h:9167
bool isSpecificBuiltinType(unsigned K) const
Test for a particular builtin type.
Definition TypeBase.h:8849
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:3392
SourceLocation getBeginLoc() const LLVM_READONLY
Definition ExprCXX.h:3469
const CXXRecordDecl * getNamingClass() const
Definition ExprCXX.h:3467
CXXRecordDecl * getNamingClass()
Gets the 'naming class' (in the sense of C++0x [class.access.base]p5) of the lookup.
Definition ExprCXX.h:3466
SourceLocation getEndLoc() const LLVM_READONLY
Definition ExprCXX.h:3475
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:3489
bool requiresADL() const
True if this declaration should be extended by argument-dependent lookup.
Definition ExprCXX.h:3461
const_child_range children() const
Definition ExprCXX.h:3485
SourceLocation getEndLoc() const LLVM_READONLY
Definition ExprCXX.h:4254
DeclarationName getMemberName() const
Retrieve the name of the member that this expression refers to.
Definition ExprCXX.h:4236
QualType getBaseType() const
Definition ExprCXX.h:4210
bool isArrow() const
Determine whether this member expression used the '->' operator; otherwise, it used the '.
Definition ExprCXX.h:4220
SourceLocation getOperatorLoc() const
Retrieve the location of the '->' or '.' operator.
Definition ExprCXX.h:4223
bool hasUnresolvedUsing() const
Determine whether the lookup results contain an unresolved using declaration.
Definition ExprCXX.h:4214
const Expr * getBase() const
Definition ExprCXX.h:4205
const CXXRecordDecl * getNamingClass() const
Definition ExprCXX.h:4227
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:4244
Expr * getBase()
Retrieve the base object of this member expressions, e.g., the x in x.m.
Definition ExprCXX.h:4201
static bool classof(const Stmt *T)
Definition ExprCXX.h:4260
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:4233
SourceLocation getBeginLoc() const LLVM_READONLY
Definition ExprCXX.h:4246
static UnresolvedMemberExpr * CreateEmpty(const ASTContext &Context, unsigned NumResults, bool HasTemplateKWAndArgsInfo, unsigned NumTemplateArgs)
Definition ExprCXX.cpp:1671
const_child_range children() const
Definition ExprCXX.h:4271
SourceLocation getMemberLoc() const
Retrieve the location of the name of the member that this expression refers to.
Definition ExprCXX.h:4240
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:2271
CXXConstructionKind
Definition ExprCXX.h:1541
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:2267
AlignedAllocationMode
Definition ExprCXX.h:2265
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:559
bool isTypeAwareAllocation(TypeAwareAllocationMode Mode)
Definition ExprCXX.h:2255
CastKind
CastKind - The kind of operation required for a conversion.
SizedDeallocationMode sizedDeallocationModeFromBool(bool IsSized)
Definition ExprCXX.h:2281
@ 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:2275
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:2277
TypeAwareAllocationMode
Definition ExprCXX.h:2253
TypeAwareAllocationMode typeAwareAllocationModeFromBool(bool IsTypeAwareAllocation)
Definition ExprCXX.h:2260
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:5876
TypeTrait
Names for traits that operate specifically on types.
Definition TypeTraits.h:21
CXXNewInitializationStyle
Definition ExprCXX.h:2242
@ Parens
New-expression has a C++98 paren-delimited initializer.
Definition ExprCXX.h:2247
@ Braces
New-expression has a C++11 list-initializer.
Definition ExprCXX.h:2250
#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:2286
AlignedAllocationMode PassAlignment
Definition ExprCXX.h:2309
ImplicitAllocationParameters(AlignedAllocationMode PassAlignment)
Definition ExprCXX.h:2294
TypeAwareAllocationMode PassTypeIdentity
Definition ExprCXX.h:2308
unsigned getNumImplicitArgs() const
Definition ExprCXX.h:2298
ImplicitDeallocationParameters(AlignedAllocationMode PassAlignment, SizedDeallocationMode PassSize)
Definition ExprCXX.h:2323
TypeAwareAllocationMode PassTypeIdentity
Definition ExprCXX.h:2340
SizedDeallocationMode PassSize
Definition ExprCXX.h:2342
ImplicitDeallocationParameters(QualType DeallocType, TypeAwareAllocationMode PassTypeIdentity, AlignedAllocationMode PassAlignment, SizedDeallocationMode PassSize)
Definition ExprCXX.h:2313
AlignedAllocationMode PassAlignment
Definition ExprCXX.h:2341
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:2346
TypeAwareAllocationMode TypeAwareDelete
Definition ExprCXX.h:2347
AlignedAllocationMode Alignment
Definition ExprCXX.h:2350