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