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