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