ExprCXX.h revision 4c5d320a7581f4b80b151630c91cea5727fa9923
15f016e2cb5d11daeb237544de1c5d59f20fe1a6eReid Spencer//===--- ExprCXX.h - Classes for representing expressions -------*- C++ -*-===//
25f016e2cb5d11daeb237544de1c5d59f20fe1a6eReid Spencer//
35f016e2cb5d11daeb237544de1c5d59f20fe1a6eReid Spencer//                     The LLVM Compiler Infrastructure
45f016e2cb5d11daeb237544de1c5d59f20fe1a6eReid Spencer//
50bc735ffcfb223c0186419547abaa5c84482663eChris Lattner// This file is distributed under the University of Illinois Open Source
60bc735ffcfb223c0186419547abaa5c84482663eChris Lattner// License. See LICENSE.TXT for details.
75f016e2cb5d11daeb237544de1c5d59f20fe1a6eReid Spencer//
85f016e2cb5d11daeb237544de1c5d59f20fe1a6eReid Spencer//===----------------------------------------------------------------------===//
95f016e2cb5d11daeb237544de1c5d59f20fe1a6eReid Spencer//
105f016e2cb5d11daeb237544de1c5d59f20fe1a6eReid Spencer//  This file defines the Expr interface and subclasses for C++ expressions.
115f016e2cb5d11daeb237544de1c5d59f20fe1a6eReid Spencer//
125f016e2cb5d11daeb237544de1c5d59f20fe1a6eReid Spencer//===----------------------------------------------------------------------===//
135f016e2cb5d11daeb237544de1c5d59f20fe1a6eReid Spencer
145f016e2cb5d11daeb237544de1c5d59f20fe1a6eReid Spencer#ifndef LLVM_CLANG_AST_EXPRCXX_H
155f016e2cb5d11daeb237544de1c5d59f20fe1a6eReid Spencer#define LLVM_CLANG_AST_EXPRCXX_H
165f016e2cb5d11daeb237544de1c5d59f20fe1a6eReid Spencer
175f016e2cb5d11daeb237544de1c5d59f20fe1a6eReid Spencer#include "clang/AST/Expr.h"
18c4a1dea2dc56bd1357ec91b829a0b9e68229a13eDaniel Dunbar#include "clang/AST/Decl.h"
195f016e2cb5d11daeb237544de1c5d59f20fe1a6eReid Spencer
205f016e2cb5d11daeb237544de1c5d59f20fe1a6eReid Spencernamespace clang {
215f016e2cb5d11daeb237544de1c5d59f20fe1a6eReid Spencer
224c5d320a7581f4b80b151630c91cea5727fa9923Sebastian Redl  class CXXConstructorDecl;
234c5d320a7581f4b80b151630c91cea5727fa9923Sebastian Redl
241060aff23f72135f8b50034a1e80f16725ebc56cTed Kremenek//===--------------------------------------------------------------------===//
251060aff23f72135f8b50034a1e80f16725ebc56cTed Kremenek// C++ Expressions.
261060aff23f72135f8b50034a1e80f16725ebc56cTed Kremenek//===--------------------------------------------------------------------===//
271060aff23f72135f8b50034a1e80f16725ebc56cTed Kremenek
28b4609806e9232593ece09ce08b630836e825865cDouglas Gregor/// CXXOperatorCallExpr - Represents a call to an overloaded operator
29b4609806e9232593ece09ce08b630836e825865cDouglas Gregor/// written using operator syntax, e.g., "x + y" or "*p". While
30b4609806e9232593ece09ce08b630836e825865cDouglas Gregor/// semantically equivalent to a normal call, this AST node provides
31b4609806e9232593ece09ce08b630836e825865cDouglas Gregor/// better information about the syntactic representation of the call.
32b4609806e9232593ece09ce08b630836e825865cDouglas Gregorclass CXXOperatorCallExpr : public CallExpr {
33b4609806e9232593ece09ce08b630836e825865cDouglas Gregorpublic:
34b4609806e9232593ece09ce08b630836e825865cDouglas Gregor  CXXOperatorCallExpr(Expr *fn, Expr **args, unsigned numargs, QualType t,
35b4609806e9232593ece09ce08b630836e825865cDouglas Gregor                      SourceLocation operatorloc)
36b4609806e9232593ece09ce08b630836e825865cDouglas Gregor    : CallExpr(CXXOperatorCallExprClass, fn, args, numargs, t, operatorloc) { }
37b4609806e9232593ece09ce08b630836e825865cDouglas Gregor
38b4609806e9232593ece09ce08b630836e825865cDouglas Gregor  /// getOperator - Returns the kind of overloaded operator that this
39b4609806e9232593ece09ce08b630836e825865cDouglas Gregor  /// expression refers to.
40b4609806e9232593ece09ce08b630836e825865cDouglas Gregor  OverloadedOperatorKind getOperator() const;
41b4609806e9232593ece09ce08b630836e825865cDouglas Gregor
42b4609806e9232593ece09ce08b630836e825865cDouglas Gregor  /// getOperatorLoc - Returns the location of the operator symbol in
43b4609806e9232593ece09ce08b630836e825865cDouglas Gregor  /// the expression. When @c getOperator()==OO_Call, this is the
44b4609806e9232593ece09ce08b630836e825865cDouglas Gregor  /// location of the right parentheses; when @c
45b4609806e9232593ece09ce08b630836e825865cDouglas Gregor  /// getOperator()==OO_Subscript, this is the location of the right
46b4609806e9232593ece09ce08b630836e825865cDouglas Gregor  /// bracket.
47b4609806e9232593ece09ce08b630836e825865cDouglas Gregor  SourceLocation getOperatorLoc() const { return getRParenLoc(); }
48b4609806e9232593ece09ce08b630836e825865cDouglas Gregor
49b4609806e9232593ece09ce08b630836e825865cDouglas Gregor  virtual SourceRange getSourceRange() const;
50b4609806e9232593ece09ce08b630836e825865cDouglas Gregor
51b4609806e9232593ece09ce08b630836e825865cDouglas Gregor  static bool classof(const Stmt *T) {
52b4609806e9232593ece09ce08b630836e825865cDouglas Gregor    return T->getStmtClass() == CXXOperatorCallExprClass;
53b4609806e9232593ece09ce08b630836e825865cDouglas Gregor  }
54b4609806e9232593ece09ce08b630836e825865cDouglas Gregor  static bool classof(const CXXOperatorCallExpr *) { return true; }
55b4609806e9232593ece09ce08b630836e825865cDouglas Gregor};
56b4609806e9232593ece09ce08b630836e825865cDouglas Gregor
5749badde06e066d058d6c7fcf4e628a72999b65a9Douglas Gregor/// CXXNamedCastExpr - Abstract class common to all of the C++ "named"
5849badde06e066d058d6c7fcf4e628a72999b65a9Douglas Gregor/// casts, @c static_cast, @c dynamic_cast, @c reinterpret_cast, or @c
5949badde06e066d058d6c7fcf4e628a72999b65a9Douglas Gregor/// const_cast.
6049badde06e066d058d6c7fcf4e628a72999b65a9Douglas Gregor///
6149badde06e066d058d6c7fcf4e628a72999b65a9Douglas Gregor/// This abstract class is inherited by all of the classes
6249badde06e066d058d6c7fcf4e628a72999b65a9Douglas Gregor/// representing "named" casts, e.g., CXXStaticCastExpr,
6349badde06e066d058d6c7fcf4e628a72999b65a9Douglas Gregor/// CXXDynamicCastExpr, CXXReinterpretCastExpr, and CXXConstCastExpr.
6449badde06e066d058d6c7fcf4e628a72999b65a9Douglas Gregorclass CXXNamedCastExpr : public ExplicitCastExpr {
651060aff23f72135f8b50034a1e80f16725ebc56cTed Kremenekprivate:
661060aff23f72135f8b50034a1e80f16725ebc56cTed Kremenek  SourceLocation Loc; // the location of the casting op
6749badde06e066d058d6c7fcf4e628a72999b65a9Douglas Gregor
6849badde06e066d058d6c7fcf4e628a72999b65a9Douglas Gregorprotected:
6949badde06e066d058d6c7fcf4e628a72999b65a9Douglas Gregor  CXXNamedCastExpr(StmtClass SC, QualType ty, Expr *op, QualType writtenTy,
7049badde06e066d058d6c7fcf4e628a72999b65a9Douglas Gregor                   SourceLocation l)
7149badde06e066d058d6c7fcf4e628a72999b65a9Douglas Gregor    : ExplicitCastExpr(SC, ty, op, writtenTy), Loc(l) {}
7249badde06e066d058d6c7fcf4e628a72999b65a9Douglas Gregor
731060aff23f72135f8b50034a1e80f16725ebc56cTed Kremenekpublic:
7449badde06e066d058d6c7fcf4e628a72999b65a9Douglas Gregor  const char *getCastName() const;
7549badde06e066d058d6c7fcf4e628a72999b65a9Douglas Gregor
761060aff23f72135f8b50034a1e80f16725ebc56cTed Kremenek  virtual SourceRange getSourceRange() const {
771060aff23f72135f8b50034a1e80f16725ebc56cTed Kremenek    return SourceRange(Loc, getSubExpr()->getSourceRange().getEnd());
781060aff23f72135f8b50034a1e80f16725ebc56cTed Kremenek  }
791060aff23f72135f8b50034a1e80f16725ebc56cTed Kremenek  static bool classof(const Stmt *T) {
8049badde06e066d058d6c7fcf4e628a72999b65a9Douglas Gregor    switch (T->getStmtClass()) {
8149badde06e066d058d6c7fcf4e628a72999b65a9Douglas Gregor    case CXXNamedCastExprClass:
8249badde06e066d058d6c7fcf4e628a72999b65a9Douglas Gregor    case CXXStaticCastExprClass:
8349badde06e066d058d6c7fcf4e628a72999b65a9Douglas Gregor    case CXXDynamicCastExprClass:
8449badde06e066d058d6c7fcf4e628a72999b65a9Douglas Gregor    case CXXReinterpretCastExprClass:
8549badde06e066d058d6c7fcf4e628a72999b65a9Douglas Gregor    case CXXConstCastExprClass:
8649badde06e066d058d6c7fcf4e628a72999b65a9Douglas Gregor      return true;
8749badde06e066d058d6c7fcf4e628a72999b65a9Douglas Gregor    default:
8849badde06e066d058d6c7fcf4e628a72999b65a9Douglas Gregor      return false;
8949badde06e066d058d6c7fcf4e628a72999b65a9Douglas Gregor    }
901060aff23f72135f8b50034a1e80f16725ebc56cTed Kremenek  }
9149badde06e066d058d6c7fcf4e628a72999b65a9Douglas Gregor  static bool classof(const CXXNamedCastExpr *) { return true; }
921060aff23f72135f8b50034a1e80f16725ebc56cTed Kremenek
9349badde06e066d058d6c7fcf4e628a72999b65a9Douglas Gregor  virtual void EmitImpl(llvm::Serializer& S) const;
9449badde06e066d058d6c7fcf4e628a72999b65a9Douglas Gregor  static CXXNamedCastExpr *CreateImpl(llvm::Deserializer& D, ASTContext& C,
9549badde06e066d058d6c7fcf4e628a72999b65a9Douglas Gregor                                      StmtClass SC);
9649badde06e066d058d6c7fcf4e628a72999b65a9Douglas Gregor};
9749badde06e066d058d6c7fcf4e628a72999b65a9Douglas Gregor
9849badde06e066d058d6c7fcf4e628a72999b65a9Douglas Gregor/// CXXStaticCastExpr - A C++ @c static_cast expression (C++ [expr.static.cast]).
9949badde06e066d058d6c7fcf4e628a72999b65a9Douglas Gregor///
10049badde06e066d058d6c7fcf4e628a72999b65a9Douglas Gregor/// This expression node represents a C++ static cast, e.g.,
10149badde06e066d058d6c7fcf4e628a72999b65a9Douglas Gregor/// @c static_cast<int>(1.0).
10249badde06e066d058d6c7fcf4e628a72999b65a9Douglas Gregorclass CXXStaticCastExpr : public CXXNamedCastExpr {
10349badde06e066d058d6c7fcf4e628a72999b65a9Douglas Gregorpublic:
10449badde06e066d058d6c7fcf4e628a72999b65a9Douglas Gregor  CXXStaticCastExpr(QualType ty, Expr *op, QualType writtenTy, SourceLocation l)
10549badde06e066d058d6c7fcf4e628a72999b65a9Douglas Gregor    : CXXNamedCastExpr(CXXStaticCastExprClass, ty, op, writtenTy, l) {}
10649badde06e066d058d6c7fcf4e628a72999b65a9Douglas Gregor
10749badde06e066d058d6c7fcf4e628a72999b65a9Douglas Gregor  static bool classof(const Stmt *T) {
10849badde06e066d058d6c7fcf4e628a72999b65a9Douglas Gregor    return T->getStmtClass() == CXXStaticCastExprClass;
10949badde06e066d058d6c7fcf4e628a72999b65a9Douglas Gregor  }
11049badde06e066d058d6c7fcf4e628a72999b65a9Douglas Gregor  static bool classof(const CXXStaticCastExpr *) { return true; }
11149badde06e066d058d6c7fcf4e628a72999b65a9Douglas Gregor};
11249badde06e066d058d6c7fcf4e628a72999b65a9Douglas Gregor
11349badde06e066d058d6c7fcf4e628a72999b65a9Douglas Gregor/// CXXDynamicCastExpr - A C++ @c dynamic_cast expression
11449badde06e066d058d6c7fcf4e628a72999b65a9Douglas Gregor/// (C++ [expr.dynamic.cast]), which may perform a run-time check to
11549badde06e066d058d6c7fcf4e628a72999b65a9Douglas Gregor/// determine how to perform the type cast.
11649badde06e066d058d6c7fcf4e628a72999b65a9Douglas Gregor///
11749badde06e066d058d6c7fcf4e628a72999b65a9Douglas Gregor/// This expression node represents a dynamic cast, e.g.,
11849badde06e066d058d6c7fcf4e628a72999b65a9Douglas Gregor/// @c dynamic_cast<Derived*>(BasePtr).
11949badde06e066d058d6c7fcf4e628a72999b65a9Douglas Gregorclass CXXDynamicCastExpr : public CXXNamedCastExpr {
12049badde06e066d058d6c7fcf4e628a72999b65a9Douglas Gregorpublic:
12149badde06e066d058d6c7fcf4e628a72999b65a9Douglas Gregor  CXXDynamicCastExpr(QualType ty, Expr *op, QualType writtenTy, SourceLocation l)
12249badde06e066d058d6c7fcf4e628a72999b65a9Douglas Gregor    : CXXNamedCastExpr(CXXDynamicCastExprClass, ty, op, writtenTy, l) {}
12349badde06e066d058d6c7fcf4e628a72999b65a9Douglas Gregor
12449badde06e066d058d6c7fcf4e628a72999b65a9Douglas Gregor  static bool classof(const Stmt *T) {
12549badde06e066d058d6c7fcf4e628a72999b65a9Douglas Gregor    return T->getStmtClass() == CXXDynamicCastExprClass;
12649badde06e066d058d6c7fcf4e628a72999b65a9Douglas Gregor  }
12749badde06e066d058d6c7fcf4e628a72999b65a9Douglas Gregor  static bool classof(const CXXDynamicCastExpr *) { return true; }
12849badde06e066d058d6c7fcf4e628a72999b65a9Douglas Gregor};
12949badde06e066d058d6c7fcf4e628a72999b65a9Douglas Gregor
13049badde06e066d058d6c7fcf4e628a72999b65a9Douglas Gregor/// CXXReinterpretCastExpr - A C++ @c reinterpret_cast expression (C++
13149badde06e066d058d6c7fcf4e628a72999b65a9Douglas Gregor/// [expr.reinterpret.cast]), which provides a differently-typed view
13249badde06e066d058d6c7fcf4e628a72999b65a9Douglas Gregor/// of a value but performs no actual work at run time.
13349badde06e066d058d6c7fcf4e628a72999b65a9Douglas Gregor///
13449badde06e066d058d6c7fcf4e628a72999b65a9Douglas Gregor/// This expression node represents a reinterpret cast, e.g.,
13549badde06e066d058d6c7fcf4e628a72999b65a9Douglas Gregor/// @c reinterpret_cast<int>(VoidPtr).
13649badde06e066d058d6c7fcf4e628a72999b65a9Douglas Gregorclass CXXReinterpretCastExpr : public CXXNamedCastExpr {
13749badde06e066d058d6c7fcf4e628a72999b65a9Douglas Gregorpublic:
13849badde06e066d058d6c7fcf4e628a72999b65a9Douglas Gregor  CXXReinterpretCastExpr(QualType ty, Expr *op, QualType writtenTy,
13949badde06e066d058d6c7fcf4e628a72999b65a9Douglas Gregor                         SourceLocation l)
14049badde06e066d058d6c7fcf4e628a72999b65a9Douglas Gregor    : CXXNamedCastExpr(CXXReinterpretCastExprClass, ty, op, writtenTy, l) {}
14149badde06e066d058d6c7fcf4e628a72999b65a9Douglas Gregor
14249badde06e066d058d6c7fcf4e628a72999b65a9Douglas Gregor  static bool classof(const Stmt *T) {
14349badde06e066d058d6c7fcf4e628a72999b65a9Douglas Gregor    return T->getStmtClass() == CXXReinterpretCastExprClass;
14449badde06e066d058d6c7fcf4e628a72999b65a9Douglas Gregor  }
14549badde06e066d058d6c7fcf4e628a72999b65a9Douglas Gregor  static bool classof(const CXXReinterpretCastExpr *) { return true; }
14649badde06e066d058d6c7fcf4e628a72999b65a9Douglas Gregor};
14749badde06e066d058d6c7fcf4e628a72999b65a9Douglas Gregor
14849badde06e066d058d6c7fcf4e628a72999b65a9Douglas Gregor/// CXXConstCastExpr - A C++ @c const_cast expression (C++ [expr.const.cast]),
14949badde06e066d058d6c7fcf4e628a72999b65a9Douglas Gregor/// which can remove type qualifiers but does not change the underlying value.
15049badde06e066d058d6c7fcf4e628a72999b65a9Douglas Gregor///
15149badde06e066d058d6c7fcf4e628a72999b65a9Douglas Gregor/// This expression node represents a const cast, e.g.,
15249badde06e066d058d6c7fcf4e628a72999b65a9Douglas Gregor/// @c const_cast<char*>(PtrToConstChar).
15349badde06e066d058d6c7fcf4e628a72999b65a9Douglas Gregorclass CXXConstCastExpr : public CXXNamedCastExpr {
15449badde06e066d058d6c7fcf4e628a72999b65a9Douglas Gregorpublic:
15549badde06e066d058d6c7fcf4e628a72999b65a9Douglas Gregor  CXXConstCastExpr(QualType ty, Expr *op, QualType writtenTy,
15649badde06e066d058d6c7fcf4e628a72999b65a9Douglas Gregor                   SourceLocation l)
15749badde06e066d058d6c7fcf4e628a72999b65a9Douglas Gregor    : CXXNamedCastExpr(CXXConstCastExprClass, ty, op, writtenTy, l) {}
15849badde06e066d058d6c7fcf4e628a72999b65a9Douglas Gregor
15949badde06e066d058d6c7fcf4e628a72999b65a9Douglas Gregor  static bool classof(const Stmt *T) {
16049badde06e066d058d6c7fcf4e628a72999b65a9Douglas Gregor    return T->getStmtClass() == CXXConstCastExprClass;
16149badde06e066d058d6c7fcf4e628a72999b65a9Douglas Gregor  }
16249badde06e066d058d6c7fcf4e628a72999b65a9Douglas Gregor  static bool classof(const CXXConstCastExpr *) { return true; }
1631060aff23f72135f8b50034a1e80f16725ebc56cTed Kremenek};
1641060aff23f72135f8b50034a1e80f16725ebc56cTed Kremenek
1651060aff23f72135f8b50034a1e80f16725ebc56cTed Kremenek/// CXXBoolLiteralExpr - [C++ 2.13.5] C++ Boolean Literal.
1661060aff23f72135f8b50034a1e80f16725ebc56cTed Kremenek///
1671060aff23f72135f8b50034a1e80f16725ebc56cTed Kremenekclass CXXBoolLiteralExpr : public Expr {
1681060aff23f72135f8b50034a1e80f16725ebc56cTed Kremenek  bool Value;
1691060aff23f72135f8b50034a1e80f16725ebc56cTed Kremenek  SourceLocation Loc;
1701060aff23f72135f8b50034a1e80f16725ebc56cTed Kremenekpublic:
1711060aff23f72135f8b50034a1e80f16725ebc56cTed Kremenek  CXXBoolLiteralExpr(bool val, QualType Ty, SourceLocation l) :
1721060aff23f72135f8b50034a1e80f16725ebc56cTed Kremenek    Expr(CXXBoolLiteralExprClass, Ty), Value(val), Loc(l) {}
1731060aff23f72135f8b50034a1e80f16725ebc56cTed Kremenek
1741060aff23f72135f8b50034a1e80f16725ebc56cTed Kremenek  bool getValue() const { return Value; }
1755f016e2cb5d11daeb237544de1c5d59f20fe1a6eReid Spencer
1761060aff23f72135f8b50034a1e80f16725ebc56cTed Kremenek  virtual SourceRange getSourceRange() const { return SourceRange(Loc); }
1775f016e2cb5d11daeb237544de1c5d59f20fe1a6eReid Spencer
1781060aff23f72135f8b50034a1e80f16725ebc56cTed Kremenek  static bool classof(const Stmt *T) {
1791060aff23f72135f8b50034a1e80f16725ebc56cTed Kremenek    return T->getStmtClass() == CXXBoolLiteralExprClass;
1801060aff23f72135f8b50034a1e80f16725ebc56cTed Kremenek  }
1811060aff23f72135f8b50034a1e80f16725ebc56cTed Kremenek  static bool classof(const CXXBoolLiteralExpr *) { return true; }
1825f016e2cb5d11daeb237544de1c5d59f20fe1a6eReid Spencer
1831060aff23f72135f8b50034a1e80f16725ebc56cTed Kremenek  // Iterators
1841060aff23f72135f8b50034a1e80f16725ebc56cTed Kremenek  virtual child_iterator child_begin();
1851060aff23f72135f8b50034a1e80f16725ebc56cTed Kremenek  virtual child_iterator child_end();
1861060aff23f72135f8b50034a1e80f16725ebc56cTed Kremenek};
1871060aff23f72135f8b50034a1e80f16725ebc56cTed Kremenek
188c42e1183846228a7fa5143ad76507d6d60f5c6f3Sebastian Redl/// CXXTypeidExpr - A C++ @c typeid expression (C++ [expr.typeid]), which gets
189c42e1183846228a7fa5143ad76507d6d60f5c6f3Sebastian Redl/// the type_info that corresponds to the supplied type, or the (possibly
190c42e1183846228a7fa5143ad76507d6d60f5c6f3Sebastian Redl/// dynamic) type of the supplied expression.
191c42e1183846228a7fa5143ad76507d6d60f5c6f3Sebastian Redl///
192c42e1183846228a7fa5143ad76507d6d60f5c6f3Sebastian Redl/// This represents code like @c typeid(int) or @c typeid(*objPtr)
193c42e1183846228a7fa5143ad76507d6d60f5c6f3Sebastian Redlclass CXXTypeidExpr : public Expr {
194c42e1183846228a7fa5143ad76507d6d60f5c6f3Sebastian Redlprivate:
195c42e1183846228a7fa5143ad76507d6d60f5c6f3Sebastian Redl  bool isTypeOp : 1;
196c42e1183846228a7fa5143ad76507d6d60f5c6f3Sebastian Redl  void *Operand;
197c42e1183846228a7fa5143ad76507d6d60f5c6f3Sebastian Redl  SourceRange Range;
198c42e1183846228a7fa5143ad76507d6d60f5c6f3Sebastian Redl
199c42e1183846228a7fa5143ad76507d6d60f5c6f3Sebastian Redlpublic:
200c42e1183846228a7fa5143ad76507d6d60f5c6f3Sebastian Redl  CXXTypeidExpr(bool isTypeOp, void *op, QualType Ty, const SourceRange r) :
201c42e1183846228a7fa5143ad76507d6d60f5c6f3Sebastian Redl    Expr(CXXTypeidExprClass, Ty), isTypeOp(isTypeOp), Operand(op), Range(r) {}
202c42e1183846228a7fa5143ad76507d6d60f5c6f3Sebastian Redl
203c42e1183846228a7fa5143ad76507d6d60f5c6f3Sebastian Redl  bool isTypeOperand() const { return isTypeOp; }
204c42e1183846228a7fa5143ad76507d6d60f5c6f3Sebastian Redl  QualType getTypeOperand() const {
205c42e1183846228a7fa5143ad76507d6d60f5c6f3Sebastian Redl    assert(isTypeOperand() && "Cannot call getTypeOperand for typeid(expr)");
206c42e1183846228a7fa5143ad76507d6d60f5c6f3Sebastian Redl    return QualType::getFromOpaquePtr(Operand);
207c42e1183846228a7fa5143ad76507d6d60f5c6f3Sebastian Redl  }
208c42e1183846228a7fa5143ad76507d6d60f5c6f3Sebastian Redl  Expr* getExprOperand() const {
209c42e1183846228a7fa5143ad76507d6d60f5c6f3Sebastian Redl    assert(!isTypeOperand() && "Cannot call getExprOperand for typeid(type)");
210c42e1183846228a7fa5143ad76507d6d60f5c6f3Sebastian Redl    return static_cast<Expr*>(Operand);
211c42e1183846228a7fa5143ad76507d6d60f5c6f3Sebastian Redl  }
212c42e1183846228a7fa5143ad76507d6d60f5c6f3Sebastian Redl
213c42e1183846228a7fa5143ad76507d6d60f5c6f3Sebastian Redl  virtual SourceRange getSourceRange() const {
214c42e1183846228a7fa5143ad76507d6d60f5c6f3Sebastian Redl    return Range;
215c42e1183846228a7fa5143ad76507d6d60f5c6f3Sebastian Redl  }
216c42e1183846228a7fa5143ad76507d6d60f5c6f3Sebastian Redl  static bool classof(const Stmt *T) {
217c42e1183846228a7fa5143ad76507d6d60f5c6f3Sebastian Redl    return T->getStmtClass() == CXXTypeidExprClass;
218c42e1183846228a7fa5143ad76507d6d60f5c6f3Sebastian Redl  }
219c42e1183846228a7fa5143ad76507d6d60f5c6f3Sebastian Redl  static bool classof(const CXXTypeidExpr *) { return true; }
220c42e1183846228a7fa5143ad76507d6d60f5c6f3Sebastian Redl
221c42e1183846228a7fa5143ad76507d6d60f5c6f3Sebastian Redl  // Iterators
222c42e1183846228a7fa5143ad76507d6d60f5c6f3Sebastian Redl  virtual child_iterator child_begin();
223c42e1183846228a7fa5143ad76507d6d60f5c6f3Sebastian Redl  virtual child_iterator child_end();
224c42e1183846228a7fa5143ad76507d6d60f5c6f3Sebastian Redl
225c42e1183846228a7fa5143ad76507d6d60f5c6f3Sebastian Redl  virtual void EmitImpl(llvm::Serializer& S) const;
226c42e1183846228a7fa5143ad76507d6d60f5c6f3Sebastian Redl  static CXXTypeidExpr* CreateImpl(llvm::Deserializer& D, ASTContext& C);
227c42e1183846228a7fa5143ad76507d6d60f5c6f3Sebastian Redl};
228c42e1183846228a7fa5143ad76507d6d60f5c6f3Sebastian Redl
229796da18402f286b897782a298ae3b20c459c102eDouglas Gregor/// CXXThisExpr - Represents the "this" expression in C++, which is a
230796da18402f286b897782a298ae3b20c459c102eDouglas Gregor/// pointer to the object on which the current member function is
231796da18402f286b897782a298ae3b20c459c102eDouglas Gregor/// executing (C++ [expr.prim]p3). Example:
232796da18402f286b897782a298ae3b20c459c102eDouglas Gregor///
233796da18402f286b897782a298ae3b20c459c102eDouglas Gregor/// @code
234796da18402f286b897782a298ae3b20c459c102eDouglas Gregor/// class Foo {
235796da18402f286b897782a298ae3b20c459c102eDouglas Gregor/// public:
236796da18402f286b897782a298ae3b20c459c102eDouglas Gregor///   void bar();
237796da18402f286b897782a298ae3b20c459c102eDouglas Gregor///   void test() { this->bar(); }
238796da18402f286b897782a298ae3b20c459c102eDouglas Gregor/// };
239796da18402f286b897782a298ae3b20c459c102eDouglas Gregor/// @endcode
240796da18402f286b897782a298ae3b20c459c102eDouglas Gregorclass CXXThisExpr : public Expr {
241796da18402f286b897782a298ae3b20c459c102eDouglas Gregor  SourceLocation Loc;
242796da18402f286b897782a298ae3b20c459c102eDouglas Gregor
243796da18402f286b897782a298ae3b20c459c102eDouglas Gregorpublic:
244796da18402f286b897782a298ae3b20c459c102eDouglas Gregor  CXXThisExpr(SourceLocation L, QualType Type)
245796da18402f286b897782a298ae3b20c459c102eDouglas Gregor    : Expr(CXXThisExprClass, Type), Loc(L) { }
246796da18402f286b897782a298ae3b20c459c102eDouglas Gregor
247796da18402f286b897782a298ae3b20c459c102eDouglas Gregor  virtual SourceRange getSourceRange() const { return SourceRange(Loc); }
248796da18402f286b897782a298ae3b20c459c102eDouglas Gregor
249796da18402f286b897782a298ae3b20c459c102eDouglas Gregor  static bool classof(const Stmt *T) {
250796da18402f286b897782a298ae3b20c459c102eDouglas Gregor    return T->getStmtClass() == CXXThisExprClass;
251796da18402f286b897782a298ae3b20c459c102eDouglas Gregor  }
252796da18402f286b897782a298ae3b20c459c102eDouglas Gregor  static bool classof(const CXXThisExpr *) { return true; }
253796da18402f286b897782a298ae3b20c459c102eDouglas Gregor
254796da18402f286b897782a298ae3b20c459c102eDouglas Gregor  // Iterators
255796da18402f286b897782a298ae3b20c459c102eDouglas Gregor  virtual child_iterator child_begin();
256796da18402f286b897782a298ae3b20c459c102eDouglas Gregor  virtual child_iterator child_end();
257796da18402f286b897782a298ae3b20c459c102eDouglas Gregor
258796da18402f286b897782a298ae3b20c459c102eDouglas Gregor  virtual void EmitImpl(llvm::Serializer& S) const;
259796da18402f286b897782a298ae3b20c459c102eDouglas Gregor  static CXXThisExpr* CreateImpl(llvm::Deserializer& D, ASTContext& C);
260796da18402f286b897782a298ae3b20c459c102eDouglas Gregor};
261796da18402f286b897782a298ae3b20c459c102eDouglas Gregor
2621060aff23f72135f8b50034a1e80f16725ebc56cTed Kremenek///  CXXThrowExpr - [C++ 15] C++ Throw Expression.  This handles
2631060aff23f72135f8b50034a1e80f16725ebc56cTed Kremenek///  'throw' and 'throw' assignment-expression.  When
2641060aff23f72135f8b50034a1e80f16725ebc56cTed Kremenek///  assignment-expression isn't present, Op will be null.
2651060aff23f72135f8b50034a1e80f16725ebc56cTed Kremenek///
2661060aff23f72135f8b50034a1e80f16725ebc56cTed Kremenekclass CXXThrowExpr : public Expr {
2671060aff23f72135f8b50034a1e80f16725ebc56cTed Kremenek  Stmt *Op;
2681060aff23f72135f8b50034a1e80f16725ebc56cTed Kremenek  SourceLocation ThrowLoc;
2691060aff23f72135f8b50034a1e80f16725ebc56cTed Kremenekpublic:
2701060aff23f72135f8b50034a1e80f16725ebc56cTed Kremenek  // Ty is the void type which is used as the result type of the
2711060aff23f72135f8b50034a1e80f16725ebc56cTed Kremenek  // exepression.  The l is the location of the throw keyword.  expr
2721060aff23f72135f8b50034a1e80f16725ebc56cTed Kremenek  // can by null, if the optional expression to throw isn't present.
2731060aff23f72135f8b50034a1e80f16725ebc56cTed Kremenek  CXXThrowExpr(Expr *expr, QualType Ty, SourceLocation l) :
2741060aff23f72135f8b50034a1e80f16725ebc56cTed Kremenek    Expr(CXXThrowExprClass, Ty), Op(expr), ThrowLoc(l) {}
2751060aff23f72135f8b50034a1e80f16725ebc56cTed Kremenek  const Expr *getSubExpr() const { return cast_or_null<Expr>(Op); }
2761060aff23f72135f8b50034a1e80f16725ebc56cTed Kremenek  Expr *getSubExpr() { return cast_or_null<Expr>(Op); }
2771060aff23f72135f8b50034a1e80f16725ebc56cTed Kremenek
2781060aff23f72135f8b50034a1e80f16725ebc56cTed Kremenek  virtual SourceRange getSourceRange() const {
2791060aff23f72135f8b50034a1e80f16725ebc56cTed Kremenek    if (getSubExpr() == 0)
2801060aff23f72135f8b50034a1e80f16725ebc56cTed Kremenek      return SourceRange(ThrowLoc, ThrowLoc);
2811060aff23f72135f8b50034a1e80f16725ebc56cTed Kremenek    return SourceRange(ThrowLoc, getSubExpr()->getSourceRange().getEnd());
2821060aff23f72135f8b50034a1e80f16725ebc56cTed Kremenek  }
2831060aff23f72135f8b50034a1e80f16725ebc56cTed Kremenek
2841060aff23f72135f8b50034a1e80f16725ebc56cTed Kremenek  static bool classof(const Stmt *T) {
2851060aff23f72135f8b50034a1e80f16725ebc56cTed Kremenek    return T->getStmtClass() == CXXThrowExprClass;
2861060aff23f72135f8b50034a1e80f16725ebc56cTed Kremenek  }
2871060aff23f72135f8b50034a1e80f16725ebc56cTed Kremenek  static bool classof(const CXXThrowExpr *) { return true; }
2881060aff23f72135f8b50034a1e80f16725ebc56cTed Kremenek
2891060aff23f72135f8b50034a1e80f16725ebc56cTed Kremenek  // Iterators
2901060aff23f72135f8b50034a1e80f16725ebc56cTed Kremenek  virtual child_iterator child_begin();
2911060aff23f72135f8b50034a1e80f16725ebc56cTed Kremenek  virtual child_iterator child_end();
2921060aff23f72135f8b50034a1e80f16725ebc56cTed Kremenek};
2931060aff23f72135f8b50034a1e80f16725ebc56cTed Kremenek
2941060aff23f72135f8b50034a1e80f16725ebc56cTed Kremenek/// CXXDefaultArgExpr - C++ [dcl.fct.default]. This wraps up a
2951060aff23f72135f8b50034a1e80f16725ebc56cTed Kremenek/// function call argument that was created from the corresponding
2961060aff23f72135f8b50034a1e80f16725ebc56cTed Kremenek/// parameter's default argument, when the call did not explicitly
2971060aff23f72135f8b50034a1e80f16725ebc56cTed Kremenek/// supply arguments for all of the parameters.
2981060aff23f72135f8b50034a1e80f16725ebc56cTed Kremenekclass CXXDefaultArgExpr : public Expr {
2991060aff23f72135f8b50034a1e80f16725ebc56cTed Kremenek  ParmVarDecl *Param;
3001060aff23f72135f8b50034a1e80f16725ebc56cTed Kremenekpublic:
3011060aff23f72135f8b50034a1e80f16725ebc56cTed Kremenek  // Param is the parameter whose default argument is used by this
3021060aff23f72135f8b50034a1e80f16725ebc56cTed Kremenek  // expression.
3031060aff23f72135f8b50034a1e80f16725ebc56cTed Kremenek  explicit CXXDefaultArgExpr(ParmVarDecl *param)
3041060aff23f72135f8b50034a1e80f16725ebc56cTed Kremenek    : Expr(CXXDefaultArgExprClass, param->getDefaultArg()->getType()),
3051060aff23f72135f8b50034a1e80f16725ebc56cTed Kremenek      Param(param) { }
3061060aff23f72135f8b50034a1e80f16725ebc56cTed Kremenek
3071060aff23f72135f8b50034a1e80f16725ebc56cTed Kremenek  // Retrieve the parameter that the argument was created from.
3081060aff23f72135f8b50034a1e80f16725ebc56cTed Kremenek  const ParmVarDecl *getParam() const { return Param; }
3091060aff23f72135f8b50034a1e80f16725ebc56cTed Kremenek  ParmVarDecl *getParam() { return Param; }
3101060aff23f72135f8b50034a1e80f16725ebc56cTed Kremenek
3111060aff23f72135f8b50034a1e80f16725ebc56cTed Kremenek  // Retrieve the actual argument to the function call.
3121060aff23f72135f8b50034a1e80f16725ebc56cTed Kremenek  const Expr *getExpr() const { return Param->getDefaultArg(); }
3131060aff23f72135f8b50034a1e80f16725ebc56cTed Kremenek  Expr *getExpr() { return Param->getDefaultArg(); }
3141060aff23f72135f8b50034a1e80f16725ebc56cTed Kremenek
3151060aff23f72135f8b50034a1e80f16725ebc56cTed Kremenek  virtual SourceRange getSourceRange() const {
3161060aff23f72135f8b50034a1e80f16725ebc56cTed Kremenek    // Default argument expressions have no representation in the
3171060aff23f72135f8b50034a1e80f16725ebc56cTed Kremenek    // source, so they have an empty source range.
3181060aff23f72135f8b50034a1e80f16725ebc56cTed Kremenek    return SourceRange();
3191060aff23f72135f8b50034a1e80f16725ebc56cTed Kremenek  }
3201060aff23f72135f8b50034a1e80f16725ebc56cTed Kremenek
3211060aff23f72135f8b50034a1e80f16725ebc56cTed Kremenek  static bool classof(const Stmt *T) {
3221060aff23f72135f8b50034a1e80f16725ebc56cTed Kremenek    return T->getStmtClass() == CXXDefaultArgExprClass;
3231060aff23f72135f8b50034a1e80f16725ebc56cTed Kremenek  }
3241060aff23f72135f8b50034a1e80f16725ebc56cTed Kremenek  static bool classof(const CXXDefaultArgExpr *) { return true; }
3251060aff23f72135f8b50034a1e80f16725ebc56cTed Kremenek
3261060aff23f72135f8b50034a1e80f16725ebc56cTed Kremenek  // Iterators
3271060aff23f72135f8b50034a1e80f16725ebc56cTed Kremenek  virtual child_iterator child_begin();
3281060aff23f72135f8b50034a1e80f16725ebc56cTed Kremenek  virtual child_iterator child_end();
3291060aff23f72135f8b50034a1e80f16725ebc56cTed Kremenek
3301060aff23f72135f8b50034a1e80f16725ebc56cTed Kremenek  // Serialization
3311060aff23f72135f8b50034a1e80f16725ebc56cTed Kremenek  virtual void EmitImpl(llvm::Serializer& S) const;
3321060aff23f72135f8b50034a1e80f16725ebc56cTed Kremenek  static CXXDefaultArgExpr* CreateImpl(llvm::Deserializer& D,
3331060aff23f72135f8b50034a1e80f16725ebc56cTed Kremenek                                       ASTContext& C);
3341060aff23f72135f8b50034a1e80f16725ebc56cTed Kremenek};
335987a14bf5883ef6e5d07f1c83eb6d41a8212a78cArgyrios Kyrtzidis
33649badde06e066d058d6c7fcf4e628a72999b65a9Douglas Gregor/// CXXFunctionalCastExpr - Represents an explicit C++ type conversion
33749badde06e066d058d6c7fcf4e628a72999b65a9Douglas Gregor/// that uses "functional" notion (C++ [expr.type.conv]). Example: @c
33849badde06e066d058d6c7fcf4e628a72999b65a9Douglas Gregor/// x = int(0.5);
33949badde06e066d058d6c7fcf4e628a72999b65a9Douglas Gregorclass CXXFunctionalCastExpr : public ExplicitCastExpr {
340987a14bf5883ef6e5d07f1c83eb6d41a8212a78cArgyrios Kyrtzidis  SourceLocation TyBeginLoc;
341987a14bf5883ef6e5d07f1c83eb6d41a8212a78cArgyrios Kyrtzidis  SourceLocation RParenLoc;
342987a14bf5883ef6e5d07f1c83eb6d41a8212a78cArgyrios Kyrtzidispublic:
34349badde06e066d058d6c7fcf4e628a72999b65a9Douglas Gregor  CXXFunctionalCastExpr(QualType ty, QualType writtenTy,
34449badde06e066d058d6c7fcf4e628a72999b65a9Douglas Gregor                        SourceLocation tyBeginLoc, Expr *castExpr,
345987a14bf5883ef6e5d07f1c83eb6d41a8212a78cArgyrios Kyrtzidis                        SourceLocation rParenLoc) :
34649badde06e066d058d6c7fcf4e628a72999b65a9Douglas Gregor    ExplicitCastExpr(CXXFunctionalCastExprClass, ty, castExpr, writtenTy),
347987a14bf5883ef6e5d07f1c83eb6d41a8212a78cArgyrios Kyrtzidis    TyBeginLoc(tyBeginLoc), RParenLoc(rParenLoc) {}
348987a14bf5883ef6e5d07f1c83eb6d41a8212a78cArgyrios Kyrtzidis
349987a14bf5883ef6e5d07f1c83eb6d41a8212a78cArgyrios Kyrtzidis  SourceLocation getTypeBeginLoc() const { return TyBeginLoc; }
350987a14bf5883ef6e5d07f1c83eb6d41a8212a78cArgyrios Kyrtzidis  SourceLocation getRParenLoc() const { return RParenLoc; }
351987a14bf5883ef6e5d07f1c83eb6d41a8212a78cArgyrios Kyrtzidis
352987a14bf5883ef6e5d07f1c83eb6d41a8212a78cArgyrios Kyrtzidis  virtual SourceRange getSourceRange() const {
353987a14bf5883ef6e5d07f1c83eb6d41a8212a78cArgyrios Kyrtzidis    return SourceRange(TyBeginLoc, RParenLoc);
354987a14bf5883ef6e5d07f1c83eb6d41a8212a78cArgyrios Kyrtzidis  }
355987a14bf5883ef6e5d07f1c83eb6d41a8212a78cArgyrios Kyrtzidis  static bool classof(const Stmt *T) {
356987a14bf5883ef6e5d07f1c83eb6d41a8212a78cArgyrios Kyrtzidis    return T->getStmtClass() == CXXFunctionalCastExprClass;
357987a14bf5883ef6e5d07f1c83eb6d41a8212a78cArgyrios Kyrtzidis  }
358987a14bf5883ef6e5d07f1c83eb6d41a8212a78cArgyrios Kyrtzidis  static bool classof(const CXXFunctionalCastExpr *) { return true; }
359987a14bf5883ef6e5d07f1c83eb6d41a8212a78cArgyrios Kyrtzidis
360987a14bf5883ef6e5d07f1c83eb6d41a8212a78cArgyrios Kyrtzidis  virtual void EmitImpl(llvm::Serializer& S) const;
361987a14bf5883ef6e5d07f1c83eb6d41a8212a78cArgyrios Kyrtzidis  static CXXFunctionalCastExpr *
362987a14bf5883ef6e5d07f1c83eb6d41a8212a78cArgyrios Kyrtzidis      CreateImpl(llvm::Deserializer& D, ASTContext& C);
363987a14bf5883ef6e5d07f1c83eb6d41a8212a78cArgyrios Kyrtzidis};
364987a14bf5883ef6e5d07f1c83eb6d41a8212a78cArgyrios Kyrtzidis
365987a14bf5883ef6e5d07f1c83eb6d41a8212a78cArgyrios Kyrtzidis/// CXXZeroInitValueExpr - [C++ 5.2.3p2]
366987a14bf5883ef6e5d07f1c83eb6d41a8212a78cArgyrios Kyrtzidis/// Expression "T()" which creates a value-initialized Rvalue of non-class
367987a14bf5883ef6e5d07f1c83eb6d41a8212a78cArgyrios Kyrtzidis/// type T.
368987a14bf5883ef6e5d07f1c83eb6d41a8212a78cArgyrios Kyrtzidis///
369987a14bf5883ef6e5d07f1c83eb6d41a8212a78cArgyrios Kyrtzidisclass CXXZeroInitValueExpr : public Expr {
370987a14bf5883ef6e5d07f1c83eb6d41a8212a78cArgyrios Kyrtzidis  SourceLocation TyBeginLoc;
371987a14bf5883ef6e5d07f1c83eb6d41a8212a78cArgyrios Kyrtzidis  SourceLocation RParenLoc;
372987a14bf5883ef6e5d07f1c83eb6d41a8212a78cArgyrios Kyrtzidis
373987a14bf5883ef6e5d07f1c83eb6d41a8212a78cArgyrios Kyrtzidispublic:
374987a14bf5883ef6e5d07f1c83eb6d41a8212a78cArgyrios Kyrtzidis  CXXZeroInitValueExpr(QualType ty, SourceLocation tyBeginLoc,
375987a14bf5883ef6e5d07f1c83eb6d41a8212a78cArgyrios Kyrtzidis                       SourceLocation rParenLoc ) :
376987a14bf5883ef6e5d07f1c83eb6d41a8212a78cArgyrios Kyrtzidis    Expr(CXXZeroInitValueExprClass, ty),
377987a14bf5883ef6e5d07f1c83eb6d41a8212a78cArgyrios Kyrtzidis    TyBeginLoc(tyBeginLoc), RParenLoc(rParenLoc) {}
378987a14bf5883ef6e5d07f1c83eb6d41a8212a78cArgyrios Kyrtzidis
379987a14bf5883ef6e5d07f1c83eb6d41a8212a78cArgyrios Kyrtzidis  SourceLocation getTypeBeginLoc() const { return TyBeginLoc; }
380987a14bf5883ef6e5d07f1c83eb6d41a8212a78cArgyrios Kyrtzidis  SourceLocation getRParenLoc() const { return RParenLoc; }
381987a14bf5883ef6e5d07f1c83eb6d41a8212a78cArgyrios Kyrtzidis
382987a14bf5883ef6e5d07f1c83eb6d41a8212a78cArgyrios Kyrtzidis  virtual SourceRange getSourceRange() const {
383987a14bf5883ef6e5d07f1c83eb6d41a8212a78cArgyrios Kyrtzidis    return SourceRange(TyBeginLoc, RParenLoc);
384987a14bf5883ef6e5d07f1c83eb6d41a8212a78cArgyrios Kyrtzidis  }
385987a14bf5883ef6e5d07f1c83eb6d41a8212a78cArgyrios Kyrtzidis
386987a14bf5883ef6e5d07f1c83eb6d41a8212a78cArgyrios Kyrtzidis  static bool classof(const Stmt *T) {
387987a14bf5883ef6e5d07f1c83eb6d41a8212a78cArgyrios Kyrtzidis    return T->getStmtClass() == CXXZeroInitValueExprClass;
388987a14bf5883ef6e5d07f1c83eb6d41a8212a78cArgyrios Kyrtzidis  }
389987a14bf5883ef6e5d07f1c83eb6d41a8212a78cArgyrios Kyrtzidis  static bool classof(const CXXZeroInitValueExpr *) { return true; }
390987a14bf5883ef6e5d07f1c83eb6d41a8212a78cArgyrios Kyrtzidis
391987a14bf5883ef6e5d07f1c83eb6d41a8212a78cArgyrios Kyrtzidis  // Iterators
392987a14bf5883ef6e5d07f1c83eb6d41a8212a78cArgyrios Kyrtzidis  virtual child_iterator child_begin();
393987a14bf5883ef6e5d07f1c83eb6d41a8212a78cArgyrios Kyrtzidis  virtual child_iterator child_end();
394987a14bf5883ef6e5d07f1c83eb6d41a8212a78cArgyrios Kyrtzidis
395987a14bf5883ef6e5d07f1c83eb6d41a8212a78cArgyrios Kyrtzidis  virtual void EmitImpl(llvm::Serializer& S) const;
396987a14bf5883ef6e5d07f1c83eb6d41a8212a78cArgyrios Kyrtzidis  static CXXZeroInitValueExpr *
397987a14bf5883ef6e5d07f1c83eb6d41a8212a78cArgyrios Kyrtzidis      CreateImpl(llvm::Deserializer& D, ASTContext& C);
398987a14bf5883ef6e5d07f1c83eb6d41a8212a78cArgyrios Kyrtzidis};
399987a14bf5883ef6e5d07f1c83eb6d41a8212a78cArgyrios Kyrtzidis
4009e922b1663ecb95dc7eee03002fd66ed18fb3192Argyrios Kyrtzidis/// CXXConditionDeclExpr - Condition declaration of a if/switch/while/for
4019e922b1663ecb95dc7eee03002fd66ed18fb3192Argyrios Kyrtzidis/// statement, e.g: "if (int x = f()) {...}".
4029e922b1663ecb95dc7eee03002fd66ed18fb3192Argyrios Kyrtzidis/// The main difference with DeclRefExpr is that CXXConditionDeclExpr owns the
4039e922b1663ecb95dc7eee03002fd66ed18fb3192Argyrios Kyrtzidis/// decl that it references.
4049e922b1663ecb95dc7eee03002fd66ed18fb3192Argyrios Kyrtzidis///
4059e922b1663ecb95dc7eee03002fd66ed18fb3192Argyrios Kyrtzidisclass CXXConditionDeclExpr : public DeclRefExpr {
4069e922b1663ecb95dc7eee03002fd66ed18fb3192Argyrios Kyrtzidispublic:
4079e922b1663ecb95dc7eee03002fd66ed18fb3192Argyrios Kyrtzidis  CXXConditionDeclExpr(SourceLocation startLoc,
4089e922b1663ecb95dc7eee03002fd66ed18fb3192Argyrios Kyrtzidis                       SourceLocation eqLoc, VarDecl *var)
4099d293dfc0ad7c44ae0b5eb9517f1ed8c8d8b7ff7Douglas Gregor    : DeclRefExpr(CXXConditionDeclExprClass, var,
4109d293dfc0ad7c44ae0b5eb9517f1ed8c8d8b7ff7Douglas Gregor                  var->getType().getNonReferenceType(), startLoc) {}
4119e922b1663ecb95dc7eee03002fd66ed18fb3192Argyrios Kyrtzidis
4129e922b1663ecb95dc7eee03002fd66ed18fb3192Argyrios Kyrtzidis  virtual void Destroy(ASTContext& Ctx);
4139e922b1663ecb95dc7eee03002fd66ed18fb3192Argyrios Kyrtzidis
4149e922b1663ecb95dc7eee03002fd66ed18fb3192Argyrios Kyrtzidis  SourceLocation getStartLoc() const { return getLocation(); }
4159e922b1663ecb95dc7eee03002fd66ed18fb3192Argyrios Kyrtzidis
4169e922b1663ecb95dc7eee03002fd66ed18fb3192Argyrios Kyrtzidis  VarDecl *getVarDecl() { return cast<VarDecl>(getDecl()); }
4179e922b1663ecb95dc7eee03002fd66ed18fb3192Argyrios Kyrtzidis  const VarDecl *getVarDecl() const { return cast<VarDecl>(getDecl()); }
4189e922b1663ecb95dc7eee03002fd66ed18fb3192Argyrios Kyrtzidis
4199e922b1663ecb95dc7eee03002fd66ed18fb3192Argyrios Kyrtzidis  virtual SourceRange getSourceRange() const {
4209e922b1663ecb95dc7eee03002fd66ed18fb3192Argyrios Kyrtzidis    return SourceRange(getStartLoc(), getVarDecl()->getInit()->getLocEnd());
4219e922b1663ecb95dc7eee03002fd66ed18fb3192Argyrios Kyrtzidis  }
4229e922b1663ecb95dc7eee03002fd66ed18fb3192Argyrios Kyrtzidis
4239e922b1663ecb95dc7eee03002fd66ed18fb3192Argyrios Kyrtzidis  static bool classof(const Stmt *T) {
4249e922b1663ecb95dc7eee03002fd66ed18fb3192Argyrios Kyrtzidis    return T->getStmtClass() == CXXConditionDeclExprClass;
4259e922b1663ecb95dc7eee03002fd66ed18fb3192Argyrios Kyrtzidis  }
4269e922b1663ecb95dc7eee03002fd66ed18fb3192Argyrios Kyrtzidis  static bool classof(const CXXConditionDeclExpr *) { return true; }
4279e922b1663ecb95dc7eee03002fd66ed18fb3192Argyrios Kyrtzidis
4289e922b1663ecb95dc7eee03002fd66ed18fb3192Argyrios Kyrtzidis  // Iterators
4299e922b1663ecb95dc7eee03002fd66ed18fb3192Argyrios Kyrtzidis  virtual child_iterator child_begin();
4309e922b1663ecb95dc7eee03002fd66ed18fb3192Argyrios Kyrtzidis  virtual child_iterator child_end();
4319e922b1663ecb95dc7eee03002fd66ed18fb3192Argyrios Kyrtzidis
4329e922b1663ecb95dc7eee03002fd66ed18fb3192Argyrios Kyrtzidis  // FIXME: Implement these.
4339e922b1663ecb95dc7eee03002fd66ed18fb3192Argyrios Kyrtzidis  //virtual void EmitImpl(llvm::Serializer& S) const;
4349e922b1663ecb95dc7eee03002fd66ed18fb3192Argyrios Kyrtzidis  //static CXXConditionDeclExpr *
4359e922b1663ecb95dc7eee03002fd66ed18fb3192Argyrios Kyrtzidis  //    CreateImpl(llvm::Deserializer& D, ASTContext& C);
4369e922b1663ecb95dc7eee03002fd66ed18fb3192Argyrios Kyrtzidis};
4379e922b1663ecb95dc7eee03002fd66ed18fb3192Argyrios Kyrtzidis
4384c5d320a7581f4b80b151630c91cea5727fa9923Sebastian Redl/// CXXNewExpr - A new expression for memory allocation and constructor calls,
4394c5d320a7581f4b80b151630c91cea5727fa9923Sebastian Redl/// e.g: "new CXXNewExpr(foo)".
4404c5d320a7581f4b80b151630c91cea5727fa9923Sebastian Redlclass CXXNewExpr : public Expr {
4414c5d320a7581f4b80b151630c91cea5727fa9923Sebastian Redl  // Was the usage ::new, i.e. is the global new to be used?
4424c5d320a7581f4b80b151630c91cea5727fa9923Sebastian Redl  bool GlobalNew : 1;
4434c5d320a7581f4b80b151630c91cea5727fa9923Sebastian Redl  // Was the form (type-id) used? Otherwise, it was new-type-id.
4444c5d320a7581f4b80b151630c91cea5727fa9923Sebastian Redl  bool ParenTypeId : 1;
4454c5d320a7581f4b80b151630c91cea5727fa9923Sebastian Redl  // Is there an initializer? If not, built-ins are uninitialized, else they're
4464c5d320a7581f4b80b151630c91cea5727fa9923Sebastian Redl  // value-initialized.
4474c5d320a7581f4b80b151630c91cea5727fa9923Sebastian Redl  bool Initializer : 1;
4484c5d320a7581f4b80b151630c91cea5727fa9923Sebastian Redl  // The number of placement new arguments.
4494c5d320a7581f4b80b151630c91cea5727fa9923Sebastian Redl  unsigned NumPlacementArgs : 14;
4504c5d320a7581f4b80b151630c91cea5727fa9923Sebastian Redl  // The number of constructor arguments. This may be 1 even for non-class
4514c5d320a7581f4b80b151630c91cea5727fa9923Sebastian Redl  // types; use the pseudo copy constructor.
4524c5d320a7581f4b80b151630c91cea5727fa9923Sebastian Redl  unsigned NumConstructorArgs : 15;
4534c5d320a7581f4b80b151630c91cea5727fa9923Sebastian Redl  // Contains any number of optional placement arguments, and any number of
4544c5d320a7581f4b80b151630c91cea5727fa9923Sebastian Redl  // optional constructor arguments, in that order.
4554c5d320a7581f4b80b151630c91cea5727fa9923Sebastian Redl  Stmt **SubExprs;
4564c5d320a7581f4b80b151630c91cea5727fa9923Sebastian Redl  // Points to the allocation function used.
4574c5d320a7581f4b80b151630c91cea5727fa9923Sebastian Redl  FunctionDecl *OperatorNew;
4584c5d320a7581f4b80b151630c91cea5727fa9923Sebastian Redl  // Points to the deallocation function used in case of error. May be null.
4594c5d320a7581f4b80b151630c91cea5727fa9923Sebastian Redl  FunctionDecl *OperatorDelete;
4604c5d320a7581f4b80b151630c91cea5727fa9923Sebastian Redl  // Points to the constructor used. Cannot be null if AllocType is a record;
4614c5d320a7581f4b80b151630c91cea5727fa9923Sebastian Redl  // it would still point at the default constructor (even an implicit one).
4624c5d320a7581f4b80b151630c91cea5727fa9923Sebastian Redl  // Must be null for all other types.
4634c5d320a7581f4b80b151630c91cea5727fa9923Sebastian Redl  CXXConstructorDecl *Constructor;
4644c5d320a7581f4b80b151630c91cea5727fa9923Sebastian Redl  // The type to be allocated. Is either *ty or a VLA of that type.
4654c5d320a7581f4b80b151630c91cea5727fa9923Sebastian Redl  QualType AllocType;
4664c5d320a7581f4b80b151630c91cea5727fa9923Sebastian Redl
4674c5d320a7581f4b80b151630c91cea5727fa9923Sebastian Redl  SourceLocation StartLoc;
4684c5d320a7581f4b80b151630c91cea5727fa9923Sebastian Redl  SourceLocation EndLoc;
4694c5d320a7581f4b80b151630c91cea5727fa9923Sebastian Redl
4704c5d320a7581f4b80b151630c91cea5727fa9923Sebastian Redl  // Deserialization constructor
4714c5d320a7581f4b80b151630c91cea5727fa9923Sebastian Redl  CXXNewExpr(QualType ty, QualType alloc, bool globalNew, bool parenTypeId,
4724c5d320a7581f4b80b151630c91cea5727fa9923Sebastian Redl             bool initializer, unsigned numPlacementArgs,
4734c5d320a7581f4b80b151630c91cea5727fa9923Sebastian Redl             unsigned numConstructorArgs, Stmt **subExprs,
4744c5d320a7581f4b80b151630c91cea5727fa9923Sebastian Redl             FunctionDecl *operatorNew, FunctionDecl *operatorDelete,
4754c5d320a7581f4b80b151630c91cea5727fa9923Sebastian Redl             CXXConstructorDecl *constructor, SourceLocation startLoc,
4764c5d320a7581f4b80b151630c91cea5727fa9923Sebastian Redl             SourceLocation endLoc)
4774c5d320a7581f4b80b151630c91cea5727fa9923Sebastian Redl    : Expr(CXXNewExprClass, ty), GlobalNew(globalNew), ParenTypeId(parenTypeId),
4784c5d320a7581f4b80b151630c91cea5727fa9923Sebastian Redl      Initializer(initializer), NumPlacementArgs(numPlacementArgs),
4794c5d320a7581f4b80b151630c91cea5727fa9923Sebastian Redl      NumConstructorArgs(numConstructorArgs), SubExprs(subExprs),
4804c5d320a7581f4b80b151630c91cea5727fa9923Sebastian Redl      OperatorNew(operatorNew), OperatorDelete(operatorDelete),
4814c5d320a7581f4b80b151630c91cea5727fa9923Sebastian Redl      Constructor(constructor), AllocType(alloc),
4824c5d320a7581f4b80b151630c91cea5727fa9923Sebastian Redl      StartLoc(startLoc), EndLoc(endLoc)
4834c5d320a7581f4b80b151630c91cea5727fa9923Sebastian Redl  { }
4844c5d320a7581f4b80b151630c91cea5727fa9923Sebastian Redlpublic:
4854c5d320a7581f4b80b151630c91cea5727fa9923Sebastian Redl  CXXNewExpr(bool globalNew, FunctionDecl *operatorNew, Expr **placementArgs,
4864c5d320a7581f4b80b151630c91cea5727fa9923Sebastian Redl             unsigned numPlaceArgs, bool ParenTypeId, QualType alloc,
4874c5d320a7581f4b80b151630c91cea5727fa9923Sebastian Redl             CXXConstructorDecl *constructor, bool initializer,
4884c5d320a7581f4b80b151630c91cea5727fa9923Sebastian Redl             Expr **constructorArgs, unsigned numConsArgs,
4894c5d320a7581f4b80b151630c91cea5727fa9923Sebastian Redl             FunctionDecl *operatorDelete, QualType ty,
4904c5d320a7581f4b80b151630c91cea5727fa9923Sebastian Redl             SourceLocation startLoc, SourceLocation endLoc);
4914c5d320a7581f4b80b151630c91cea5727fa9923Sebastian Redl  ~CXXNewExpr() {
4924c5d320a7581f4b80b151630c91cea5727fa9923Sebastian Redl    delete[] SubExprs;
4934c5d320a7581f4b80b151630c91cea5727fa9923Sebastian Redl  }
4944c5d320a7581f4b80b151630c91cea5727fa9923Sebastian Redl
4954c5d320a7581f4b80b151630c91cea5727fa9923Sebastian Redl  QualType getAllocatedType() const { return AllocType; }
4964c5d320a7581f4b80b151630c91cea5727fa9923Sebastian Redl
4974c5d320a7581f4b80b151630c91cea5727fa9923Sebastian Redl  FunctionDecl *getOperatorNew() const { return OperatorNew; }
4984c5d320a7581f4b80b151630c91cea5727fa9923Sebastian Redl  FunctionDecl *getOperatorDelete() const { return OperatorDelete; }
4994c5d320a7581f4b80b151630c91cea5727fa9923Sebastian Redl  CXXConstructorDecl *getConstructor() const { return Constructor; }
5004c5d320a7581f4b80b151630c91cea5727fa9923Sebastian Redl
5014c5d320a7581f4b80b151630c91cea5727fa9923Sebastian Redl  unsigned getNumPlacementArgs() const { return NumPlacementArgs; }
5024c5d320a7581f4b80b151630c91cea5727fa9923Sebastian Redl  Expr *getPlacementArg(unsigned i) {
5034c5d320a7581f4b80b151630c91cea5727fa9923Sebastian Redl    assert(i < NumPlacementArgs && "Index out of range");
5044c5d320a7581f4b80b151630c91cea5727fa9923Sebastian Redl    return cast<Expr>(SubExprs[i]);
5054c5d320a7581f4b80b151630c91cea5727fa9923Sebastian Redl  }
5064c5d320a7581f4b80b151630c91cea5727fa9923Sebastian Redl  const Expr *getPlacementArg(unsigned i) const {
5074c5d320a7581f4b80b151630c91cea5727fa9923Sebastian Redl    assert(i < NumPlacementArgs && "Index out of range");
5084c5d320a7581f4b80b151630c91cea5727fa9923Sebastian Redl    return cast<Expr>(SubExprs[i]);
5094c5d320a7581f4b80b151630c91cea5727fa9923Sebastian Redl  }
5104c5d320a7581f4b80b151630c91cea5727fa9923Sebastian Redl
5114c5d320a7581f4b80b151630c91cea5727fa9923Sebastian Redl  bool isGlobalNew() const { return GlobalNew; }
5124c5d320a7581f4b80b151630c91cea5727fa9923Sebastian Redl  bool isParenTypeId() const { return ParenTypeId; }
5134c5d320a7581f4b80b151630c91cea5727fa9923Sebastian Redl  bool hasInitializer() const { return Initializer; }
5144c5d320a7581f4b80b151630c91cea5727fa9923Sebastian Redl
5154c5d320a7581f4b80b151630c91cea5727fa9923Sebastian Redl  unsigned getNumConstructorArgs() const { return NumConstructorArgs; }
5164c5d320a7581f4b80b151630c91cea5727fa9923Sebastian Redl  Expr *getConstructorArg(unsigned i) {
5174c5d320a7581f4b80b151630c91cea5727fa9923Sebastian Redl    assert(i < NumConstructorArgs && "Index out of range");
5184c5d320a7581f4b80b151630c91cea5727fa9923Sebastian Redl    return cast<Expr>(SubExprs[NumPlacementArgs + i]);
5194c5d320a7581f4b80b151630c91cea5727fa9923Sebastian Redl  }
5204c5d320a7581f4b80b151630c91cea5727fa9923Sebastian Redl  const Expr *getConstructorArg(unsigned i) const {
5214c5d320a7581f4b80b151630c91cea5727fa9923Sebastian Redl    assert(i < NumConstructorArgs && "Index out of range");
5224c5d320a7581f4b80b151630c91cea5727fa9923Sebastian Redl    return cast<Expr>(SubExprs[NumPlacementArgs + i]);
5234c5d320a7581f4b80b151630c91cea5727fa9923Sebastian Redl  }
5244c5d320a7581f4b80b151630c91cea5727fa9923Sebastian Redl
5254c5d320a7581f4b80b151630c91cea5727fa9923Sebastian Redl  typedef ExprIterator arg_iterator;
5264c5d320a7581f4b80b151630c91cea5727fa9923Sebastian Redl  typedef ConstExprIterator const_arg_iterator;
5274c5d320a7581f4b80b151630c91cea5727fa9923Sebastian Redl
5284c5d320a7581f4b80b151630c91cea5727fa9923Sebastian Redl  arg_iterator placement_arg_begin() {
5294c5d320a7581f4b80b151630c91cea5727fa9923Sebastian Redl    return SubExprs;
5304c5d320a7581f4b80b151630c91cea5727fa9923Sebastian Redl  }
5314c5d320a7581f4b80b151630c91cea5727fa9923Sebastian Redl  arg_iterator placement_arg_end() {
5324c5d320a7581f4b80b151630c91cea5727fa9923Sebastian Redl    return SubExprs + getNumPlacementArgs();
5334c5d320a7581f4b80b151630c91cea5727fa9923Sebastian Redl  }
5344c5d320a7581f4b80b151630c91cea5727fa9923Sebastian Redl  const_arg_iterator placement_arg_begin() const {
5354c5d320a7581f4b80b151630c91cea5727fa9923Sebastian Redl    return SubExprs;
5364c5d320a7581f4b80b151630c91cea5727fa9923Sebastian Redl  }
5374c5d320a7581f4b80b151630c91cea5727fa9923Sebastian Redl  const_arg_iterator placement_arg_end() const {
5384c5d320a7581f4b80b151630c91cea5727fa9923Sebastian Redl    return SubExprs + getNumPlacementArgs();
5394c5d320a7581f4b80b151630c91cea5727fa9923Sebastian Redl  }
5404c5d320a7581f4b80b151630c91cea5727fa9923Sebastian Redl
5414c5d320a7581f4b80b151630c91cea5727fa9923Sebastian Redl  arg_iterator constructor_arg_begin() {
5424c5d320a7581f4b80b151630c91cea5727fa9923Sebastian Redl    return SubExprs + getNumPlacementArgs();
5434c5d320a7581f4b80b151630c91cea5727fa9923Sebastian Redl  }
5444c5d320a7581f4b80b151630c91cea5727fa9923Sebastian Redl  arg_iterator constructor_arg_end() {
5454c5d320a7581f4b80b151630c91cea5727fa9923Sebastian Redl    return SubExprs + getNumPlacementArgs() + getNumConstructorArgs();
5464c5d320a7581f4b80b151630c91cea5727fa9923Sebastian Redl  }
5474c5d320a7581f4b80b151630c91cea5727fa9923Sebastian Redl  const_arg_iterator constructor_arg_begin() const {
5484c5d320a7581f4b80b151630c91cea5727fa9923Sebastian Redl    return SubExprs + getNumPlacementArgs();
5494c5d320a7581f4b80b151630c91cea5727fa9923Sebastian Redl  }
5504c5d320a7581f4b80b151630c91cea5727fa9923Sebastian Redl  const_arg_iterator constructor_arg_end() const {
5514c5d320a7581f4b80b151630c91cea5727fa9923Sebastian Redl    return SubExprs + getNumPlacementArgs() + getNumConstructorArgs();
5524c5d320a7581f4b80b151630c91cea5727fa9923Sebastian Redl  }
5534c5d320a7581f4b80b151630c91cea5727fa9923Sebastian Redl
5544c5d320a7581f4b80b151630c91cea5727fa9923Sebastian Redl  virtual SourceRange getSourceRange() const {
5554c5d320a7581f4b80b151630c91cea5727fa9923Sebastian Redl    return SourceRange(StartLoc, EndLoc);
5564c5d320a7581f4b80b151630c91cea5727fa9923Sebastian Redl  }
5574c5d320a7581f4b80b151630c91cea5727fa9923Sebastian Redl
5584c5d320a7581f4b80b151630c91cea5727fa9923Sebastian Redl  static bool classof(const Stmt *T) {
5594c5d320a7581f4b80b151630c91cea5727fa9923Sebastian Redl    return T->getStmtClass() == CXXNewExprClass;
5604c5d320a7581f4b80b151630c91cea5727fa9923Sebastian Redl  }
5614c5d320a7581f4b80b151630c91cea5727fa9923Sebastian Redl  static bool classof(const CXXNewExpr *) { return true; }
5624c5d320a7581f4b80b151630c91cea5727fa9923Sebastian Redl
5634c5d320a7581f4b80b151630c91cea5727fa9923Sebastian Redl  // Iterators
5644c5d320a7581f4b80b151630c91cea5727fa9923Sebastian Redl  virtual child_iterator child_begin();
5654c5d320a7581f4b80b151630c91cea5727fa9923Sebastian Redl  virtual child_iterator child_end();
5664c5d320a7581f4b80b151630c91cea5727fa9923Sebastian Redl
5674c5d320a7581f4b80b151630c91cea5727fa9923Sebastian Redl  virtual void EmitImpl(llvm::Serializer& S) const;
5684c5d320a7581f4b80b151630c91cea5727fa9923Sebastian Redl  static CXXNewExpr* CreateImpl(llvm::Deserializer& D, ASTContext& C);
5694c5d320a7581f4b80b151630c91cea5727fa9923Sebastian Redl};
5704c5d320a7581f4b80b151630c91cea5727fa9923Sebastian Redl
5714c5d320a7581f4b80b151630c91cea5727fa9923Sebastian Redl/// CXXDeleteExpr - A delete expression for memory deallocation and destructor
5724c5d320a7581f4b80b151630c91cea5727fa9923Sebastian Redl/// calls, e.g. "delete[] pArray".
5734c5d320a7581f4b80b151630c91cea5727fa9923Sebastian Redlclass CXXDeleteExpr : public Expr {
5744c5d320a7581f4b80b151630c91cea5727fa9923Sebastian Redl  // Is this a forced global delete, i.e. "::delete"?
5754c5d320a7581f4b80b151630c91cea5727fa9923Sebastian Redl  bool GlobalDelete : 1;
5764c5d320a7581f4b80b151630c91cea5727fa9923Sebastian Redl  // Is this the array form of delete, i.e. "delete[]"?
5774c5d320a7581f4b80b151630c91cea5727fa9923Sebastian Redl  bool ArrayForm : 1;
5784c5d320a7581f4b80b151630c91cea5727fa9923Sebastian Redl  // Points to the operator delete overload that is used. Could be a member.
5794c5d320a7581f4b80b151630c91cea5727fa9923Sebastian Redl  FunctionDecl *OperatorDelete;
5804c5d320a7581f4b80b151630c91cea5727fa9923Sebastian Redl  // The pointer expression to be deleted.
5814c5d320a7581f4b80b151630c91cea5727fa9923Sebastian Redl  Stmt *Argument;
5824c5d320a7581f4b80b151630c91cea5727fa9923Sebastian Redl  // Location of the expression.
5834c5d320a7581f4b80b151630c91cea5727fa9923Sebastian Redl  SourceLocation Loc;
5844c5d320a7581f4b80b151630c91cea5727fa9923Sebastian Redlpublic:
5854c5d320a7581f4b80b151630c91cea5727fa9923Sebastian Redl  CXXDeleteExpr(QualType ty, bool globalDelete, bool arrayForm,
5864c5d320a7581f4b80b151630c91cea5727fa9923Sebastian Redl                FunctionDecl *operatorDelete, Expr *arg, SourceLocation loc)
5874c5d320a7581f4b80b151630c91cea5727fa9923Sebastian Redl    : Expr(CXXDeleteExprClass, ty), GlobalDelete(globalDelete),
5884c5d320a7581f4b80b151630c91cea5727fa9923Sebastian Redl      ArrayForm(arrayForm), OperatorDelete(operatorDelete), Argument(arg),
5894c5d320a7581f4b80b151630c91cea5727fa9923Sebastian Redl      Loc(loc) { }
5904c5d320a7581f4b80b151630c91cea5727fa9923Sebastian Redl
5914c5d320a7581f4b80b151630c91cea5727fa9923Sebastian Redl  bool isGlobalDelete() const { return GlobalDelete; }
5924c5d320a7581f4b80b151630c91cea5727fa9923Sebastian Redl  bool isArrayForm() const { return ArrayForm; }
5934c5d320a7581f4b80b151630c91cea5727fa9923Sebastian Redl
5944c5d320a7581f4b80b151630c91cea5727fa9923Sebastian Redl  FunctionDecl *getOperatorDelete() const { return OperatorDelete; }
5954c5d320a7581f4b80b151630c91cea5727fa9923Sebastian Redl
5964c5d320a7581f4b80b151630c91cea5727fa9923Sebastian Redl  Expr *getArgument() { return cast<Expr>(Argument); }
5974c5d320a7581f4b80b151630c91cea5727fa9923Sebastian Redl  const Expr *getArgument() const { return cast<Expr>(Argument); }
5984c5d320a7581f4b80b151630c91cea5727fa9923Sebastian Redl
5994c5d320a7581f4b80b151630c91cea5727fa9923Sebastian Redl  virtual SourceRange getSourceRange() const {
6004c5d320a7581f4b80b151630c91cea5727fa9923Sebastian Redl    return SourceRange(Loc, Argument->getLocEnd());
6014c5d320a7581f4b80b151630c91cea5727fa9923Sebastian Redl  }
6024c5d320a7581f4b80b151630c91cea5727fa9923Sebastian Redl
6034c5d320a7581f4b80b151630c91cea5727fa9923Sebastian Redl  static bool classof(const Stmt *T) {
6044c5d320a7581f4b80b151630c91cea5727fa9923Sebastian Redl    return T->getStmtClass() == CXXDeleteExprClass;
6054c5d320a7581f4b80b151630c91cea5727fa9923Sebastian Redl  }
6064c5d320a7581f4b80b151630c91cea5727fa9923Sebastian Redl  static bool classof(const CXXDeleteExpr *) { return true; }
6074c5d320a7581f4b80b151630c91cea5727fa9923Sebastian Redl
6084c5d320a7581f4b80b151630c91cea5727fa9923Sebastian Redl  // Iterators
6094c5d320a7581f4b80b151630c91cea5727fa9923Sebastian Redl  virtual child_iterator child_begin();
6104c5d320a7581f4b80b151630c91cea5727fa9923Sebastian Redl  virtual child_iterator child_end();
6114c5d320a7581f4b80b151630c91cea5727fa9923Sebastian Redl
6124c5d320a7581f4b80b151630c91cea5727fa9923Sebastian Redl  virtual void EmitImpl(llvm::Serializer& S) const;
6134c5d320a7581f4b80b151630c91cea5727fa9923Sebastian Redl  static CXXDeleteExpr * CreateImpl(llvm::Deserializer& D, ASTContext& C);
6144c5d320a7581f4b80b151630c91cea5727fa9923Sebastian Redl};
6154c5d320a7581f4b80b151630c91cea5727fa9923Sebastian Redl
6165f016e2cb5d11daeb237544de1c5d59f20fe1a6eReid Spencer}  // end namespace clang
6175f016e2cb5d11daeb237544de1c5d59f20fe1a6eReid Spencer
6185f016e2cb5d11daeb237544de1c5d59f20fe1a6eReid Spencer#endif
619