Expr.h revision 2dc9ac73a8a34cabf261a81a1653d7379065ac61
1//===--- Expr.h - Classes for representing expressions ----------*- C++ -*-===//
2//
3//                     The LLVM Compiler Infrastructure
4//
5// This file was developed by Chris Lattner and is distributed under
6// the University of Illinois Open Source License. See LICENSE.TXT for details.
7//
8//===----------------------------------------------------------------------===//
9//
10//  This file defines the Expr interface and subclasses.
11//
12//===----------------------------------------------------------------------===//
13
14#ifndef LLVM_CLANG_AST_EXPR_H
15#define LLVM_CLANG_AST_EXPR_H
16
17#include "clang/AST/Stmt.h"
18#include "clang/AST/Type.h"
19#include "clang/AST/Decl.h"
20#include "clang/Basic/IdentifierTable.h"
21#include "llvm/ADT/APSInt.h"
22#include "llvm/ADT/APFloat.h"
23
24namespace clang {
25  class IdentifierInfo;
26  class Selector;
27  class Decl;
28  class ASTContext;
29
30/// Expr - This represents one expression.  Note that Expr's are subclasses of
31/// Stmt.  This allows an expression to be transparently used any place a Stmt
32/// is required.
33///
34class Expr : public Stmt {
35  QualType TR;
36protected:
37  Expr(StmtClass SC, QualType T) : Stmt(SC), TR(T) {}
38public:
39  QualType getType() const { return TR; }
40  void setType(QualType t) { TR = t; }
41
42  /// SourceLocation tokens are not useful in isolation - they are low level
43  /// value objects created/interpreted by SourceManager. We assume AST
44  /// clients will have a pointer to the respective SourceManager.
45  virtual SourceRange getSourceRange() const = 0;
46
47  /// getExprLoc - Return the preferred location for the arrow when diagnosing
48  /// a problem with a generic expression.
49  virtual SourceLocation getExprLoc() const { return getLocStart(); }
50
51  /// hasLocalSideEffect - Return true if this immediate expression has side
52  /// effects, not counting any sub-expressions.
53  bool hasLocalSideEffect() const;
54
55  /// isLvalue - C99 6.3.2.1: an lvalue is an expression with an object type or
56  /// incomplete type other than void. Nonarray expressions that can be lvalues:
57  ///  - name, where name must be a variable
58  ///  - e[i]
59  ///  - (e), where e must be an lvalue
60  ///  - e.name, where e must be an lvalue
61  ///  - e->name
62  ///  - *e, the type of e cannot be a function type
63  ///  - string-constant
64  ///  - reference type [C++ [expr]]
65  ///
66  enum isLvalueResult {
67    LV_Valid,
68    LV_NotObjectType,
69    LV_IncompleteVoidType,
70    LV_DuplicateVectorComponents,
71    LV_InvalidExpression
72  };
73  isLvalueResult isLvalue() const;
74
75  /// isModifiableLvalue - C99 6.3.2.1: an lvalue that does not have array type,
76  /// does not have an incomplete type, does not have a const-qualified type,
77  /// and if it is a structure or union, does not have any member (including,
78  /// recursively, any member or element of all contained aggregates or unions)
79  /// with a const-qualified type.
80  enum isModifiableLvalueResult {
81    MLV_Valid,
82    MLV_NotObjectType,
83    MLV_IncompleteVoidType,
84    MLV_DuplicateVectorComponents,
85    MLV_InvalidExpression,
86    MLV_IncompleteType,
87    MLV_ConstQualified,
88    MLV_ArrayType
89  };
90  isModifiableLvalueResult isModifiableLvalue() const;
91
92  bool isNullPointerConstant(ASTContext &Ctx) const;
93
94  /// isIntegerConstantExpr - Return true if this expression is a valid integer
95  /// constant expression, and, if so, return its value in Result.  If not a
96  /// valid i-c-e, return false and fill in Loc (if specified) with the location
97  /// of the invalid expression.
98  bool isIntegerConstantExpr(llvm::APSInt &Result, ASTContext &Ctx,
99                             SourceLocation *Loc = 0,
100                             bool isEvaluated = true) const;
101  bool isIntegerConstantExpr(ASTContext &Ctx, SourceLocation *Loc = 0) const {
102    llvm::APSInt X(32);
103    return isIntegerConstantExpr(X, Ctx, Loc);
104  }
105  /// isConstantExpr - Return true if this expression is a valid constant expr.
106  bool isConstantExpr(ASTContext &Ctx, SourceLocation *Loc) const;
107
108  static bool classof(const Stmt *T) {
109    return T->getStmtClass() >= firstExprConstant &&
110           T->getStmtClass() <= lastExprConstant;
111  }
112  static bool classof(const Expr *) { return true; }
113
114  static inline Expr* Materialize(llvm::Deserializer& D) {
115    return cast<Expr>(Stmt::Materialize(D));
116  }
117};
118
119//===----------------------------------------------------------------------===//
120// Primary Expressions.
121//===----------------------------------------------------------------------===//
122
123/// DeclRefExpr - [C99 6.5.1p2] - A reference to a declared variable, function,
124/// enum, etc.
125class DeclRefExpr : public Expr {
126  ValueDecl *D;
127  SourceLocation Loc;
128public:
129  DeclRefExpr(ValueDecl *d, QualType t, SourceLocation l) :
130    Expr(DeclRefExprClass, t), D(d), Loc(l) {}
131
132  ValueDecl *getDecl() { return D; }
133  const ValueDecl *getDecl() const { return D; }
134  virtual SourceRange getSourceRange() const { return SourceRange(Loc); }
135
136
137  static bool classof(const Stmt *T) {
138    return T->getStmtClass() == DeclRefExprClass;
139  }
140  static bool classof(const DeclRefExpr *) { return true; }
141
142  // Iterators
143  virtual child_iterator child_begin();
144  virtual child_iterator child_end();
145
146  virtual void directEmit(llvm::Serializer& S) const;
147  static DeclRefExpr* directMaterialize(llvm::Deserializer& D);
148};
149
150/// PreDefinedExpr - [C99 6.4.2.2] - A pre-defined identifier such as __func__.
151class PreDefinedExpr : public Expr {
152public:
153  enum IdentType {
154    Func,
155    Function,
156    PrettyFunction
157  };
158
159private:
160  SourceLocation Loc;
161  IdentType Type;
162public:
163  PreDefinedExpr(SourceLocation l, QualType type, IdentType IT)
164    : Expr(PreDefinedExprClass, type), Loc(l), Type(IT) {}
165
166  IdentType getIdentType() const { return Type; }
167
168  virtual SourceRange getSourceRange() const { return SourceRange(Loc); }
169
170  static bool classof(const Stmt *T) {
171    return T->getStmtClass() == PreDefinedExprClass;
172  }
173  static bool classof(const PreDefinedExpr *) { return true; }
174
175  // Iterators
176  virtual child_iterator child_begin();
177  virtual child_iterator child_end();
178};
179
180class IntegerLiteral : public Expr {
181  llvm::APInt Value;
182  SourceLocation Loc;
183public:
184  // type should be IntTy, LongTy, LongLongTy, UnsignedIntTy, UnsignedLongTy,
185  // or UnsignedLongLongTy
186  IntegerLiteral(const llvm::APInt &V, QualType type, SourceLocation l)
187    : Expr(IntegerLiteralClass, type), Value(V), Loc(l) {
188    assert(type->isIntegerType() && "Illegal type in IntegerLiteral");
189  }
190  const llvm::APInt &getValue() const { return Value; }
191  virtual SourceRange getSourceRange() const { return SourceRange(Loc); }
192
193  static bool classof(const Stmt *T) {
194    return T->getStmtClass() == IntegerLiteralClass;
195  }
196  static bool classof(const IntegerLiteral *) { return true; }
197
198  // Iterators
199  virtual child_iterator child_begin();
200  virtual child_iterator child_end();
201
202  virtual void directEmit(llvm::Serializer& S) const;
203  static IntegerLiteral* directMaterialize(llvm::Deserializer& D);
204};
205
206class CharacterLiteral : public Expr {
207  unsigned Value;
208  SourceLocation Loc;
209public:
210  // type should be IntTy
211  CharacterLiteral(unsigned value, QualType type, SourceLocation l)
212    : Expr(CharacterLiteralClass, type), Value(value), Loc(l) {
213  }
214  SourceLocation getLoc() const { return Loc; }
215
216  virtual SourceRange getSourceRange() const { return SourceRange(Loc); }
217
218  unsigned getValue() const { return Value; }
219
220  static bool classof(const Stmt *T) {
221    return T->getStmtClass() == CharacterLiteralClass;
222  }
223  static bool classof(const CharacterLiteral *) { return true; }
224
225  // Iterators
226  virtual child_iterator child_begin();
227  virtual child_iterator child_end();
228};
229
230class FloatingLiteral : public Expr {
231  llvm::APFloat Value;
232  SourceLocation Loc;
233public:
234  FloatingLiteral(const llvm::APFloat &V, QualType Type, SourceLocation L)
235    : Expr(FloatingLiteralClass, Type), Value(V), Loc(L) {}
236
237  const llvm::APFloat &getValue() const { return Value; }
238
239  /// getValueAsDouble - This returns the value as an inaccurate double.  Note
240  /// that this may cause loss of precision, but is useful for debugging dumps
241  /// etc.
242  double getValueAsDouble() const {
243    // FIXME: We need something for long double here.
244    if (cast<BuiltinType>(getType())->getKind() == BuiltinType::Float)
245      return Value.convertToFloat();
246    else
247      return Value.convertToDouble();
248  }
249
250  virtual SourceRange getSourceRange() const { return SourceRange(Loc); }
251
252  static bool classof(const Stmt *T) {
253    return T->getStmtClass() == FloatingLiteralClass;
254  }
255  static bool classof(const FloatingLiteral *) { return true; }
256
257  // Iterators
258  virtual child_iterator child_begin();
259  virtual child_iterator child_end();
260};
261
262/// ImaginaryLiteral - We support imaginary integer and floating point literals,
263/// like "1.0i".  We represent these as a wrapper around FloatingLiteral and
264/// IntegerLiteral classes.  Instances of this class always have a Complex type
265/// whose element type matches the subexpression.
266///
267class ImaginaryLiteral : public Expr {
268  Expr *Val;
269public:
270  ImaginaryLiteral(Expr *val, QualType Ty)
271    : Expr(ImaginaryLiteralClass, Ty), Val(val) {}
272
273  const Expr *getSubExpr() const { return Val; }
274  Expr *getSubExpr() { return Val; }
275
276  virtual SourceRange getSourceRange() const { return Val->getSourceRange(); }
277  static bool classof(const Stmt *T) {
278    return T->getStmtClass() == ImaginaryLiteralClass;
279  }
280  static bool classof(const ImaginaryLiteral *) { return true; }
281
282  // Iterators
283  virtual child_iterator child_begin();
284  virtual child_iterator child_end();
285};
286
287/// StringLiteral - This represents a string literal expression, e.g. "foo"
288/// or L"bar" (wide strings).  The actual string is returned by getStrData()
289/// is NOT null-terminated, and the length of the string is determined by
290/// calling getByteLength().
291class StringLiteral : public Expr {
292  const char *StrData;
293  unsigned ByteLength;
294  bool IsWide;
295  // if the StringLiteral was composed using token pasting, both locations
296  // are needed. If not (the common case), firstTokLoc == lastTokLoc.
297  // FIXME: if space becomes an issue, we should create a sub-class.
298  SourceLocation firstTokLoc, lastTokLoc;
299public:
300  StringLiteral(const char *strData, unsigned byteLength, bool Wide,
301                QualType t, SourceLocation b, SourceLocation e);
302  virtual ~StringLiteral();
303
304  const char *getStrData() const { return StrData; }
305  unsigned getByteLength() const { return ByteLength; }
306  bool isWide() const { return IsWide; }
307
308  virtual SourceRange getSourceRange() const {
309    return SourceRange(firstTokLoc,lastTokLoc);
310  }
311  static bool classof(const Stmt *T) {
312    return T->getStmtClass() == StringLiteralClass;
313  }
314  static bool classof(const StringLiteral *) { return true; }
315
316  // Iterators
317  virtual child_iterator child_begin();
318  virtual child_iterator child_end();
319};
320
321/// ParenExpr - This represents a parethesized expression, e.g. "(1)".  This
322/// AST node is only formed if full location information is requested.
323class ParenExpr : public Expr {
324  SourceLocation L, R;
325  Expr *Val;
326public:
327  ParenExpr(SourceLocation l, SourceLocation r, Expr *val)
328    : Expr(ParenExprClass, val->getType()), L(l), R(r), Val(val) {}
329
330  const Expr *getSubExpr() const { return Val; }
331  Expr *getSubExpr() { return Val; }
332  SourceRange getSourceRange() const { return SourceRange(L, R); }
333
334  static bool classof(const Stmt *T) {
335    return T->getStmtClass() == ParenExprClass;
336  }
337  static bool classof(const ParenExpr *) { return true; }
338
339  // Iterators
340  virtual child_iterator child_begin();
341  virtual child_iterator child_end();
342};
343
344
345/// UnaryOperator - This represents the unary-expression's (except sizeof of
346/// types), the postinc/postdec operators from postfix-expression, and various
347/// extensions.
348///
349/// Notes on various nodes:
350///
351/// Real/Imag - These return the real/imag part of a complex operand.  If
352///   applied to a non-complex value, the former returns its operand and the
353///   later returns zero in the type of the operand.
354///
355/// __builtin_offsetof(type, a.b[10]) is represented as a unary operator whose
356///   subexpression is a compound literal with the various MemberExpr and
357///   ArraySubscriptExpr's applied to it.
358///
359class UnaryOperator : public Expr {
360public:
361  // Note that additions to this should also update the StmtVisitor class.
362  enum Opcode {
363    PostInc, PostDec, // [C99 6.5.2.4] Postfix increment and decrement operators
364    PreInc, PreDec,   // [C99 6.5.3.1] Prefix increment and decrement operators.
365    AddrOf, Deref,    // [C99 6.5.3.2] Address and indirection operators.
366    Plus, Minus,      // [C99 6.5.3.3] Unary arithmetic operators.
367    Not, LNot,        // [C99 6.5.3.3] Unary arithmetic operators.
368    SizeOf, AlignOf,  // [C99 6.5.3.4] Sizeof (expr, not type) operator.
369    Real, Imag,       // "__real expr"/"__imag expr" Extension.
370    Extension,        // __extension__ marker.
371    OffsetOf          // __builtin_offsetof
372  };
373private:
374  Expr *Val;
375  Opcode Opc;
376  SourceLocation Loc;
377public:
378
379  UnaryOperator(Expr *input, Opcode opc, QualType type, SourceLocation l)
380    : Expr(UnaryOperatorClass, type), Val(input), Opc(opc), Loc(l) {}
381
382  Opcode getOpcode() const { return Opc; }
383  Expr *getSubExpr() const { return Val; }
384
385  /// getOperatorLoc - Return the location of the operator.
386  SourceLocation getOperatorLoc() const { return Loc; }
387
388  /// isPostfix - Return true if this is a postfix operation, like x++.
389  static bool isPostfix(Opcode Op);
390
391  bool isPostfix() const { return isPostfix(Opc); }
392  bool isIncrementDecrementOp() const { return Opc>=PostInc && Opc<=PreDec; }
393  bool isSizeOfAlignOfOp() const { return Opc == SizeOf || Opc == AlignOf; }
394  static bool isArithmeticOp(Opcode Op) { return Op >= Plus && Op <= LNot; }
395
396  /// getOpcodeStr - Turn an Opcode enum value into the punctuation char it
397  /// corresponds to, e.g. "sizeof" or "[pre]++"
398  static const char *getOpcodeStr(Opcode Op);
399
400  virtual SourceRange getSourceRange() const {
401    if (isPostfix())
402      return SourceRange(Val->getLocStart(), Loc);
403    else
404      return SourceRange(Loc, Val->getLocEnd());
405  }
406  virtual SourceLocation getExprLoc() const { return Loc; }
407
408  static bool classof(const Stmt *T) {
409    return T->getStmtClass() == UnaryOperatorClass;
410  }
411  static bool classof(const UnaryOperator *) { return true; }
412
413  // Iterators
414  virtual child_iterator child_begin();
415  virtual child_iterator child_end();
416};
417
418/// SizeOfAlignOfTypeExpr - [C99 6.5.3.4] - This is only for sizeof/alignof of
419/// *types*.  sizeof(expr) is handled by UnaryOperator.
420class SizeOfAlignOfTypeExpr : public Expr {
421  bool isSizeof;  // true if sizeof, false if alignof.
422  QualType Ty;
423  SourceLocation OpLoc, RParenLoc;
424public:
425  SizeOfAlignOfTypeExpr(bool issizeof, QualType argType, QualType resultType,
426                        SourceLocation op, SourceLocation rp) :
427    Expr(SizeOfAlignOfTypeExprClass, resultType),
428    isSizeof(issizeof), Ty(argType), OpLoc(op), RParenLoc(rp) {}
429
430  bool isSizeOf() const { return isSizeof; }
431  QualType getArgumentType() const { return Ty; }
432
433  SourceLocation getOperatorLoc() const { return OpLoc; }
434  SourceRange getSourceRange() const { return SourceRange(OpLoc, RParenLoc); }
435
436  static bool classof(const Stmt *T) {
437    return T->getStmtClass() == SizeOfAlignOfTypeExprClass;
438  }
439  static bool classof(const SizeOfAlignOfTypeExpr *) { return true; }
440
441  // Iterators
442  virtual child_iterator child_begin();
443  virtual child_iterator child_end();
444};
445
446//===----------------------------------------------------------------------===//
447// Postfix Operators.
448//===----------------------------------------------------------------------===//
449
450/// ArraySubscriptExpr - [C99 6.5.2.1] Array Subscripting.
451class ArraySubscriptExpr : public Expr {
452  enum { LHS, RHS, END_EXPR=2 };
453  Expr* SubExprs[END_EXPR];
454  SourceLocation RBracketLoc;
455public:
456  ArraySubscriptExpr(Expr *lhs, Expr *rhs, QualType t,
457                     SourceLocation rbracketloc)
458  : Expr(ArraySubscriptExprClass, t), RBracketLoc(rbracketloc) {
459    SubExprs[LHS] = lhs;
460    SubExprs[RHS] = rhs;
461  }
462
463  /// An array access can be written A[4] or 4[A] (both are equivalent).
464  /// - getBase() and getIdx() always present the normalized view: A[4].
465  ///    In this case getBase() returns "A" and getIdx() returns "4".
466  /// - getLHS() and getRHS() present the syntactic view. e.g. for
467  ///    4[A] getLHS() returns "4".
468
469  Expr *getLHS() { return SubExprs[LHS]; }
470  const Expr *getLHS() const { return SubExprs[LHS]; }
471
472  Expr *getRHS() { return SubExprs[RHS]; }
473  const Expr *getRHS() const { return SubExprs[RHS]; }
474
475  Expr *getBase() {
476    return (getLHS()->getType()->isIntegerType()) ? getRHS() : getLHS();
477  }
478
479  const Expr *getBase() const {
480    return (getLHS()->getType()->isIntegerType()) ? getRHS() : getLHS();
481  }
482
483  Expr *getIdx() {
484    return (getLHS()->getType()->isIntegerType()) ? getLHS() : getRHS();
485  }
486
487  const Expr *getIdx() const {
488    return (getLHS()->getType()->isIntegerType()) ? getLHS() : getRHS();
489  }
490
491
492  SourceRange getSourceRange() const {
493    return SourceRange(getLHS()->getLocStart(), RBracketLoc);
494  }
495  virtual SourceLocation getExprLoc() const { return RBracketLoc; }
496
497  static bool classof(const Stmt *T) {
498    return T->getStmtClass() == ArraySubscriptExprClass;
499  }
500  static bool classof(const ArraySubscriptExpr *) { return true; }
501
502  // Iterators
503  virtual child_iterator child_begin();
504  virtual child_iterator child_end();
505};
506
507
508/// CallExpr - [C99 6.5.2.2] Function Calls.
509///
510class CallExpr : public Expr {
511  enum { FN=0, ARGS_START=1 };
512  Expr **SubExprs;
513  unsigned NumArgs;
514  SourceLocation RParenLoc;
515public:
516  CallExpr(Expr *fn, Expr **args, unsigned numargs, QualType t,
517           SourceLocation rparenloc);
518  ~CallExpr() {
519    delete [] SubExprs;
520  }
521
522  const Expr *getCallee() const { return SubExprs[FN]; }
523  Expr *getCallee() { return SubExprs[FN]; }
524
525  /// getNumArgs - Return the number of actual arguments to this call.
526  ///
527  unsigned getNumArgs() const { return NumArgs; }
528
529  /// getArg - Return the specified argument.
530  Expr *getArg(unsigned Arg) {
531    assert(Arg < NumArgs && "Arg access out of range!");
532    return SubExprs[Arg+ARGS_START];
533  }
534  const Expr *getArg(unsigned Arg) const {
535    assert(Arg < NumArgs && "Arg access out of range!");
536    return SubExprs[Arg+ARGS_START];
537  }
538  /// setArg - Set the specified argument.
539  void setArg(unsigned Arg, Expr *ArgExpr) {
540    assert(Arg < NumArgs && "Arg access out of range!");
541    SubExprs[Arg+ARGS_START] = ArgExpr;
542  }
543  /// getNumCommas - Return the number of commas that must have been present in
544  /// this function call.
545  unsigned getNumCommas() const { return NumArgs ? NumArgs - 1 : 0; }
546
547  bool isBuiltinClassifyType(llvm::APSInt &Result) const;
548
549  SourceRange getSourceRange() const {
550    return SourceRange(getCallee()->getLocStart(), RParenLoc);
551  }
552
553  static bool classof(const Stmt *T) {
554    return T->getStmtClass() == CallExprClass;
555  }
556  static bool classof(const CallExpr *) { return true; }
557
558  // Iterators
559  virtual child_iterator child_begin();
560  virtual child_iterator child_end();
561};
562
563/// MemberExpr - [C99 6.5.2.3] Structure and Union Members.
564///
565class MemberExpr : public Expr {
566  Expr *Base;
567  FieldDecl *MemberDecl;
568  SourceLocation MemberLoc;
569  bool IsArrow;      // True if this is "X->F", false if this is "X.F".
570public:
571  MemberExpr(Expr *base, bool isarrow, FieldDecl *memberdecl, SourceLocation l)
572    : Expr(MemberExprClass, memberdecl->getType()),
573      Base(base), MemberDecl(memberdecl), MemberLoc(l), IsArrow(isarrow) {}
574
575  Expr *getBase() const { return Base; }
576  FieldDecl *getMemberDecl() const { return MemberDecl; }
577  bool isArrow() const { return IsArrow; }
578
579  virtual SourceRange getSourceRange() const {
580    return SourceRange(getBase()->getLocStart(), MemberLoc);
581  }
582  virtual SourceLocation getExprLoc() const { return MemberLoc; }
583
584  static bool classof(const Stmt *T) {
585    return T->getStmtClass() == MemberExprClass;
586  }
587  static bool classof(const MemberExpr *) { return true; }
588
589  // Iterators
590  virtual child_iterator child_begin();
591  virtual child_iterator child_end();
592};
593
594/// OCUVectorElementExpr - This represents access to specific elements of a
595/// vector, and may occur on the left hand side or right hand side.  For example
596/// the following is legal:  "V.xy = V.zw" if V is a 4 element ocu vector.
597///
598class OCUVectorElementExpr : public Expr {
599  Expr *Base;
600  IdentifierInfo &Accessor;
601  SourceLocation AccessorLoc;
602public:
603  enum ElementType {
604    Point,   // xywz
605    Color,   // rgba
606    Texture  // stpq
607  };
608  OCUVectorElementExpr(QualType ty, Expr *base, IdentifierInfo &accessor,
609                       SourceLocation loc)
610    : Expr(OCUVectorElementExprClass, ty),
611      Base(base), Accessor(accessor), AccessorLoc(loc) {}
612
613  const Expr *getBase() const { return Base; }
614  Expr *getBase() { return Base; }
615
616  IdentifierInfo &getAccessor() const { return Accessor; }
617
618  /// getNumElements - Get the number of components being selected.
619  unsigned getNumElements() const;
620
621  /// getElementType - Determine whether the components of this access are
622  /// "point" "color" or "texture" elements.
623  ElementType getElementType() const;
624
625  /// containsDuplicateElements - Return true if any element access is
626  /// repeated.
627  bool containsDuplicateElements() const;
628
629  /// getEncodedElementAccess - Encode the elements accessed into a bit vector.
630  /// The encoding currently uses 2-bit bitfields, but clients should use the
631  /// accessors below to access them.
632  ///
633  unsigned getEncodedElementAccess() const;
634
635  /// getAccessedFieldNo - Given an encoded value and a result number, return
636  /// the input field number being accessed.
637  static unsigned getAccessedFieldNo(unsigned Idx, unsigned EncodedVal) {
638    return (EncodedVal >> (Idx*2)) & 3;
639  }
640
641  virtual SourceRange getSourceRange() const {
642    return SourceRange(getBase()->getLocStart(), AccessorLoc);
643  }
644  static bool classof(const Stmt *T) {
645    return T->getStmtClass() == OCUVectorElementExprClass;
646  }
647  static bool classof(const OCUVectorElementExpr *) { return true; }
648
649  // Iterators
650  virtual child_iterator child_begin();
651  virtual child_iterator child_end();
652};
653
654/// CompoundLiteralExpr - [C99 6.5.2.5]
655///
656class CompoundLiteralExpr : public Expr {
657  Expr *Init;
658public:
659  CompoundLiteralExpr(QualType ty, Expr *init) :
660    Expr(CompoundLiteralExprClass, ty), Init(init) {}
661
662  const Expr *getInitializer() const { return Init; }
663  Expr *getInitializer() { return Init; }
664
665  virtual SourceRange getSourceRange() const {
666    if (Init)
667      return Init->getSourceRange();
668    return SourceRange();
669  }
670
671  static bool classof(const Stmt *T) {
672    return T->getStmtClass() == CompoundLiteralExprClass;
673  }
674  static bool classof(const CompoundLiteralExpr *) { return true; }
675
676  // Iterators
677  virtual child_iterator child_begin();
678  virtual child_iterator child_end();
679};
680
681/// ImplicitCastExpr - Allows us to explicitly represent implicit type
682/// conversions. For example: converting T[]->T*, void f()->void (*f)(),
683/// float->double, short->int, etc.
684///
685class ImplicitCastExpr : public Expr {
686  Expr *Op;
687public:
688  ImplicitCastExpr(QualType ty, Expr *op) :
689    Expr(ImplicitCastExprClass, ty), Op(op) {}
690
691  Expr *getSubExpr() { return Op; }
692  const Expr *getSubExpr() const { return Op; }
693
694  virtual SourceRange getSourceRange() const { return Op->getSourceRange(); }
695
696  static bool classof(const Stmt *T) {
697    return T->getStmtClass() == ImplicitCastExprClass;
698  }
699  static bool classof(const ImplicitCastExpr *) { return true; }
700
701  // Iterators
702  virtual child_iterator child_begin();
703  virtual child_iterator child_end();
704};
705
706/// CastExpr - [C99 6.5.4] Cast Operators.
707///
708class CastExpr : public Expr {
709  Expr *Op;
710  SourceLocation Loc; // the location of the left paren
711public:
712  CastExpr(QualType ty, Expr *op, SourceLocation l) :
713    Expr(CastExprClass, ty), Op(op), Loc(l) {}
714
715  SourceLocation getLParenLoc() const { return Loc; }
716
717  Expr *getSubExpr() const { return Op; }
718
719  virtual SourceRange getSourceRange() const {
720    return SourceRange(Loc, getSubExpr()->getSourceRange().getEnd());
721  }
722  static bool classof(const Stmt *T) {
723    return T->getStmtClass() == CastExprClass;
724  }
725  static bool classof(const CastExpr *) { return true; }
726
727  // Iterators
728  virtual child_iterator child_begin();
729  virtual child_iterator child_end();
730};
731
732class BinaryOperator : public Expr {
733public:
734  enum Opcode {
735    // Operators listed in order of precedence.
736    // Note that additions to this should also update the StmtVisitor class.
737    Mul, Div, Rem,    // [C99 6.5.5] Multiplicative operators.
738    Add, Sub,         // [C99 6.5.6] Additive operators.
739    Shl, Shr,         // [C99 6.5.7] Bitwise shift operators.
740    LT, GT, LE, GE,   // [C99 6.5.8] Relational operators.
741    EQ, NE,           // [C99 6.5.9] Equality operators.
742    And,              // [C99 6.5.10] Bitwise AND operator.
743    Xor,              // [C99 6.5.11] Bitwise XOR operator.
744    Or,               // [C99 6.5.12] Bitwise OR operator.
745    LAnd,             // [C99 6.5.13] Logical AND operator.
746    LOr,              // [C99 6.5.14] Logical OR operator.
747    Assign, MulAssign,// [C99 6.5.16] Assignment operators.
748    DivAssign, RemAssign,
749    AddAssign, SubAssign,
750    ShlAssign, ShrAssign,
751    AndAssign, XorAssign,
752    OrAssign,
753    Comma             // [C99 6.5.17] Comma operator.
754  };
755private:
756  enum { LHS, RHS, END_EXPR };
757  Expr* SubExprs[END_EXPR];
758  Opcode Opc;
759  SourceLocation OpLoc;
760public:
761
762  BinaryOperator(Expr *lhs, Expr *rhs, Opcode opc, QualType ResTy,
763                 SourceLocation opLoc)
764    : Expr(BinaryOperatorClass, ResTy), Opc(opc), OpLoc(opLoc) {
765    SubExprs[LHS] = lhs;
766    SubExprs[RHS] = rhs;
767    assert(!isCompoundAssignmentOp() &&
768           "Use ArithAssignBinaryOperator for compound assignments");
769  }
770
771  SourceLocation getOperatorLoc() const { return OpLoc; }
772  Opcode getOpcode() const { return Opc; }
773  Expr *getLHS() const { return SubExprs[LHS]; }
774  Expr *getRHS() const { return SubExprs[RHS]; }
775  virtual SourceRange getSourceRange() const {
776    return SourceRange(getLHS()->getLocStart(), getRHS()->getLocEnd());
777  }
778
779  /// getOpcodeStr - Turn an Opcode enum value into the punctuation char it
780  /// corresponds to, e.g. "<<=".
781  static const char *getOpcodeStr(Opcode Op);
782
783  /// predicates to categorize the respective opcodes.
784  bool isMultiplicativeOp() const { return Opc >= Mul && Opc <= Rem; }
785  bool isAdditiveOp() const { return Opc == Add || Opc == Sub; }
786  bool isShiftOp() const { return Opc == Shl || Opc == Shr; }
787  bool isBitwiseOp() const { return Opc >= And && Opc <= Or; }
788  bool isRelationalOp() const { return Opc >= LT && Opc <= GE; }
789  bool isEqualityOp() const { return Opc == EQ || Opc == NE; }
790  bool isLogicalOp() const { return Opc == LAnd || Opc == LOr; }
791  bool isAssignmentOp() const { return Opc >= Assign && Opc <= OrAssign; }
792  bool isCompoundAssignmentOp() const { return Opc > Assign && Opc <= OrAssign;}
793  bool isShiftAssignOp() const { return Opc == ShlAssign || Opc == ShrAssign; }
794
795  static bool classof(const Stmt *S) {
796    return S->getStmtClass() == BinaryOperatorClass ||
797           S->getStmtClass() == CompoundAssignOperatorClass;
798  }
799  static bool classof(const BinaryOperator *) { return true; }
800
801  // Iterators
802  virtual child_iterator child_begin();
803  virtual child_iterator child_end();
804
805  virtual void directEmit(llvm::Serializer& S) const;
806  static BinaryOperator* directMaterialize(llvm::Deserializer& D);
807
808protected:
809  BinaryOperator(Expr *lhs, Expr *rhs, Opcode opc, QualType ResTy,
810                 SourceLocation oploc, bool dead)
811    : Expr(CompoundAssignOperatorClass, ResTy), Opc(opc), OpLoc(oploc) {
812    SubExprs[LHS] = lhs;
813    SubExprs[RHS] = rhs;
814  }
815};
816
817/// CompoundAssignOperator - For compound assignments (e.g. +=), we keep
818/// track of the type the operation is performed in.  Due to the semantics of
819/// these operators, the operands are promoted, the aritmetic performed, an
820/// implicit conversion back to the result type done, then the assignment takes
821/// place.  This captures the intermediate type which the computation is done
822/// in.
823class CompoundAssignOperator : public BinaryOperator {
824  QualType ComputationType;
825public:
826  CompoundAssignOperator(Expr *lhs, Expr *rhs, Opcode opc,
827                         QualType ResType, QualType CompType,
828                         SourceLocation OpLoc)
829    : BinaryOperator(lhs, rhs, opc, ResType, OpLoc, true),
830      ComputationType(CompType) {
831    assert(isCompoundAssignmentOp() &&
832           "Only should be used for compound assignments");
833  }
834
835  QualType getComputationType() const { return ComputationType; }
836
837  static bool classof(const CompoundAssignOperator *) { return true; }
838  static bool classof(const Stmt *S) {
839    return S->getStmtClass() == CompoundAssignOperatorClass;
840  }
841};
842
843/// ConditionalOperator - The ?: operator.  Note that LHS may be null when the
844/// GNU "missing LHS" extension is in use.
845///
846class ConditionalOperator : public Expr {
847  enum { COND, LHS, RHS, END_EXPR };
848  Expr* SubExprs[END_EXPR]; // Left/Middle/Right hand sides.
849public:
850  ConditionalOperator(Expr *cond, Expr *lhs, Expr *rhs, QualType t)
851    : Expr(ConditionalOperatorClass, t) {
852    SubExprs[COND] = cond;
853    SubExprs[LHS] = lhs;
854    SubExprs[RHS] = rhs;
855  }
856
857  Expr *getCond() const { return SubExprs[COND]; }
858  Expr *getLHS() const { return SubExprs[LHS]; }
859  Expr *getRHS() const { return SubExprs[RHS]; }
860
861  virtual SourceRange getSourceRange() const {
862    return SourceRange(getCond()->getLocStart(), getRHS()->getLocEnd());
863  }
864  static bool classof(const Stmt *T) {
865    return T->getStmtClass() == ConditionalOperatorClass;
866  }
867  static bool classof(const ConditionalOperator *) { return true; }
868
869  // Iterators
870  virtual child_iterator child_begin();
871  virtual child_iterator child_end();
872};
873
874/// AddrLabelExpr - The GNU address of label extension, representing &&label.
875class AddrLabelExpr : public Expr {
876  SourceLocation AmpAmpLoc, LabelLoc;
877  LabelStmt *Label;
878public:
879  AddrLabelExpr(SourceLocation AALoc, SourceLocation LLoc, LabelStmt *L,
880                QualType t)
881    : Expr(AddrLabelExprClass, t), AmpAmpLoc(AALoc), LabelLoc(LLoc), Label(L) {}
882
883  virtual SourceRange getSourceRange() const {
884    return SourceRange(AmpAmpLoc, LabelLoc);
885  }
886
887  LabelStmt *getLabel() const { return Label; }
888
889  static bool classof(const Stmt *T) {
890    return T->getStmtClass() == AddrLabelExprClass;
891  }
892  static bool classof(const AddrLabelExpr *) { return true; }
893
894  // Iterators
895  virtual child_iterator child_begin();
896  virtual child_iterator child_end();
897};
898
899/// StmtExpr - This is the GNU Statement Expression extension: ({int X=4; X;}).
900/// The StmtExpr contains a single CompoundStmt node, which it evaluates and
901/// takes the value of the last subexpression.
902class StmtExpr : public Expr {
903  CompoundStmt *SubStmt;
904  SourceLocation LParenLoc, RParenLoc;
905public:
906  StmtExpr(CompoundStmt *substmt, QualType T,
907           SourceLocation lp, SourceLocation rp) :
908    Expr(StmtExprClass, T), SubStmt(substmt),  LParenLoc(lp), RParenLoc(rp) { }
909
910  CompoundStmt *getSubStmt() { return SubStmt; }
911  const CompoundStmt *getSubStmt() const { return SubStmt; }
912
913  virtual SourceRange getSourceRange() const {
914    return SourceRange(LParenLoc, RParenLoc);
915  }
916
917  static bool classof(const Stmt *T) {
918    return T->getStmtClass() == StmtExprClass;
919  }
920  static bool classof(const StmtExpr *) { return true; }
921
922  // Iterators
923  virtual child_iterator child_begin();
924  virtual child_iterator child_end();
925};
926
927/// TypesCompatibleExpr - GNU builtin-in function __builtin_type_compatible_p.
928/// This AST node represents a function that returns 1 if two *types* (not
929/// expressions) are compatible. The result of this built-in function can be
930/// used in integer constant expressions.
931class TypesCompatibleExpr : public Expr {
932  QualType Type1;
933  QualType Type2;
934  SourceLocation BuiltinLoc, RParenLoc;
935public:
936  TypesCompatibleExpr(QualType ReturnType, SourceLocation BLoc,
937                      QualType t1, QualType t2, SourceLocation RP) :
938    Expr(TypesCompatibleExprClass, ReturnType), Type1(t1), Type2(t2),
939    BuiltinLoc(BLoc), RParenLoc(RP) {}
940
941  QualType getArgType1() const { return Type1; }
942  QualType getArgType2() const { return Type2; }
943
944  virtual SourceRange getSourceRange() const {
945    return SourceRange(BuiltinLoc, RParenLoc);
946  }
947  static bool classof(const Stmt *T) {
948    return T->getStmtClass() == TypesCompatibleExprClass;
949  }
950  static bool classof(const TypesCompatibleExpr *) { return true; }
951
952  // Iterators
953  virtual child_iterator child_begin();
954  virtual child_iterator child_end();
955};
956
957/// ChooseExpr - GNU builtin-in function __builtin_choose_expr.
958/// This AST node is similar to the conditional operator (?:) in C, with
959/// the following exceptions:
960/// - the test expression much be a constant expression.
961/// - the expression returned has it's type unaltered by promotion rules.
962/// - does not evaluate the expression that was not chosen.
963class ChooseExpr : public Expr {
964  enum { COND, LHS, RHS, END_EXPR };
965  Expr* SubExprs[END_EXPR]; // Left/Middle/Right hand sides.
966  SourceLocation BuiltinLoc, RParenLoc;
967public:
968  ChooseExpr(SourceLocation BLoc, Expr *cond, Expr *lhs, Expr *rhs, QualType t,
969             SourceLocation RP)
970    : Expr(ChooseExprClass, t),
971      BuiltinLoc(BLoc), RParenLoc(RP) {
972      SubExprs[COND] = cond;
973      SubExprs[LHS] = lhs;
974      SubExprs[RHS] = rhs;
975    }
976
977  /// isConditionTrue - Return true if the condition is true.  This is always
978  /// statically knowable for a well-formed choosexpr.
979  bool isConditionTrue(ASTContext &C) const;
980
981  Expr *getCond() const { return SubExprs[COND]; }
982  Expr *getLHS() const { return SubExprs[LHS]; }
983  Expr *getRHS() const { return SubExprs[RHS]; }
984
985  virtual SourceRange getSourceRange() const {
986    return SourceRange(BuiltinLoc, RParenLoc);
987  }
988  static bool classof(const Stmt *T) {
989    return T->getStmtClass() == ChooseExprClass;
990  }
991  static bool classof(const ChooseExpr *) { return true; }
992
993  // Iterators
994  virtual child_iterator child_begin();
995  virtual child_iterator child_end();
996};
997
998/// VAArgExpr, used for the builtin function __builtin_va_start.
999class VAArgExpr : public Expr {
1000  Expr *Val;
1001  SourceLocation BuiltinLoc, RParenLoc;
1002public:
1003  VAArgExpr(SourceLocation BLoc, Expr* e, QualType t, SourceLocation RPLoc)
1004    : Expr(VAArgExprClass, t),
1005      Val(e),
1006      BuiltinLoc(BLoc),
1007      RParenLoc(RPLoc) { }
1008
1009  const Expr *getSubExpr() const { return Val; }
1010  Expr *getSubExpr() { return Val; }
1011  virtual SourceRange getSourceRange() const {
1012    return SourceRange(BuiltinLoc, RParenLoc);
1013  }
1014  static bool classof(const Stmt *T) {
1015    return T->getStmtClass() == VAArgExprClass;
1016  }
1017  static bool classof(const VAArgExpr *) { return true; }
1018
1019  // Iterators
1020  virtual child_iterator child_begin();
1021  virtual child_iterator child_end();
1022};
1023
1024/// InitListExpr, used for struct and array initializers.
1025class InitListExpr : public Expr {
1026  Expr **InitExprs;
1027  unsigned NumInits;
1028  SourceLocation LBraceLoc, RBraceLoc;
1029public:
1030  InitListExpr(SourceLocation lbraceloc, Expr **initexprs, unsigned numinits,
1031               SourceLocation rbraceloc);
1032  ~InitListExpr() {
1033    delete [] InitExprs;
1034  }
1035
1036  unsigned getNumInits() const { return NumInits; }
1037
1038  const Expr* getInit(unsigned Init) const {
1039    assert(Init < NumInits && "Initializer access out of range!");
1040    return InitExprs[Init];
1041  }
1042
1043  Expr* getInit(unsigned Init) {
1044    assert(Init < NumInits && "Initializer access out of range!");
1045    return InitExprs[Init];
1046  }
1047
1048  void setInit(unsigned Init, Expr *expr) {
1049    assert(Init < NumInits && "Initializer access out of range!");
1050    InitExprs[Init] = expr;
1051  }
1052
1053  virtual SourceRange getSourceRange() const {
1054    return SourceRange(LBraceLoc, RBraceLoc);
1055  }
1056  static bool classof(const Stmt *T) {
1057    return T->getStmtClass() == InitListExprClass;
1058  }
1059  static bool classof(const InitListExpr *) { return true; }
1060
1061  // Iterators
1062  virtual child_iterator child_begin();
1063  virtual child_iterator child_end();
1064};
1065
1066/// ObjCStringLiteral, used for Objective-C string literals
1067/// i.e. @"foo".
1068class ObjCStringLiteral : public Expr {
1069  StringLiteral *String;
1070  SourceLocation AtLoc;
1071public:
1072  ObjCStringLiteral(StringLiteral *SL, QualType T, SourceLocation L)
1073    : Expr(ObjCStringLiteralClass, T), String(SL), AtLoc(L) {}
1074
1075  StringLiteral* getString() { return String; }
1076
1077  const StringLiteral* getString() const { return String; }
1078
1079  virtual SourceRange getSourceRange() const {
1080    return SourceRange(AtLoc, String->getLocEnd());
1081  }
1082
1083  static bool classof(const Stmt *T) {
1084    return T->getStmtClass() == ObjCStringLiteralClass;
1085  }
1086  static bool classof(const ObjCStringLiteral *) { return true; }
1087
1088  // Iterators
1089  virtual child_iterator child_begin();
1090  virtual child_iterator child_end();
1091};
1092
1093/// ObjCEncodeExpr, used for @encode in Objective-C.
1094class ObjCEncodeExpr : public Expr {
1095  QualType EncType;
1096  SourceLocation AtLoc, RParenLoc;
1097public:
1098  ObjCEncodeExpr(QualType T, QualType ET,
1099                 SourceLocation at, SourceLocation rp)
1100    : Expr(ObjCEncodeExprClass, T), EncType(ET), AtLoc(at), RParenLoc(rp) {}
1101
1102  SourceLocation getAtLoc() const { return AtLoc; }
1103  SourceLocation getRParenLoc() const { return RParenLoc; }
1104
1105  SourceRange getSourceRange() const { return SourceRange(AtLoc, RParenLoc); }
1106
1107  QualType getEncodedType() const { return EncType; }
1108
1109  static bool classof(const Stmt *T) {
1110    return T->getStmtClass() == ObjCEncodeExprClass;
1111  }
1112  static bool classof(const ObjCEncodeExpr *) { return true; }
1113
1114  // Iterators
1115  virtual child_iterator child_begin();
1116  virtual child_iterator child_end();
1117};
1118
1119/// ObjCSelectorExpr used for @selector in Objective-C.
1120class ObjCSelectorExpr : public Expr {
1121
1122  Selector SelName;
1123
1124  SourceLocation AtLoc, RParenLoc;
1125public:
1126  ObjCSelectorExpr(QualType T, Selector selInfo,
1127                   SourceLocation at, SourceLocation rp)
1128  : Expr(ObjCSelectorExprClass, T), SelName(selInfo),
1129  AtLoc(at), RParenLoc(rp) {}
1130
1131  const Selector &getSelector() const { return SelName; }
1132  Selector &getSelector() { return SelName; }
1133
1134  SourceLocation getAtLoc() const { return AtLoc; }
1135  SourceLocation getRParenLoc() const { return RParenLoc; }
1136  SourceRange getSourceRange() const { return SourceRange(AtLoc, RParenLoc); }
1137
1138  /// getNumArgs - Return the number of actual arguments to this call.
1139  unsigned getNumArgs() const { return SelName.getNumArgs(); }
1140
1141  static bool classof(const Stmt *T) {
1142    return T->getStmtClass() == ObjCSelectorExprClass;
1143  }
1144  static bool classof(const ObjCSelectorExpr *) { return true; }
1145
1146  // Iterators
1147  virtual child_iterator child_begin();
1148  virtual child_iterator child_end();
1149
1150};
1151
1152/// ObjCProtocolExpr used for protocol in Objective-C.
1153class ObjCProtocolExpr : public Expr {
1154
1155  ObjcProtocolDecl *Protocol;
1156
1157  SourceLocation AtLoc, RParenLoc;
1158  public:
1159  ObjCProtocolExpr(QualType T, ObjcProtocolDecl *protocol,
1160                   SourceLocation at, SourceLocation rp)
1161  : Expr(ObjCProtocolExprClass, T), Protocol(protocol),
1162  AtLoc(at), RParenLoc(rp) {}
1163
1164  ObjcProtocolDecl *getProtocol() const { return Protocol; }
1165
1166  SourceLocation getAtLoc() const { return AtLoc; }
1167  SourceLocation getRParenLoc() const { return RParenLoc; }
1168  SourceRange getSourceRange() const { return SourceRange(AtLoc, RParenLoc); }
1169
1170  static bool classof(const Stmt *T) {
1171    return T->getStmtClass() == ObjCProtocolExprClass;
1172  }
1173  static bool classof(const ObjCProtocolExpr *) { return true; }
1174
1175  // Iterators
1176  virtual child_iterator child_begin();
1177  virtual child_iterator child_end();
1178
1179};
1180
1181class ObjCMessageExpr : public Expr {
1182  enum { RECEIVER=0, ARGS_START=1 };
1183
1184  Expr **SubExprs;
1185
1186  // A unigue name for this message.
1187  Selector SelName;
1188
1189  // A method prototype for this message (optional).
1190  // FIXME: Since method decls contain the selector, and most messages have a
1191  // prototype, consider devising a scheme for unifying SelName/MethodProto.
1192  ObjcMethodDecl *MethodProto;
1193
1194  IdentifierInfo *ClassName; // optional - 0 for instance messages.
1195
1196  SourceLocation LBracloc, RBracloc;
1197public:
1198  // constructor for class messages.
1199  // FIXME: clsName should be typed to ObjCInterfaceType
1200  ObjCMessageExpr(IdentifierInfo *clsName, Selector selInfo,
1201                  QualType retType, ObjcMethodDecl *methDecl,
1202                  SourceLocation LBrac, SourceLocation RBrac,
1203                  Expr **ArgExprs);
1204  // constructor for instance messages.
1205  ObjCMessageExpr(Expr *receiver, Selector selInfo,
1206                  QualType retType, ObjcMethodDecl *methDecl,
1207                  SourceLocation LBrac, SourceLocation RBrac,
1208                  Expr **ArgExprs);
1209  ~ObjCMessageExpr() {
1210    delete [] SubExprs;
1211  }
1212
1213  const Expr *getReceiver() const { return SubExprs[RECEIVER]; }
1214  Expr *getReceiver() { return SubExprs[RECEIVER]; }
1215
1216  const Selector &getSelector() const { return SelName; }
1217  Selector &getSelector() { return SelName; }
1218
1219  const ObjcMethodDecl *getMethodDecl() const { return MethodProto; }
1220  ObjcMethodDecl *getMethodDecl() { return MethodProto; }
1221
1222  const IdentifierInfo *getClassName() const { return ClassName; }
1223  IdentifierInfo *getClassName() { return ClassName; }
1224
1225  /// getNumArgs - Return the number of actual arguments to this call.
1226  unsigned getNumArgs() const { return SelName.getNumArgs(); }
1227
1228/// getArg - Return the specified argument.
1229  Expr *getArg(unsigned Arg) {
1230    assert(Arg < SelName.getNumArgs() && "Arg access out of range!");
1231    return SubExprs[Arg+ARGS_START];
1232  }
1233  const Expr *getArg(unsigned Arg) const {
1234    assert(Arg < SelName.getNumArgs() && "Arg access out of range!");
1235    return SubExprs[Arg+ARGS_START];
1236  }
1237  /// setArg - Set the specified argument.
1238  void setArg(unsigned Arg, Expr *ArgExpr) {
1239    assert(Arg < SelName.getNumArgs() && "Arg access out of range!");
1240    SubExprs[Arg+ARGS_START] = ArgExpr;
1241  }
1242  SourceRange getSourceRange() const { return SourceRange(LBracloc, RBracloc); }
1243
1244  static bool classof(const Stmt *T) {
1245    return T->getStmtClass() == ObjCMessageExprClass;
1246  }
1247  static bool classof(const ObjCMessageExpr *) { return true; }
1248
1249  // Iterators
1250  virtual child_iterator child_begin();
1251  virtual child_iterator child_end();
1252};
1253
1254}  // end namespace clang
1255
1256#endif
1257