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