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