Expr.h revision ca51c97fbb10b9d48e1857e01c532493f87cd5f0
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 "llvm/ADT/APSInt.h"
21
22namespace clang {
23  class IdentifierInfo;
24  class Decl;
25  class ASTContext;
26
27/// Expr - This represents one expression.  Note that Expr's are subclasses of
28/// Stmt.  This allows an expression to be transparently used any place a Stmt
29/// is required.
30///
31class Expr : public Stmt {
32  QualType TR;
33protected:
34  Expr(StmtClass SC, QualType T) : Stmt(SC), TR(T) {}
35  ~Expr() {}
36public:
37  QualType getType() const { return TR; }
38  void setType(QualType t) { TR = t; }
39
40  /// SourceLocation tokens are not useful in isolation - they are low level
41  /// value objects created/interpreted by SourceManager. We assume AST
42  /// clients will have a pointer to the respective SourceManager.
43  virtual SourceRange getSourceRange() const = 0;
44  SourceLocation getLocStart() const { return getSourceRange().Begin(); }
45  SourceLocation getLocEnd() const { return getSourceRange().End(); }
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  ///
65  enum isLvalueResult {
66    LV_Valid,
67    LV_NotObjectType,
68    LV_IncompleteVoidType,
69    LV_InvalidExpression
70  };
71  isLvalueResult isLvalue() const;
72
73  /// isModifiableLvalue - C99 6.3.2.1: an lvalue that does not have array type,
74  /// does not have an incomplete type, does not have a const-qualified type,
75  /// and if it is a structure or union, does not have any member (including,
76  /// recursively, any member or element of all contained aggregates or unions)
77  /// with a const-qualified type.
78  enum isModifiableLvalueResult {
79    MLV_Valid,
80    MLV_NotObjectType,
81    MLV_IncompleteVoidType,
82    MLV_InvalidExpression,
83    MLV_IncompleteType,
84    MLV_ConstQualified,
85    MLV_ArrayType
86  };
87  isModifiableLvalueResult isModifiableLvalue() const;
88
89  bool isNullPointerConstant(ASTContext &Ctx) const;
90
91  /// isIntegerConstantExpr - Return true if this expression is a valid integer
92  /// constant expression, and, if so, return its value in Result.  If not a
93  /// valid i-c-e, return false and fill in Loc (if specified) with the location
94  /// of the invalid expression.
95  bool isIntegerConstantExpr(llvm::APSInt &Result, ASTContext &Ctx,
96                             SourceLocation *Loc = 0,
97                             bool isEvaluated = true) const;
98  bool isIntegerConstantExpr(ASTContext &Ctx, SourceLocation *Loc = 0) const {
99    llvm::APSInt X(32);
100    return isIntegerConstantExpr(X, Ctx, Loc);
101  }
102
103  virtual void visit(StmtVisitor &Visitor);
104  static bool classof(const Stmt *T) {
105    return T->getStmtClass() >= firstExprConstant &&
106           T->getStmtClass() <= lastExprConstant;
107  }
108  static bool classof(const Expr *) { return true; }
109};
110
111//===----------------------------------------------------------------------===//
112// Primary Expressions.
113//===----------------------------------------------------------------------===//
114
115/// DeclRefExpr - [C99 6.5.1p2] - A reference to a declared variable, function,
116/// enum, etc.
117class DeclRefExpr : public Expr {
118  Decl *D; // a ValueDecl or EnumConstantDecl
119  SourceLocation Loc;
120public:
121  DeclRefExpr(Decl *d, QualType t, SourceLocation l) :
122    Expr(DeclRefExprClass, t), D(d), Loc(l) {}
123
124  Decl *getDecl() { return D; }
125  const Decl *getDecl() const { return D; }
126  virtual SourceRange getSourceRange() const { return SourceRange(Loc); }
127
128
129  virtual void visit(StmtVisitor &Visitor);
130  static bool classof(const Stmt *T) {
131    return T->getStmtClass() == DeclRefExprClass;
132  }
133  static bool classof(const DeclRefExpr *) { return true; }
134};
135
136class IntegerLiteral : public Expr {
137  llvm::APInt Value;
138  SourceLocation Loc;
139public:
140  // type should be IntTy, LongTy, LongLongTy, UnsignedIntTy, UnsignedLongTy,
141  // or UnsignedLongLongTy
142  IntegerLiteral(const llvm::APInt &V, QualType type, SourceLocation l)
143    : Expr(IntegerLiteralClass, type), Value(V), Loc(l) {
144    assert(type->isIntegerType() && "Illegal type in IntegerLiteral");
145  }
146  const llvm::APInt &getValue() const { return Value; }
147  virtual SourceRange getSourceRange() const { return SourceRange(Loc); }
148
149  virtual void visit(StmtVisitor &Visitor);
150  static bool classof(const Stmt *T) {
151    return T->getStmtClass() == IntegerLiteralClass;
152  }
153  static bool classof(const IntegerLiteral *) { return true; }
154};
155
156class CharacterLiteral : public Expr {
157  unsigned Value;
158  SourceLocation Loc;
159public:
160  // type should be IntTy
161  CharacterLiteral(unsigned value, QualType type, SourceLocation l)
162    : Expr(CharacterLiteralClass, type), Value(value), Loc(l) {
163  }
164  SourceLocation getLoc() const { return Loc; }
165
166  virtual SourceRange getSourceRange() const { return SourceRange(Loc); }
167
168  unsigned getValue() const { return Value; }
169
170  virtual void visit(StmtVisitor &Visitor);
171  static bool classof(const Stmt *T) {
172    return T->getStmtClass() == CharacterLiteralClass;
173  }
174  static bool classof(const CharacterLiteral *) { return true; }
175};
176
177class FloatingLiteral : public Expr {
178  float Value; // FIXME
179  SourceLocation Loc;
180public:
181  FloatingLiteral(float value, QualType type, SourceLocation l)
182    : Expr(FloatingLiteralClass, type), Value(value), Loc(l) {}
183
184  float getValue() const { return Value; }
185
186  virtual SourceRange getSourceRange() const { return SourceRange(Loc); }
187
188  virtual void visit(StmtVisitor &Visitor);
189  static bool classof(const Stmt *T) {
190    return T->getStmtClass() == FloatingLiteralClass;
191  }
192  static bool classof(const FloatingLiteral *) { return true; }
193};
194
195class StringLiteral : public Expr {
196  const char *StrData;
197  unsigned ByteLength;
198  bool IsWide;
199  // if the StringLiteral was composed using token pasting, both locations
200  // are needed. If not (the common case), firstTokLoc == lastTokLoc.
201  // FIXME: if space becomes an issue, we should create a sub-class.
202  SourceLocation firstTokLoc, lastTokLoc;
203public:
204  StringLiteral(const char *strData, unsigned byteLength, bool Wide,
205                QualType t, SourceLocation b, SourceLocation e);
206  virtual ~StringLiteral();
207
208  const char *getStrData() const { return StrData; }
209  unsigned getByteLength() const { return ByteLength; }
210  bool isWide() const { return IsWide; }
211
212  virtual SourceRange getSourceRange() const {
213    return SourceRange(firstTokLoc,lastTokLoc);
214  }
215  virtual void visit(StmtVisitor &Visitor);
216  static bool classof(const Stmt *T) {
217    return T->getStmtClass() == StringLiteralClass;
218  }
219  static bool classof(const StringLiteral *) { return true; }
220};
221
222/// ParenExpr - This represents a parethesized expression, e.g. "(1)".  This
223/// AST node is only formed if full location information is requested.
224class ParenExpr : public Expr {
225  SourceLocation L, R;
226  Expr *Val;
227public:
228  ParenExpr(SourceLocation l, SourceLocation r, Expr *val)
229    : Expr(ParenExprClass, val->getType()), L(l), R(r), Val(val) {}
230
231  const Expr *getSubExpr() const { return Val; }
232  Expr *getSubExpr() { return Val; }
233  SourceRange getSourceRange() const { return SourceRange(L, R); }
234
235  virtual void visit(StmtVisitor &Visitor);
236  static bool classof(const Stmt *T) {
237    return T->getStmtClass() == ParenExprClass;
238  }
239  static bool classof(const ParenExpr *) { return true; }
240};
241
242
243/// UnaryOperator - This represents the unary-expression's (except sizeof of
244/// types), the postinc/postdec operators from postfix-expression, and various
245/// extensions.
246class UnaryOperator : public Expr {
247public:
248  enum Opcode {
249    PostInc, PostDec, // [C99 6.5.2.4] Postfix increment and decrement operators
250    PreInc, PreDec,   // [C99 6.5.3.1] Prefix increment and decrement operators.
251    AddrOf, Deref,    // [C99 6.5.3.2] Address and indirection operators.
252    Plus, Minus,      // [C99 6.5.3.3] Unary arithmetic operators.
253    Not, LNot,        // [C99 6.5.3.3] Unary arithmetic operators.
254    SizeOf, AlignOf,  // [C99 6.5.3.4] Sizeof (expr, not type) operator.
255    Real, Imag,       // "__real expr"/"__imag expr" Extension.
256    Extension         // __extension__ marker.
257  };
258private:
259  Expr *Val;
260  Opcode Opc;
261  SourceLocation Loc;
262public:
263
264  UnaryOperator(Expr *input, Opcode opc, QualType type, SourceLocation l)
265    : Expr(UnaryOperatorClass, type), Val(input), Opc(opc), Loc(l) {}
266
267  Opcode getOpcode() const { return Opc; }
268  Expr *getSubExpr() const { return Val; }
269
270  /// getOperatorLoc - Return the location of the operator.
271  SourceLocation getOperatorLoc() const { return Loc; }
272
273  /// isPostfix - Return true if this is a postfix operation, like x++.
274  static bool isPostfix(Opcode Op);
275
276  bool isPostfix() const { return isPostfix(Opc); }
277  bool isIncrementDecrementOp() const { return Opc>=PostInc && Opc<=PreDec; }
278  bool isSizeOfAlignOfOp() const { return Opc == SizeOf || Opc == AlignOf; }
279  static bool isArithmeticOp(Opcode Op) { return Op >= Plus && Op <= LNot; }
280
281  /// getDecl - a recursive routine that derives the base decl for an
282  /// expression. For example, it will return the declaration for "s" from
283  /// the following complex expression "s.zz[2].bb.vv".
284  static bool isAddressable(Expr *e);
285
286  /// getOpcodeStr - Turn an Opcode enum value into the punctuation char it
287  /// corresponds to, e.g. "sizeof" or "[pre]++"
288  static const char *getOpcodeStr(Opcode Op);
289
290  virtual SourceRange getSourceRange() const {
291    if (isPostfix())
292      return SourceRange(Val->getLocStart(), Loc);
293    else
294      return SourceRange(Loc, Val->getLocEnd());
295  }
296  virtual SourceLocation getExprLoc() const { return Loc; }
297
298  virtual void visit(StmtVisitor &Visitor);
299  static bool classof(const Stmt *T) {
300    return T->getStmtClass() == UnaryOperatorClass;
301  }
302  static bool classof(const UnaryOperator *) { return true; }
303};
304
305/// SizeOfAlignOfTypeExpr - [C99 6.5.3.4] - This is only for sizeof/alignof of
306/// *types*.  sizeof(expr) is handled by UnaryOperator.
307class SizeOfAlignOfTypeExpr : public Expr {
308  bool isSizeof;  // true if sizeof, false if alignof.
309  QualType Ty;
310  SourceLocation OpLoc, RParenLoc;
311public:
312  SizeOfAlignOfTypeExpr(bool issizeof, QualType argType, QualType resultType,
313                        SourceLocation op, SourceLocation rp) :
314    Expr(SizeOfAlignOfTypeExprClass, resultType),
315    isSizeof(issizeof), Ty(argType), OpLoc(op), RParenLoc(rp) {}
316
317  bool isSizeOf() const { return isSizeof; }
318  QualType getArgumentType() const { return Ty; }
319  SourceRange getSourceRange() const { return SourceRange(OpLoc, RParenLoc); }
320
321  virtual void visit(StmtVisitor &Visitor);
322  static bool classof(const Stmt *T) {
323    return T->getStmtClass() == SizeOfAlignOfTypeExprClass;
324  }
325  static bool classof(const SizeOfAlignOfTypeExpr *) { return true; }
326};
327
328//===----------------------------------------------------------------------===//
329// Postfix Operators.
330//===----------------------------------------------------------------------===//
331
332/// ArraySubscriptExpr - [C99 6.5.2.1] Array Subscripting.
333class ArraySubscriptExpr : public Expr {
334  Expr *Base, *Idx;
335  SourceLocation RBracketLoc;
336public:
337  ArraySubscriptExpr(Expr *base, Expr *idx, QualType t,
338                     SourceLocation rbracketloc) :
339    Expr(ArraySubscriptExprClass, t),
340    Base(base), Idx(idx), RBracketLoc(rbracketloc) {}
341
342  Expr *getBase() { return Base; }
343  const Expr *getBase() const { return Base; }
344  Expr *getIdx() { return Idx; }
345  const Expr *getIdx() const { return Idx; }
346
347  SourceRange getSourceRange() const {
348    return SourceRange(Base->getLocStart(), RBracketLoc);
349  }
350  virtual SourceLocation getExprLoc() const { return RBracketLoc; }
351
352  virtual void visit(StmtVisitor &Visitor);
353  static bool classof(const Stmt *T) {
354    return T->getStmtClass() == ArraySubscriptExprClass;
355  }
356  static bool classof(const ArraySubscriptExpr *) { return true; }
357};
358
359
360/// CallExpr - [C99 6.5.2.2] Function Calls.
361///
362class CallExpr : public Expr {
363  Expr *Fn;
364  Expr **Args;
365  unsigned NumArgs;
366  SourceLocation RParenLoc;
367public:
368  CallExpr(Expr *fn, Expr **args, unsigned numargs, QualType t,
369           SourceLocation rparenloc);
370  ~CallExpr() {
371    delete [] Args;
372  }
373
374  const Expr *getCallee() const { return Fn; }
375  Expr *getCallee() { return Fn; }
376
377  /// getNumArgs - Return the number of actual arguments to this call.
378  ///
379  unsigned getNumArgs() const { return NumArgs; }
380
381  /// getArg - Return the specified argument.
382  Expr *getArg(unsigned Arg) {
383    assert(Arg < NumArgs && "Arg access out of range!");
384    return Args[Arg];
385  }
386  const Expr *getArg(unsigned Arg) const {
387    assert(Arg < NumArgs && "Arg access out of range!");
388    return Args[Arg];
389  }
390
391  /// getNumCommas - Return the number of commas that must have been present in
392  /// this function call.
393  unsigned getNumCommas() const { return NumArgs ? NumArgs - 1 : 0; }
394
395  SourceRange getSourceRange() const {
396    return SourceRange(Fn->getLocStart(), RParenLoc);
397  }
398
399  virtual void visit(StmtVisitor &Visitor);
400  static bool classof(const Stmt *T) {
401    return T->getStmtClass() == CallExprClass;
402  }
403  static bool classof(const CallExpr *) { return true; }
404};
405
406/// MemberExpr - [C99 6.5.2.3] Structure and Union Members.
407///
408class MemberExpr : public Expr {
409  Expr *Base;
410  FieldDecl *MemberDecl;
411  SourceLocation MemberLoc;
412  bool IsArrow;      // True if this is "X->F", false if this is "X.F".
413public:
414  MemberExpr(Expr *base, bool isarrow, FieldDecl *memberdecl, SourceLocation l)
415    : Expr(MemberExprClass, memberdecl->getType()),
416      Base(base), MemberDecl(memberdecl), MemberLoc(l), IsArrow(isarrow) {}
417
418  Expr *getBase() const { return Base; }
419  FieldDecl *getMemberDecl() const { return MemberDecl; }
420  bool isArrow() const { return IsArrow; }
421
422  virtual SourceRange getSourceRange() const {
423    return SourceRange(getBase()->getLocStart(), MemberLoc);
424  }
425  virtual SourceLocation getExprLoc() const { return MemberLoc; }
426
427  virtual void visit(StmtVisitor &Visitor);
428  static bool classof(const Stmt *T) {
429    return T->getStmtClass() == MemberExprClass;
430  }
431  static bool classof(const MemberExpr *) { return true; }
432};
433
434/// ImplicitCastExpr - Allows us to explicitly represent implicit type
435/// conversions. For example: converting T[]->T*, void f()->void (*f)(),
436/// float->double, short->int, etc.
437///
438class ImplicitCastExpr : public Expr {
439  Expr *Op;
440public:
441  ImplicitCastExpr(QualType ty, Expr *op) :
442    Expr(ImplicitCastExprClass, ty), Op(op) {}
443
444  Expr *getSubExpr() { return Op; }
445  const Expr *getSubExpr() const { return Op; }
446
447  virtual SourceRange getSourceRange() const { return SourceRange(); }
448
449  virtual void visit(StmtVisitor &Visitor);
450  static bool classof(const Stmt *T) {
451    return T->getStmtClass() == ImplicitCastExprClass;
452  }
453  static bool classof(const ImplicitCastExpr *) { return true; }
454};
455
456/// CastExpr - [C99 6.5.4] Cast Operators.
457///
458class CastExpr : public Expr {
459  Expr *Op;
460  SourceLocation Loc; // the location of the left paren
461public:
462  CastExpr(QualType ty, Expr *op, SourceLocation l) :
463    Expr(CastExprClass, ty), Op(op), Loc(l) {}
464
465  SourceLocation getLParenLoc() const { return Loc; }
466
467  Expr *getSubExpr() const { return Op; }
468
469  virtual SourceRange getSourceRange() const {
470    return SourceRange(Loc, getSubExpr()->getSourceRange().End());
471  }
472  virtual void visit(StmtVisitor &Visitor);
473  static bool classof(const Stmt *T) {
474    return T->getStmtClass() == CastExprClass;
475  }
476  static bool classof(const CastExpr *) { return true; }
477};
478
479
480class BinaryOperator : public Expr {
481public:
482  enum Opcode {
483    // Operators listed in order of precedence.
484    Mul, Div, Rem,    // [C99 6.5.5] Multiplicative operators.
485    Add, Sub,         // [C99 6.5.6] Additive operators.
486    Shl, Shr,         // [C99 6.5.7] Bitwise shift operators.
487    LT, GT, LE, GE,   // [C99 6.5.8] Relational operators.
488    EQ, NE,           // [C99 6.5.9] Equality operators.
489    And,              // [C99 6.5.10] Bitwise AND operator.
490    Xor,              // [C99 6.5.11] Bitwise XOR operator.
491    Or,               // [C99 6.5.12] Bitwise OR operator.
492    LAnd,             // [C99 6.5.13] Logical AND operator.
493    LOr,              // [C99 6.5.14] Logical OR operator.
494    Assign, MulAssign,// [C99 6.5.16] Assignment operators.
495    DivAssign, RemAssign,
496    AddAssign, SubAssign,
497    ShlAssign, ShrAssign,
498    AndAssign, XorAssign,
499    OrAssign,
500    Comma             // [C99 6.5.17] Comma operator.
501  };
502
503  BinaryOperator(Expr *lhs, Expr *rhs, Opcode opc, QualType ResTy)
504    : Expr(BinaryOperatorClass, ResTy), LHS(lhs), RHS(rhs), Opc(opc) {
505    assert(!isCompoundAssignmentOp() &&
506           "Use ArithAssignBinaryOperator for compound assignments");
507  }
508
509  Opcode getOpcode() const { return Opc; }
510  Expr *getLHS() const { return LHS; }
511  Expr *getRHS() const { return RHS; }
512  virtual SourceRange getSourceRange() const {
513    return SourceRange(getLHS()->getLocStart(), getRHS()->getLocEnd());
514  }
515
516  /// getOpcodeStr - Turn an Opcode enum value into the punctuation char it
517  /// corresponds to, e.g. "<<=".
518  static const char *getOpcodeStr(Opcode Op);
519
520  /// predicates to categorize the respective opcodes.
521  bool isMultiplicativeOp() const { return Opc >= Mul && Opc <= Rem; }
522  bool isAdditiveOp() const { return Opc == Add || Opc == Sub; }
523  bool isShiftOp() const { return Opc == Shl || Opc == Shr; }
524  bool isBitwiseOp() const { return Opc >= And && Opc <= Or; }
525  bool isRelationalOp() const { return Opc >= LT && Opc <= GE; }
526  bool isEqualityOp() const { return Opc == EQ || Opc == NE; }
527  bool isLogicalOp() const { return Opc == LAnd || Opc == LOr; }
528  bool isAssignmentOp() const { return Opc >= Assign && Opc <= OrAssign; }
529  bool isCompoundAssignmentOp() const { return Opc > Assign && Opc <= OrAssign;}
530  bool isShiftAssignOp() const { return Opc == ShlAssign || Opc == ShrAssign; }
531
532  virtual void visit(StmtVisitor &Visitor);
533  static bool classof(const Stmt *T) {
534    return T->getStmtClass() == BinaryOperatorClass;
535  }
536  static bool classof(const BinaryOperator *) { return true; }
537private:
538  Expr *LHS, *RHS;
539  Opcode Opc;
540protected:
541  BinaryOperator(Expr *lhs, Expr *rhs, Opcode opc, QualType ResTy, bool dead)
542    : Expr(BinaryOperatorClass, ResTy), LHS(lhs), RHS(rhs), Opc(opc) {
543  }
544};
545
546/// CompoundAssignOperator - For compound assignments (e.g. +=), we keep
547/// track of the type the operation is performed in.  Due to the semantics of
548/// these operators, the operands are promoted, the aritmetic performed, an
549/// implicit conversion back to the result type done, then the assignment takes
550/// place.  This captures the intermediate type which the computation is done
551/// in.
552class CompoundAssignOperator : public BinaryOperator {
553  QualType ComputationType;
554public:
555  CompoundAssignOperator(Expr *lhs, Expr *rhs, Opcode opc,
556                         QualType ResType, QualType CompType)
557    : BinaryOperator(lhs, rhs, opc, ResType, true), ComputationType(CompType) {
558    assert(isCompoundAssignmentOp() &&
559           "Only should be used for compound assignments");
560  }
561
562  QualType getComputationType() const { return ComputationType; }
563
564  static bool classof(const CompoundAssignOperator *) { return true; }
565  static bool classof(const BinaryOperator *B) {
566    return B->isCompoundAssignmentOp();
567  }
568  static bool classof(const Stmt *S) {
569    return isa<BinaryOperator>(S) && classof(cast<BinaryOperator>(S));
570  }
571};
572
573/// ConditionalOperator - The ?: operator.  Note that LHS may be null when the
574/// GNU "missing LHS" extension is in use.
575///
576class ConditionalOperator : public Expr {
577  Expr *Cond, *LHS, *RHS;  // Left/Middle/Right hand sides.
578public:
579  ConditionalOperator(Expr *cond, Expr *lhs, Expr *rhs, QualType t)
580    : Expr(ConditionalOperatorClass, t), Cond(cond), LHS(lhs), RHS(rhs) {}
581
582  Expr *getCond() const { return Cond; }
583  Expr *getLHS() const { return LHS; }
584  Expr *getRHS() const { return RHS; }
585
586  virtual SourceRange getSourceRange() const {
587    return SourceRange(getCond()->getLocStart(), getRHS()->getLocEnd());
588  }
589  virtual void visit(StmtVisitor &Visitor);
590  static bool classof(const Stmt *T) {
591    return T->getStmtClass() == ConditionalOperatorClass;
592  }
593  static bool classof(const ConditionalOperator *) { return true; }
594};
595
596/// AddrLabel - The GNU address of label extension, representing &&label.
597class AddrLabel : public Expr {
598  SourceLocation AmpAmpLoc, LabelLoc;
599  LabelStmt *Label;
600public:
601  AddrLabel(SourceLocation AALoc, SourceLocation LLoc, LabelStmt *L, QualType t)
602    : Expr(AddrLabelClass, t), AmpAmpLoc(AALoc), LabelLoc(LLoc), Label(L) {}
603
604  virtual SourceRange getSourceRange() const {
605    return SourceRange(AmpAmpLoc, LabelLoc);
606  }
607
608  LabelStmt *getLabel() const { return Label; }
609
610  virtual void visit(StmtVisitor &Visitor);
611  static bool classof(const Stmt *T) {
612    return T->getStmtClass() == AddrLabelClass;
613  }
614  static bool classof(const AddrLabel *) { return true; }
615};
616
617}  // end namespace clang
618
619#endif
620