]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/blob - contrib/llvm/tools/clang/include/clang/AST/Stmt.h
Import libc++ trunk r165949. Among other improvements and bug fixes,
[FreeBSD/FreeBSD.git] / contrib / llvm / tools / clang / include / clang / AST / Stmt.h
1 //===--- Stmt.h - Classes for representing statements -----------*- C++ -*-===//
2 //
3 //                     The LLVM Compiler Infrastructure
4 //
5 // This file is distributed under the University of Illinois Open Source
6 // License. See LICENSE.TXT for details.
7 //
8 //===----------------------------------------------------------------------===//
9 //
10 //  This file defines the Stmt interface and subclasses.
11 //
12 //===----------------------------------------------------------------------===//
13
14 #ifndef LLVM_CLANG_AST_STMT_H
15 #define LLVM_CLANG_AST_STMT_H
16
17 #include "clang/Basic/LLVM.h"
18 #include "clang/Basic/SourceLocation.h"
19 #include "clang/AST/PrettyPrinter.h"
20 #include "clang/AST/StmtIterator.h"
21 #include "clang/AST/DeclGroup.h"
22 #include "clang/AST/Attr.h"
23 #include "clang/Lex/Token.h"
24 #include "llvm/ADT/SmallVector.h"
25 #include "llvm/Support/Compiler.h"
26 #include "llvm/Support/raw_ostream.h"
27 #include <string>
28
29 namespace llvm {
30   class FoldingSetNodeID;
31 }
32
33 namespace clang {
34   class ASTContext;
35   class Expr;
36   class Decl;
37   class ParmVarDecl;
38   class QualType;
39   class IdentifierInfo;
40   class LabelDecl;
41   class SourceManager;
42   class StringLiteral;
43   class SwitchStmt;
44   class VarDecl;
45
46   //===--------------------------------------------------------------------===//
47   // ExprIterator - Iterators for iterating over Stmt* arrays that contain
48   //  only Expr*.  This is needed because AST nodes use Stmt* arrays to store
49   //  references to children (to be compatible with StmtIterator).
50   //===--------------------------------------------------------------------===//
51
52   class Stmt;
53   class Expr;
54
55   class ExprIterator {
56     Stmt** I;
57   public:
58     ExprIterator(Stmt** i) : I(i) {}
59     ExprIterator() : I(0) {}
60     ExprIterator& operator++() { ++I; return *this; }
61     ExprIterator operator-(size_t i) { return I-i; }
62     ExprIterator operator+(size_t i) { return I+i; }
63     Expr* operator[](size_t idx);
64     // FIXME: Verify that this will correctly return a signed distance.
65     signed operator-(const ExprIterator& R) const { return I - R.I; }
66     Expr* operator*() const;
67     Expr* operator->() const;
68     bool operator==(const ExprIterator& R) const { return I == R.I; }
69     bool operator!=(const ExprIterator& R) const { return I != R.I; }
70     bool operator>(const ExprIterator& R) const { return I > R.I; }
71     bool operator>=(const ExprIterator& R) const { return I >= R.I; }
72   };
73
74   class ConstExprIterator {
75     const Stmt * const *I;
76   public:
77     ConstExprIterator(const Stmt * const *i) : I(i) {}
78     ConstExprIterator() : I(0) {}
79     ConstExprIterator& operator++() { ++I; return *this; }
80     ConstExprIterator operator+(size_t i) const { return I+i; }
81     ConstExprIterator operator-(size_t i) const { return I-i; }
82     const Expr * operator[](size_t idx) const;
83     signed operator-(const ConstExprIterator& R) const { return I - R.I; }
84     const Expr * operator*() const;
85     const Expr * operator->() const;
86     bool operator==(const ConstExprIterator& R) const { return I == R.I; }
87     bool operator!=(const ConstExprIterator& R) const { return I != R.I; }
88     bool operator>(const ConstExprIterator& R) const { return I > R.I; }
89     bool operator>=(const ConstExprIterator& R) const { return I >= R.I; }
90   };
91
92 //===----------------------------------------------------------------------===//
93 // AST classes for statements.
94 //===----------------------------------------------------------------------===//
95
96 /// Stmt - This represents one statement.
97 ///
98 class Stmt {
99 public:
100   enum StmtClass {
101     NoStmtClass = 0,
102 #define STMT(CLASS, PARENT) CLASS##Class,
103 #define STMT_RANGE(BASE, FIRST, LAST) \
104         first##BASE##Constant=FIRST##Class, last##BASE##Constant=LAST##Class,
105 #define LAST_STMT_RANGE(BASE, FIRST, LAST) \
106         first##BASE##Constant=FIRST##Class, last##BASE##Constant=LAST##Class
107 #define ABSTRACT_STMT(STMT)
108 #include "clang/AST/StmtNodes.inc"
109   };
110
111   // Make vanilla 'new' and 'delete' illegal for Stmts.
112 protected:
113   void* operator new(size_t bytes) throw() {
114     llvm_unreachable("Stmts cannot be allocated with regular 'new'.");
115   }
116   void operator delete(void* data) throw() {
117     llvm_unreachable("Stmts cannot be released with regular 'delete'.");
118   }
119
120   class StmtBitfields {
121     friend class Stmt;
122
123     /// \brief The statement class.
124     unsigned sClass : 8;
125   };
126   enum { NumStmtBits = 8 };
127
128   class CompoundStmtBitfields {
129     friend class CompoundStmt;
130     unsigned : NumStmtBits;
131
132     unsigned NumStmts : 32 - NumStmtBits;
133   };
134
135   class ExprBitfields {
136     friend class Expr;
137     friend class DeclRefExpr; // computeDependence
138     friend class InitListExpr; // ctor
139     friend class DesignatedInitExpr; // ctor
140     friend class BlockDeclRefExpr; // ctor
141     friend class ASTStmtReader; // deserialization
142     friend class CXXNewExpr; // ctor
143     friend class DependentScopeDeclRefExpr; // ctor
144     friend class CXXConstructExpr; // ctor
145     friend class CallExpr; // ctor
146     friend class OffsetOfExpr; // ctor
147     friend class ObjCMessageExpr; // ctor
148     friend class ObjCArrayLiteral; // ctor
149     friend class ObjCDictionaryLiteral; // ctor
150     friend class ShuffleVectorExpr; // ctor
151     friend class ParenListExpr; // ctor
152     friend class CXXUnresolvedConstructExpr; // ctor
153     friend class CXXDependentScopeMemberExpr; // ctor
154     friend class OverloadExpr; // ctor
155     friend class PseudoObjectExpr; // ctor
156     friend class AtomicExpr; // ctor
157     unsigned : NumStmtBits;
158
159     unsigned ValueKind : 2;
160     unsigned ObjectKind : 2;
161     unsigned TypeDependent : 1;
162     unsigned ValueDependent : 1;
163     unsigned InstantiationDependent : 1;
164     unsigned ContainsUnexpandedParameterPack : 1;
165   };
166   enum { NumExprBits = 16 };
167
168   class CharacterLiteralBitfields {
169     friend class CharacterLiteral;
170     unsigned : NumExprBits;
171
172     unsigned Kind : 2;
173   };
174
175   class FloatingLiteralBitfields {
176     friend class FloatingLiteral;
177     unsigned : NumExprBits;
178
179     unsigned IsIEEE : 1; // Distinguishes between PPC128 and IEEE128.
180     unsigned IsExact : 1;
181   };
182
183   class UnaryExprOrTypeTraitExprBitfields {
184     friend class UnaryExprOrTypeTraitExpr;
185     unsigned : NumExprBits;
186
187     unsigned Kind : 2;
188     unsigned IsType : 1; // true if operand is a type, false if an expression.
189   };
190
191   class DeclRefExprBitfields {
192     friend class DeclRefExpr;
193     friend class ASTStmtReader; // deserialization
194     unsigned : NumExprBits;
195
196     unsigned HasQualifier : 1;
197     unsigned HasTemplateKWAndArgsInfo : 1;
198     unsigned HasFoundDecl : 1;
199     unsigned HadMultipleCandidates : 1;
200     unsigned RefersToEnclosingLocal : 1;
201   };
202
203   class CastExprBitfields {
204     friend class CastExpr;
205     unsigned : NumExprBits;
206
207     unsigned Kind : 6;
208     unsigned BasePathSize : 32 - 6 - NumExprBits;
209   };
210
211   class CallExprBitfields {
212     friend class CallExpr;
213     unsigned : NumExprBits;
214
215     unsigned NumPreArgs : 1;
216   };
217
218   class ExprWithCleanupsBitfields {
219     friend class ExprWithCleanups;
220     friend class ASTStmtReader; // deserialization
221
222     unsigned : NumExprBits;
223
224     unsigned NumObjects : 32 - NumExprBits;
225   };
226
227   class PseudoObjectExprBitfields {
228     friend class PseudoObjectExpr;
229     friend class ASTStmtReader; // deserialization
230
231     unsigned : NumExprBits;
232
233     // These don't need to be particularly wide, because they're
234     // strictly limited by the forms of expressions we permit.
235     unsigned NumSubExprs : 8;
236     unsigned ResultIndex : 32 - 8 - NumExprBits;
237   };
238
239   class ObjCIndirectCopyRestoreExprBitfields {
240     friend class ObjCIndirectCopyRestoreExpr;
241     unsigned : NumExprBits;
242
243     unsigned ShouldCopy : 1;
244   };
245
246   class InitListExprBitfields {
247     friend class InitListExpr;
248
249     unsigned : NumExprBits;
250
251     /// Whether this initializer list originally had a GNU array-range
252     /// designator in it. This is a temporary marker used by CodeGen.
253     unsigned HadArrayRangeDesignator : 1;
254
255     /// Whether this initializer list initializes a std::initializer_list
256     /// object.
257     unsigned InitializesStdInitializerList : 1;
258   };
259
260   class TypeTraitExprBitfields {
261     friend class TypeTraitExpr;
262     friend class ASTStmtReader;
263     friend class ASTStmtWriter;
264     
265     unsigned : NumExprBits;
266     
267     /// \brief The kind of type trait, which is a value of a TypeTrait enumerator.
268     unsigned Kind : 8;
269     
270     /// \brief If this expression is not value-dependent, this indicates whether
271     /// the trait evaluated true or false.
272     unsigned Value : 1;
273
274     /// \brief The number of arguments to this type trait.
275     unsigned NumArgs : 32 - 8 - 1 - NumExprBits;
276   };
277   
278   union {
279     // FIXME: this is wasteful on 64-bit platforms.
280     void *Aligner;
281
282     StmtBitfields StmtBits;
283     CompoundStmtBitfields CompoundStmtBits;
284     ExprBitfields ExprBits;
285     CharacterLiteralBitfields CharacterLiteralBits;
286     FloatingLiteralBitfields FloatingLiteralBits;
287     UnaryExprOrTypeTraitExprBitfields UnaryExprOrTypeTraitExprBits;
288     DeclRefExprBitfields DeclRefExprBits;
289     CastExprBitfields CastExprBits;
290     CallExprBitfields CallExprBits;
291     ExprWithCleanupsBitfields ExprWithCleanupsBits;
292     PseudoObjectExprBitfields PseudoObjectExprBits;
293     ObjCIndirectCopyRestoreExprBitfields ObjCIndirectCopyRestoreExprBits;
294     InitListExprBitfields InitListExprBits;
295     TypeTraitExprBitfields TypeTraitExprBits;
296   };
297
298   friend class ASTStmtReader;
299   friend class ASTStmtWriter;
300
301 public:
302   // Only allow allocation of Stmts using the allocator in ASTContext
303   // or by doing a placement new.
304   void* operator new(size_t bytes, ASTContext& C,
305                      unsigned alignment = 8) throw() {
306     return ::operator new(bytes, C, alignment);
307   }
308
309   void* operator new(size_t bytes, ASTContext* C,
310                      unsigned alignment = 8) throw() {
311     return ::operator new(bytes, *C, alignment);
312   }
313
314   void* operator new(size_t bytes, void* mem) throw() {
315     return mem;
316   }
317
318   void operator delete(void*, ASTContext&, unsigned) throw() { }
319   void operator delete(void*, ASTContext*, unsigned) throw() { }
320   void operator delete(void*, std::size_t) throw() { }
321   void operator delete(void*, void*) throw() { }
322
323 public:
324   /// \brief A placeholder type used to construct an empty shell of a
325   /// type, that will be filled in later (e.g., by some
326   /// de-serialization).
327   struct EmptyShell { };
328
329 private:
330   /// \brief Whether statistic collection is enabled.
331   static bool StatisticsEnabled;
332
333 protected:
334   /// \brief Construct an empty statement.
335   explicit Stmt(StmtClass SC, EmptyShell) {
336     StmtBits.sClass = SC;
337     if (StatisticsEnabled) Stmt::addStmtClass(SC);
338   }
339
340 public:
341   Stmt(StmtClass SC) {
342     StmtBits.sClass = SC;
343     if (StatisticsEnabled) Stmt::addStmtClass(SC);
344   }
345
346   StmtClass getStmtClass() const {
347     return static_cast<StmtClass>(StmtBits.sClass);
348   }
349   const char *getStmtClassName() const;
350
351   /// SourceLocation tokens are not useful in isolation - they are low level
352   /// value objects created/interpreted by SourceManager. We assume AST
353   /// clients will have a pointer to the respective SourceManager.
354   SourceRange getSourceRange() const LLVM_READONLY;
355   SourceLocation getLocStart() const LLVM_READONLY;
356   SourceLocation getLocEnd() const LLVM_READONLY;
357
358   // global temp stats (until we have a per-module visitor)
359   static void addStmtClass(const StmtClass s);
360   static void EnableStatistics();
361   static void PrintStats();
362
363   /// dump - This does a local dump of the specified AST fragment.  It dumps the
364   /// specified node and a few nodes underneath it, but not the whole subtree.
365   /// This is useful in a debugger.
366   LLVM_ATTRIBUTE_USED void dump() const;
367   LLVM_ATTRIBUTE_USED void dump(SourceManager &SM) const;
368   void dump(raw_ostream &OS, SourceManager &SM) const;
369
370   /// dumpAll - This does a dump of the specified AST fragment and all subtrees.
371   void dumpAll() const;
372   void dumpAll(SourceManager &SM) const;
373
374   /// dumpPretty/printPretty - These two methods do a "pretty print" of the AST
375   /// back to its original source language syntax.
376   void dumpPretty(ASTContext &Context) const;
377   void printPretty(raw_ostream &OS, PrinterHelper *Helper,
378                    const PrintingPolicy &Policy,
379                    unsigned Indentation = 0) const;
380
381   /// viewAST - Visualize an AST rooted at this Stmt* using GraphViz.  Only
382   ///   works on systems with GraphViz (Mac OS X) or dot+gv installed.
383   void viewAST() const;
384
385   /// Skip past any implicit AST nodes which might surround this
386   /// statement, such as ExprWithCleanups or ImplicitCastExpr nodes.
387   Stmt *IgnoreImplicit();
388
389   const Stmt *stripLabelLikeStatements() const;
390   Stmt *stripLabelLikeStatements() {
391     return const_cast<Stmt*>(
392       const_cast<const Stmt*>(this)->stripLabelLikeStatements());
393   }
394
395   // Implement isa<T> support.
396   static bool classof(const Stmt *) { return true; }
397
398   /// hasImplicitControlFlow - Some statements (e.g. short circuited operations)
399   ///  contain implicit control-flow in the order their subexpressions
400   ///  are evaluated.  This predicate returns true if this statement has
401   ///  such implicit control-flow.  Such statements are also specially handled
402   ///  within CFGs.
403   bool hasImplicitControlFlow() const;
404
405   /// Child Iterators: All subclasses must implement 'children'
406   /// to permit easy iteration over the substatements/subexpessions of an
407   /// AST node.  This permits easy iteration over all nodes in the AST.
408   typedef StmtIterator       child_iterator;
409   typedef ConstStmtIterator  const_child_iterator;
410
411   typedef StmtRange          child_range;
412   typedef ConstStmtRange     const_child_range;
413
414   child_range children();
415   const_child_range children() const {
416     return const_cast<Stmt*>(this)->children();
417   }
418
419   child_iterator child_begin() { return children().first; }
420   child_iterator child_end() { return children().second; }
421
422   const_child_iterator child_begin() const { return children().first; }
423   const_child_iterator child_end() const { return children().second; }
424
425   /// \brief Produce a unique representation of the given statement.
426   ///
427   /// \brief ID once the profiling operation is complete, will contain
428   /// the unique representation of the given statement.
429   ///
430   /// \brief Context the AST context in which the statement resides
431   ///
432   /// \brief Canonical whether the profile should be based on the canonical
433   /// representation of this statement (e.g., where non-type template
434   /// parameters are identified by index/level rather than their
435   /// declaration pointers) or the exact representation of the statement as
436   /// written in the source.
437   void Profile(llvm::FoldingSetNodeID &ID, const ASTContext &Context,
438                bool Canonical) const;
439 };
440
441 /// DeclStmt - Adaptor class for mixing declarations with statements and
442 /// expressions. For example, CompoundStmt mixes statements, expressions
443 /// and declarations (variables, types). Another example is ForStmt, where
444 /// the first statement can be an expression or a declaration.
445 ///
446 class DeclStmt : public Stmt {
447   DeclGroupRef DG;
448   SourceLocation StartLoc, EndLoc;
449
450 public:
451   DeclStmt(DeclGroupRef dg, SourceLocation startLoc,
452            SourceLocation endLoc) : Stmt(DeclStmtClass), DG(dg),
453                                     StartLoc(startLoc), EndLoc(endLoc) {}
454
455   /// \brief Build an empty declaration statement.
456   explicit DeclStmt(EmptyShell Empty) : Stmt(DeclStmtClass, Empty) { }
457
458   /// isSingleDecl - This method returns true if this DeclStmt refers
459   /// to a single Decl.
460   bool isSingleDecl() const {
461     return DG.isSingleDecl();
462   }
463
464   const Decl *getSingleDecl() const { return DG.getSingleDecl(); }
465   Decl *getSingleDecl() { return DG.getSingleDecl(); }
466
467   const DeclGroupRef getDeclGroup() const { return DG; }
468   DeclGroupRef getDeclGroup() { return DG; }
469   void setDeclGroup(DeclGroupRef DGR) { DG = DGR; }
470
471   SourceLocation getStartLoc() const { return StartLoc; }
472   void setStartLoc(SourceLocation L) { StartLoc = L; }
473   SourceLocation getEndLoc() const { return EndLoc; }
474   void setEndLoc(SourceLocation L) { EndLoc = L; }
475
476   SourceRange getSourceRange() const LLVM_READONLY {
477     return SourceRange(StartLoc, EndLoc);
478   }
479
480   static bool classof(const Stmt *T) {
481     return T->getStmtClass() == DeclStmtClass;
482   }
483   static bool classof(const DeclStmt *) { return true; }
484
485   // Iterators over subexpressions.
486   child_range children() {
487     return child_range(child_iterator(DG.begin(), DG.end()),
488                        child_iterator(DG.end(), DG.end()));
489   }
490
491   typedef DeclGroupRef::iterator decl_iterator;
492   typedef DeclGroupRef::const_iterator const_decl_iterator;
493
494   decl_iterator decl_begin() { return DG.begin(); }
495   decl_iterator decl_end() { return DG.end(); }
496   const_decl_iterator decl_begin() const { return DG.begin(); }
497   const_decl_iterator decl_end() const { return DG.end(); }
498
499   typedef std::reverse_iterator<decl_iterator> reverse_decl_iterator;
500   reverse_decl_iterator decl_rbegin() {
501     return reverse_decl_iterator(decl_end());
502   }
503   reverse_decl_iterator decl_rend() {
504     return reverse_decl_iterator(decl_begin());
505   }
506 };
507
508 /// NullStmt - This is the null statement ";": C99 6.8.3p3.
509 ///
510 class NullStmt : public Stmt {
511   SourceLocation SemiLoc;
512
513   /// \brief True if the null statement was preceded by an empty macro, e.g:
514   /// @code
515   ///   #define CALL(x)
516   ///   CALL(0);
517   /// @endcode
518   bool HasLeadingEmptyMacro;
519 public:
520   NullStmt(SourceLocation L, bool hasLeadingEmptyMacro = false)
521     : Stmt(NullStmtClass), SemiLoc(L),
522       HasLeadingEmptyMacro(hasLeadingEmptyMacro) {}
523
524   /// \brief Build an empty null statement.
525   explicit NullStmt(EmptyShell Empty) : Stmt(NullStmtClass, Empty),
526       HasLeadingEmptyMacro(false) { }
527
528   SourceLocation getSemiLoc() const { return SemiLoc; }
529   void setSemiLoc(SourceLocation L) { SemiLoc = L; }
530
531   bool hasLeadingEmptyMacro() const { return HasLeadingEmptyMacro; }
532
533   SourceRange getSourceRange() const LLVM_READONLY { return SourceRange(SemiLoc); }
534
535   static bool classof(const Stmt *T) {
536     return T->getStmtClass() == NullStmtClass;
537   }
538   static bool classof(const NullStmt *) { return true; }
539
540   child_range children() { return child_range(); }
541
542   friend class ASTStmtReader;
543   friend class ASTStmtWriter;
544 };
545
546 /// CompoundStmt - This represents a group of statements like { stmt stmt }.
547 ///
548 class CompoundStmt : public Stmt {
549   Stmt** Body;
550   SourceLocation LBracLoc, RBracLoc;
551 public:
552   CompoundStmt(ASTContext &C, Stmt **StmtStart, unsigned NumStmts,
553                SourceLocation LB, SourceLocation RB);
554
555   // \brief Build an empty compound statment with a location.
556   explicit CompoundStmt(SourceLocation Loc)
557     : Stmt(CompoundStmtClass), Body(0), LBracLoc(Loc), RBracLoc(Loc) {
558     CompoundStmtBits.NumStmts = 0;
559   }
560
561   // \brief Build an empty compound statement.
562   explicit CompoundStmt(EmptyShell Empty)
563     : Stmt(CompoundStmtClass, Empty), Body(0) {
564     CompoundStmtBits.NumStmts = 0;
565   }
566
567   void setStmts(ASTContext &C, Stmt **Stmts, unsigned NumStmts);
568
569   bool body_empty() const { return CompoundStmtBits.NumStmts == 0; }
570   unsigned size() const { return CompoundStmtBits.NumStmts; }
571
572   typedef Stmt** body_iterator;
573   body_iterator body_begin() { return Body; }
574   body_iterator body_end() { return Body + size(); }
575   Stmt *body_back() { return !body_empty() ? Body[size()-1] : 0; }
576
577   void setLastStmt(Stmt *S) {
578     assert(!body_empty() && "setLastStmt");
579     Body[size()-1] = S;
580   }
581
582   typedef Stmt* const * const_body_iterator;
583   const_body_iterator body_begin() const { return Body; }
584   const_body_iterator body_end() const { return Body + size(); }
585   const Stmt *body_back() const { return !body_empty() ? Body[size()-1] : 0; }
586
587   typedef std::reverse_iterator<body_iterator> reverse_body_iterator;
588   reverse_body_iterator body_rbegin() {
589     return reverse_body_iterator(body_end());
590   }
591   reverse_body_iterator body_rend() {
592     return reverse_body_iterator(body_begin());
593   }
594
595   typedef std::reverse_iterator<const_body_iterator>
596           const_reverse_body_iterator;
597
598   const_reverse_body_iterator body_rbegin() const {
599     return const_reverse_body_iterator(body_end());
600   }
601
602   const_reverse_body_iterator body_rend() const {
603     return const_reverse_body_iterator(body_begin());
604   }
605
606   SourceRange getSourceRange() const LLVM_READONLY {
607     return SourceRange(LBracLoc, RBracLoc);
608   }
609
610   SourceLocation getLBracLoc() const { return LBracLoc; }
611   void setLBracLoc(SourceLocation L) { LBracLoc = L; }
612   SourceLocation getRBracLoc() const { return RBracLoc; }
613   void setRBracLoc(SourceLocation L) { RBracLoc = L; }
614
615   static bool classof(const Stmt *T) {
616     return T->getStmtClass() == CompoundStmtClass;
617   }
618   static bool classof(const CompoundStmt *) { return true; }
619
620   // Iterators
621   child_range children() {
622     return child_range(&Body[0], &Body[0]+CompoundStmtBits.NumStmts);
623   }
624
625   const_child_range children() const {
626     return child_range(&Body[0], &Body[0]+CompoundStmtBits.NumStmts);
627   }
628 };
629
630 // SwitchCase is the base class for CaseStmt and DefaultStmt,
631 class SwitchCase : public Stmt {
632 protected:
633   // A pointer to the following CaseStmt or DefaultStmt class,
634   // used by SwitchStmt.
635   SwitchCase *NextSwitchCase;
636
637   SwitchCase(StmtClass SC) : Stmt(SC), NextSwitchCase(0) {}
638
639 public:
640   const SwitchCase *getNextSwitchCase() const { return NextSwitchCase; }
641
642   SwitchCase *getNextSwitchCase() { return NextSwitchCase; }
643
644   void setNextSwitchCase(SwitchCase *SC) { NextSwitchCase = SC; }
645
646   Stmt *getSubStmt();
647   const Stmt *getSubStmt() const {
648     return const_cast<SwitchCase*>(this)->getSubStmt();
649   }
650
651   SourceRange getSourceRange() const LLVM_READONLY { return SourceRange(); }
652
653   static bool classof(const Stmt *T) {
654     return T->getStmtClass() == CaseStmtClass ||
655            T->getStmtClass() == DefaultStmtClass;
656   }
657   static bool classof(const SwitchCase *) { return true; }
658 };
659
660 class CaseStmt : public SwitchCase {
661   enum { LHS, RHS, SUBSTMT, END_EXPR };
662   Stmt* SubExprs[END_EXPR];  // The expression for the RHS is Non-null for
663                              // GNU "case 1 ... 4" extension
664   SourceLocation CaseLoc;
665   SourceLocation EllipsisLoc;
666   SourceLocation ColonLoc;
667 public:
668   CaseStmt(Expr *lhs, Expr *rhs, SourceLocation caseLoc,
669            SourceLocation ellipsisLoc, SourceLocation colonLoc)
670     : SwitchCase(CaseStmtClass) {
671     SubExprs[SUBSTMT] = 0;
672     SubExprs[LHS] = reinterpret_cast<Stmt*>(lhs);
673     SubExprs[RHS] = reinterpret_cast<Stmt*>(rhs);
674     CaseLoc = caseLoc;
675     EllipsisLoc = ellipsisLoc;
676     ColonLoc = colonLoc;
677   }
678
679   /// \brief Build an empty switch case statement.
680   explicit CaseStmt(EmptyShell Empty) : SwitchCase(CaseStmtClass) { }
681
682   SourceLocation getCaseLoc() const { return CaseLoc; }
683   void setCaseLoc(SourceLocation L) { CaseLoc = L; }
684   SourceLocation getEllipsisLoc() const { return EllipsisLoc; }
685   void setEllipsisLoc(SourceLocation L) { EllipsisLoc = L; }
686   SourceLocation getColonLoc() const { return ColonLoc; }
687   void setColonLoc(SourceLocation L) { ColonLoc = L; }
688
689   Expr *getLHS() { return reinterpret_cast<Expr*>(SubExprs[LHS]); }
690   Expr *getRHS() { return reinterpret_cast<Expr*>(SubExprs[RHS]); }
691   Stmt *getSubStmt() { return SubExprs[SUBSTMT]; }
692
693   const Expr *getLHS() const {
694     return reinterpret_cast<const Expr*>(SubExprs[LHS]);
695   }
696   const Expr *getRHS() const {
697     return reinterpret_cast<const Expr*>(SubExprs[RHS]);
698   }
699   const Stmt *getSubStmt() const { return SubExprs[SUBSTMT]; }
700
701   void setSubStmt(Stmt *S) { SubExprs[SUBSTMT] = S; }
702   void setLHS(Expr *Val) { SubExprs[LHS] = reinterpret_cast<Stmt*>(Val); }
703   void setRHS(Expr *Val) { SubExprs[RHS] = reinterpret_cast<Stmt*>(Val); }
704
705
706   SourceRange getSourceRange() const LLVM_READONLY {
707     // Handle deeply nested case statements with iteration instead of recursion.
708     const CaseStmt *CS = this;
709     while (const CaseStmt *CS2 = dyn_cast<CaseStmt>(CS->getSubStmt()))
710       CS = CS2;
711
712     return SourceRange(CaseLoc, CS->getSubStmt()->getLocEnd());
713   }
714   static bool classof(const Stmt *T) {
715     return T->getStmtClass() == CaseStmtClass;
716   }
717   static bool classof(const CaseStmt *) { return true; }
718
719   // Iterators
720   child_range children() {
721     return child_range(&SubExprs[0], &SubExprs[END_EXPR]);
722   }
723 };
724
725 class DefaultStmt : public SwitchCase {
726   Stmt* SubStmt;
727   SourceLocation DefaultLoc;
728   SourceLocation ColonLoc;
729 public:
730   DefaultStmt(SourceLocation DL, SourceLocation CL, Stmt *substmt) :
731     SwitchCase(DefaultStmtClass), SubStmt(substmt), DefaultLoc(DL),
732     ColonLoc(CL) {}
733
734   /// \brief Build an empty default statement.
735   explicit DefaultStmt(EmptyShell) : SwitchCase(DefaultStmtClass) { }
736
737   Stmt *getSubStmt() { return SubStmt; }
738   const Stmt *getSubStmt() const { return SubStmt; }
739   void setSubStmt(Stmt *S) { SubStmt = S; }
740
741   SourceLocation getDefaultLoc() const { return DefaultLoc; }
742   void setDefaultLoc(SourceLocation L) { DefaultLoc = L; }
743   SourceLocation getColonLoc() const { return ColonLoc; }
744   void setColonLoc(SourceLocation L) { ColonLoc = L; }
745
746   SourceRange getSourceRange() const LLVM_READONLY {
747     return SourceRange(DefaultLoc, SubStmt->getLocEnd());
748   }
749   static bool classof(const Stmt *T) {
750     return T->getStmtClass() == DefaultStmtClass;
751   }
752   static bool classof(const DefaultStmt *) { return true; }
753
754   // Iterators
755   child_range children() { return child_range(&SubStmt, &SubStmt+1); }
756 };
757
758
759 /// LabelStmt - Represents a label, which has a substatement.  For example:
760 ///    foo: return;
761 ///
762 class LabelStmt : public Stmt {
763   LabelDecl *TheDecl;
764   Stmt *SubStmt;
765   SourceLocation IdentLoc;
766 public:
767   LabelStmt(SourceLocation IL, LabelDecl *D, Stmt *substmt)
768     : Stmt(LabelStmtClass), TheDecl(D), SubStmt(substmt), IdentLoc(IL) {
769   }
770
771   // \brief Build an empty label statement.
772   explicit LabelStmt(EmptyShell Empty) : Stmt(LabelStmtClass, Empty) { }
773
774   SourceLocation getIdentLoc() const { return IdentLoc; }
775   LabelDecl *getDecl() const { return TheDecl; }
776   void setDecl(LabelDecl *D) { TheDecl = D; }
777   const char *getName() const;
778   Stmt *getSubStmt() { return SubStmt; }
779   const Stmt *getSubStmt() const { return SubStmt; }
780   void setIdentLoc(SourceLocation L) { IdentLoc = L; }
781   void setSubStmt(Stmt *SS) { SubStmt = SS; }
782
783   SourceRange getSourceRange() const LLVM_READONLY {
784     return SourceRange(IdentLoc, SubStmt->getLocEnd());
785   }
786   child_range children() { return child_range(&SubStmt, &SubStmt+1); }
787
788   static bool classof(const Stmt *T) {
789     return T->getStmtClass() == LabelStmtClass;
790   }
791   static bool classof(const LabelStmt *) { return true; }
792 };
793
794
795 /// \brief Represents an attribute applied to a statement.
796 ///
797 /// Represents an attribute applied to a statement. For example:
798 ///   [[omp::for(...)]] for (...) { ... }
799 ///
800 class AttributedStmt : public Stmt {
801   Stmt *SubStmt;
802   SourceLocation AttrLoc;
803   unsigned NumAttrs;
804   const Attr *Attrs[1];
805
806   friend class ASTStmtReader;
807
808   AttributedStmt(SourceLocation Loc, ArrayRef<const Attr*> Attrs, Stmt *SubStmt)
809     : Stmt(AttributedStmtClass), SubStmt(SubStmt), AttrLoc(Loc),
810       NumAttrs(Attrs.size()) {
811     memcpy(this->Attrs, Attrs.data(), Attrs.size() * sizeof(Attr*));
812   }
813
814   explicit AttributedStmt(EmptyShell Empty, unsigned NumAttrs)
815     : Stmt(AttributedStmtClass, Empty), NumAttrs(NumAttrs) {
816     memset(Attrs, 0, NumAttrs * sizeof(Attr*));
817   }
818
819 public:
820   static AttributedStmt *Create(ASTContext &C, SourceLocation Loc,
821                                 ArrayRef<const Attr*> Attrs, Stmt *SubStmt);
822   // \brief Build an empty attributed statement.
823   static AttributedStmt *CreateEmpty(ASTContext &C, unsigned NumAttrs);
824
825   SourceLocation getAttrLoc() const { return AttrLoc; }
826   ArrayRef<const Attr*> getAttrs() const {
827     return ArrayRef<const Attr*>(Attrs, NumAttrs);
828   }
829   Stmt *getSubStmt() { return SubStmt; }
830   const Stmt *getSubStmt() const { return SubStmt; }
831
832   SourceRange getSourceRange() const LLVM_READONLY {
833     return SourceRange(AttrLoc, SubStmt->getLocEnd());
834   }
835   child_range children() { return child_range(&SubStmt, &SubStmt + 1); }
836
837   static bool classof(const Stmt *T) {
838     return T->getStmtClass() == AttributedStmtClass;
839   }
840   static bool classof(const AttributedStmt *) { return true; }
841 };
842
843
844 /// IfStmt - This represents an if/then/else.
845 ///
846 class IfStmt : public Stmt {
847   enum { VAR, COND, THEN, ELSE, END_EXPR };
848   Stmt* SubExprs[END_EXPR];
849
850   SourceLocation IfLoc;
851   SourceLocation ElseLoc;
852
853 public:
854   IfStmt(ASTContext &C, SourceLocation IL, VarDecl *var, Expr *cond,
855          Stmt *then, SourceLocation EL = SourceLocation(), Stmt *elsev = 0);
856
857   /// \brief Build an empty if/then/else statement
858   explicit IfStmt(EmptyShell Empty) : Stmt(IfStmtClass, Empty) { }
859
860   /// \brief Retrieve the variable declared in this "if" statement, if any.
861   ///
862   /// In the following example, "x" is the condition variable.
863   /// \code
864   /// if (int x = foo()) {
865   ///   printf("x is %d", x);
866   /// }
867   /// \endcode
868   VarDecl *getConditionVariable() const;
869   void setConditionVariable(ASTContext &C, VarDecl *V);
870
871   /// If this IfStmt has a condition variable, return the faux DeclStmt
872   /// associated with the creation of that condition variable.
873   const DeclStmt *getConditionVariableDeclStmt() const {
874     return reinterpret_cast<DeclStmt*>(SubExprs[VAR]);
875   }
876
877   const Expr *getCond() const { return reinterpret_cast<Expr*>(SubExprs[COND]);}
878   void setCond(Expr *E) { SubExprs[COND] = reinterpret_cast<Stmt *>(E); }
879   const Stmt *getThen() const { return SubExprs[THEN]; }
880   void setThen(Stmt *S) { SubExprs[THEN] = S; }
881   const Stmt *getElse() const { return SubExprs[ELSE]; }
882   void setElse(Stmt *S) { SubExprs[ELSE] = S; }
883
884   Expr *getCond() { return reinterpret_cast<Expr*>(SubExprs[COND]); }
885   Stmt *getThen() { return SubExprs[THEN]; }
886   Stmt *getElse() { return SubExprs[ELSE]; }
887
888   SourceLocation getIfLoc() const { return IfLoc; }
889   void setIfLoc(SourceLocation L) { IfLoc = L; }
890   SourceLocation getElseLoc() const { return ElseLoc; }
891   void setElseLoc(SourceLocation L) { ElseLoc = L; }
892
893   SourceRange getSourceRange() const LLVM_READONLY {
894     if (SubExprs[ELSE])
895       return SourceRange(IfLoc, SubExprs[ELSE]->getLocEnd());
896     else
897       return SourceRange(IfLoc, SubExprs[THEN]->getLocEnd());
898   }
899
900   // Iterators over subexpressions.  The iterators will include iterating
901   // over the initialization expression referenced by the condition variable.
902   child_range children() {
903     return child_range(&SubExprs[0], &SubExprs[0]+END_EXPR);
904   }
905
906   static bool classof(const Stmt *T) {
907     return T->getStmtClass() == IfStmtClass;
908   }
909   static bool classof(const IfStmt *) { return true; }
910 };
911
912 /// SwitchStmt - This represents a 'switch' stmt.
913 ///
914 class SwitchStmt : public Stmt {
915   enum { VAR, COND, BODY, END_EXPR };
916   Stmt* SubExprs[END_EXPR];
917   // This points to a linked list of case and default statements.
918   SwitchCase *FirstCase;
919   SourceLocation SwitchLoc;
920
921   /// If the SwitchStmt is a switch on an enum value, this records whether
922   /// all the enum values were covered by CaseStmts.  This value is meant to
923   /// be a hint for possible clients.
924   unsigned AllEnumCasesCovered : 1;
925
926 public:
927   SwitchStmt(ASTContext &C, VarDecl *Var, Expr *cond);
928
929   /// \brief Build a empty switch statement.
930   explicit SwitchStmt(EmptyShell Empty) : Stmt(SwitchStmtClass, Empty) { }
931
932   /// \brief Retrieve the variable declared in this "switch" statement, if any.
933   ///
934   /// In the following example, "x" is the condition variable.
935   /// \code
936   /// switch (int x = foo()) {
937   ///   case 0: break;
938   ///   // ...
939   /// }
940   /// \endcode
941   VarDecl *getConditionVariable() const;
942   void setConditionVariable(ASTContext &C, VarDecl *V);
943
944   /// If this SwitchStmt has a condition variable, return the faux DeclStmt
945   /// associated with the creation of that condition variable.
946   const DeclStmt *getConditionVariableDeclStmt() const {
947     return reinterpret_cast<DeclStmt*>(SubExprs[VAR]);
948   }
949
950   const Expr *getCond() const { return reinterpret_cast<Expr*>(SubExprs[COND]);}
951   const Stmt *getBody() const { return SubExprs[BODY]; }
952   const SwitchCase *getSwitchCaseList() const { return FirstCase; }
953
954   Expr *getCond() { return reinterpret_cast<Expr*>(SubExprs[COND]);}
955   void setCond(Expr *E) { SubExprs[COND] = reinterpret_cast<Stmt *>(E); }
956   Stmt *getBody() { return SubExprs[BODY]; }
957   void setBody(Stmt *S) { SubExprs[BODY] = S; }
958   SwitchCase *getSwitchCaseList() { return FirstCase; }
959
960   /// \brief Set the case list for this switch statement.
961   ///
962   /// The caller is responsible for incrementing the retain counts on
963   /// all of the SwitchCase statements in this list.
964   void setSwitchCaseList(SwitchCase *SC) { FirstCase = SC; }
965
966   SourceLocation getSwitchLoc() const { return SwitchLoc; }
967   void setSwitchLoc(SourceLocation L) { SwitchLoc = L; }
968
969   void setBody(Stmt *S, SourceLocation SL) {
970     SubExprs[BODY] = S;
971     SwitchLoc = SL;
972   }
973   void addSwitchCase(SwitchCase *SC) {
974     assert(!SC->getNextSwitchCase()
975            && "case/default already added to a switch");
976     SC->setNextSwitchCase(FirstCase);
977     FirstCase = SC;
978   }
979
980   /// Set a flag in the SwitchStmt indicating that if the 'switch (X)' is a
981   /// switch over an enum value then all cases have been explicitly covered.
982   void setAllEnumCasesCovered() {
983     AllEnumCasesCovered = 1;
984   }
985
986   /// Returns true if the SwitchStmt is a switch of an enum value and all cases
987   /// have been explicitly covered.
988   bool isAllEnumCasesCovered() const {
989     return (bool) AllEnumCasesCovered;
990   }
991
992   SourceRange getSourceRange() const LLVM_READONLY {
993     return SourceRange(SwitchLoc, SubExprs[BODY]->getLocEnd());
994   }
995   // Iterators
996   child_range children() {
997     return child_range(&SubExprs[0], &SubExprs[0]+END_EXPR);
998   }
999
1000   static bool classof(const Stmt *T) {
1001     return T->getStmtClass() == SwitchStmtClass;
1002   }
1003   static bool classof(const SwitchStmt *) { return true; }
1004 };
1005
1006
1007 /// WhileStmt - This represents a 'while' stmt.
1008 ///
1009 class WhileStmt : public Stmt {
1010   enum { VAR, COND, BODY, END_EXPR };
1011   Stmt* SubExprs[END_EXPR];
1012   SourceLocation WhileLoc;
1013 public:
1014   WhileStmt(ASTContext &C, VarDecl *Var, Expr *cond, Stmt *body,
1015             SourceLocation WL);
1016
1017   /// \brief Build an empty while statement.
1018   explicit WhileStmt(EmptyShell Empty) : Stmt(WhileStmtClass, Empty) { }
1019
1020   /// \brief Retrieve the variable declared in this "while" statement, if any.
1021   ///
1022   /// In the following example, "x" is the condition variable.
1023   /// \code
1024   /// while (int x = random()) {
1025   ///   // ...
1026   /// }
1027   /// \endcode
1028   VarDecl *getConditionVariable() const;
1029   void setConditionVariable(ASTContext &C, VarDecl *V);
1030
1031   /// If this WhileStmt has a condition variable, return the faux DeclStmt
1032   /// associated with the creation of that condition variable.
1033   const DeclStmt *getConditionVariableDeclStmt() const {
1034     return reinterpret_cast<DeclStmt*>(SubExprs[VAR]);
1035   }
1036
1037   Expr *getCond() { return reinterpret_cast<Expr*>(SubExprs[COND]); }
1038   const Expr *getCond() const { return reinterpret_cast<Expr*>(SubExprs[COND]);}
1039   void setCond(Expr *E) { SubExprs[COND] = reinterpret_cast<Stmt*>(E); }
1040   Stmt *getBody() { return SubExprs[BODY]; }
1041   const Stmt *getBody() const { return SubExprs[BODY]; }
1042   void setBody(Stmt *S) { SubExprs[BODY] = S; }
1043
1044   SourceLocation getWhileLoc() const { return WhileLoc; }
1045   void setWhileLoc(SourceLocation L) { WhileLoc = L; }
1046
1047   SourceRange getSourceRange() const LLVM_READONLY {
1048     return SourceRange(WhileLoc, SubExprs[BODY]->getLocEnd());
1049   }
1050   static bool classof(const Stmt *T) {
1051     return T->getStmtClass() == WhileStmtClass;
1052   }
1053   static bool classof(const WhileStmt *) { return true; }
1054
1055   // Iterators
1056   child_range children() {
1057     return child_range(&SubExprs[0], &SubExprs[0]+END_EXPR);
1058   }
1059 };
1060
1061 /// DoStmt - This represents a 'do/while' stmt.
1062 ///
1063 class DoStmt : public Stmt {
1064   enum { BODY, COND, END_EXPR };
1065   Stmt* SubExprs[END_EXPR];
1066   SourceLocation DoLoc;
1067   SourceLocation WhileLoc;
1068   SourceLocation RParenLoc;  // Location of final ')' in do stmt condition.
1069
1070 public:
1071   DoStmt(Stmt *body, Expr *cond, SourceLocation DL, SourceLocation WL,
1072          SourceLocation RP)
1073     : Stmt(DoStmtClass), DoLoc(DL), WhileLoc(WL), RParenLoc(RP) {
1074     SubExprs[COND] = reinterpret_cast<Stmt*>(cond);
1075     SubExprs[BODY] = body;
1076   }
1077
1078   /// \brief Build an empty do-while statement.
1079   explicit DoStmt(EmptyShell Empty) : Stmt(DoStmtClass, Empty) { }
1080
1081   Expr *getCond() { return reinterpret_cast<Expr*>(SubExprs[COND]); }
1082   const Expr *getCond() const { return reinterpret_cast<Expr*>(SubExprs[COND]);}
1083   void setCond(Expr *E) { SubExprs[COND] = reinterpret_cast<Stmt*>(E); }
1084   Stmt *getBody() { return SubExprs[BODY]; }
1085   const Stmt *getBody() const { return SubExprs[BODY]; }
1086   void setBody(Stmt *S) { SubExprs[BODY] = S; }
1087
1088   SourceLocation getDoLoc() const { return DoLoc; }
1089   void setDoLoc(SourceLocation L) { DoLoc = L; }
1090   SourceLocation getWhileLoc() const { return WhileLoc; }
1091   void setWhileLoc(SourceLocation L) { WhileLoc = L; }
1092
1093   SourceLocation getRParenLoc() const { return RParenLoc; }
1094   void setRParenLoc(SourceLocation L) { RParenLoc = L; }
1095
1096   SourceRange getSourceRange() const LLVM_READONLY {
1097     return SourceRange(DoLoc, RParenLoc);
1098   }
1099   static bool classof(const Stmt *T) {
1100     return T->getStmtClass() == DoStmtClass;
1101   }
1102   static bool classof(const DoStmt *) { return true; }
1103
1104   // Iterators
1105   child_range children() {
1106     return child_range(&SubExprs[0], &SubExprs[0]+END_EXPR);
1107   }
1108 };
1109
1110
1111 /// ForStmt - This represents a 'for (init;cond;inc)' stmt.  Note that any of
1112 /// the init/cond/inc parts of the ForStmt will be null if they were not
1113 /// specified in the source.
1114 ///
1115 class ForStmt : public Stmt {
1116   enum { INIT, CONDVAR, COND, INC, BODY, END_EXPR };
1117   Stmt* SubExprs[END_EXPR]; // SubExprs[INIT] is an expression or declstmt.
1118   SourceLocation ForLoc;
1119   SourceLocation LParenLoc, RParenLoc;
1120
1121 public:
1122   ForStmt(ASTContext &C, Stmt *Init, Expr *Cond, VarDecl *condVar, Expr *Inc,
1123           Stmt *Body, SourceLocation FL, SourceLocation LP, SourceLocation RP);
1124
1125   /// \brief Build an empty for statement.
1126   explicit ForStmt(EmptyShell Empty) : Stmt(ForStmtClass, Empty) { }
1127
1128   Stmt *getInit() { return SubExprs[INIT]; }
1129
1130   /// \brief Retrieve the variable declared in this "for" statement, if any.
1131   ///
1132   /// In the following example, "y" is the condition variable.
1133   /// \code
1134   /// for (int x = random(); int y = mangle(x); ++x) {
1135   ///   // ...
1136   /// }
1137   /// \endcode
1138   VarDecl *getConditionVariable() const;
1139   void setConditionVariable(ASTContext &C, VarDecl *V);
1140
1141   /// If this ForStmt has a condition variable, return the faux DeclStmt
1142   /// associated with the creation of that condition variable.
1143   const DeclStmt *getConditionVariableDeclStmt() const {
1144     return reinterpret_cast<DeclStmt*>(SubExprs[CONDVAR]);
1145   }
1146
1147   Expr *getCond() { return reinterpret_cast<Expr*>(SubExprs[COND]); }
1148   Expr *getInc()  { return reinterpret_cast<Expr*>(SubExprs[INC]); }
1149   Stmt *getBody() { return SubExprs[BODY]; }
1150
1151   const Stmt *getInit() const { return SubExprs[INIT]; }
1152   const Expr *getCond() const { return reinterpret_cast<Expr*>(SubExprs[COND]);}
1153   const Expr *getInc()  const { return reinterpret_cast<Expr*>(SubExprs[INC]); }
1154   const Stmt *getBody() const { return SubExprs[BODY]; }
1155
1156   void setInit(Stmt *S) { SubExprs[INIT] = S; }
1157   void setCond(Expr *E) { SubExprs[COND] = reinterpret_cast<Stmt*>(E); }
1158   void setInc(Expr *E) { SubExprs[INC] = reinterpret_cast<Stmt*>(E); }
1159   void setBody(Stmt *S) { SubExprs[BODY] = S; }
1160
1161   SourceLocation getForLoc() const { return ForLoc; }
1162   void setForLoc(SourceLocation L) { ForLoc = L; }
1163   SourceLocation getLParenLoc() const { return LParenLoc; }
1164   void setLParenLoc(SourceLocation L) { LParenLoc = L; }
1165   SourceLocation getRParenLoc() const { return RParenLoc; }
1166   void setRParenLoc(SourceLocation L) { RParenLoc = L; }
1167
1168   SourceRange getSourceRange() const LLVM_READONLY {
1169     return SourceRange(ForLoc, SubExprs[BODY]->getLocEnd());
1170   }
1171   static bool classof(const Stmt *T) {
1172     return T->getStmtClass() == ForStmtClass;
1173   }
1174   static bool classof(const ForStmt *) { return true; }
1175
1176   // Iterators
1177   child_range children() {
1178     return child_range(&SubExprs[0], &SubExprs[0]+END_EXPR);
1179   }
1180 };
1181
1182 /// GotoStmt - This represents a direct goto.
1183 ///
1184 class GotoStmt : public Stmt {
1185   LabelDecl *Label;
1186   SourceLocation GotoLoc;
1187   SourceLocation LabelLoc;
1188 public:
1189   GotoStmt(LabelDecl *label, SourceLocation GL, SourceLocation LL)
1190     : Stmt(GotoStmtClass), Label(label), GotoLoc(GL), LabelLoc(LL) {}
1191
1192   /// \brief Build an empty goto statement.
1193   explicit GotoStmt(EmptyShell Empty) : Stmt(GotoStmtClass, Empty) { }
1194
1195   LabelDecl *getLabel() const { return Label; }
1196   void setLabel(LabelDecl *D) { Label = D; }
1197
1198   SourceLocation getGotoLoc() const { return GotoLoc; }
1199   void setGotoLoc(SourceLocation L) { GotoLoc = L; }
1200   SourceLocation getLabelLoc() const { return LabelLoc; }
1201   void setLabelLoc(SourceLocation L) { LabelLoc = L; }
1202
1203   SourceRange getSourceRange() const LLVM_READONLY {
1204     return SourceRange(GotoLoc, LabelLoc);
1205   }
1206   static bool classof(const Stmt *T) {
1207     return T->getStmtClass() == GotoStmtClass;
1208   }
1209   static bool classof(const GotoStmt *) { return true; }
1210
1211   // Iterators
1212   child_range children() { return child_range(); }
1213 };
1214
1215 /// IndirectGotoStmt - This represents an indirect goto.
1216 ///
1217 class IndirectGotoStmt : public Stmt {
1218   SourceLocation GotoLoc;
1219   SourceLocation StarLoc;
1220   Stmt *Target;
1221 public:
1222   IndirectGotoStmt(SourceLocation gotoLoc, SourceLocation starLoc,
1223                    Expr *target)
1224     : Stmt(IndirectGotoStmtClass), GotoLoc(gotoLoc), StarLoc(starLoc),
1225       Target((Stmt*)target) {}
1226
1227   /// \brief Build an empty indirect goto statement.
1228   explicit IndirectGotoStmt(EmptyShell Empty)
1229     : Stmt(IndirectGotoStmtClass, Empty) { }
1230
1231   void setGotoLoc(SourceLocation L) { GotoLoc = L; }
1232   SourceLocation getGotoLoc() const { return GotoLoc; }
1233   void setStarLoc(SourceLocation L) { StarLoc = L; }
1234   SourceLocation getStarLoc() const { return StarLoc; }
1235
1236   Expr *getTarget() { return reinterpret_cast<Expr*>(Target); }
1237   const Expr *getTarget() const {return reinterpret_cast<const Expr*>(Target);}
1238   void setTarget(Expr *E) { Target = reinterpret_cast<Stmt*>(E); }
1239
1240   /// getConstantTarget - Returns the fixed target of this indirect
1241   /// goto, if one exists.
1242   LabelDecl *getConstantTarget();
1243   const LabelDecl *getConstantTarget() const {
1244     return const_cast<IndirectGotoStmt*>(this)->getConstantTarget();
1245   }
1246
1247   SourceRange getSourceRange() const LLVM_READONLY {
1248     return SourceRange(GotoLoc, Target->getLocEnd());
1249   }
1250
1251   static bool classof(const Stmt *T) {
1252     return T->getStmtClass() == IndirectGotoStmtClass;
1253   }
1254   static bool classof(const IndirectGotoStmt *) { return true; }
1255
1256   // Iterators
1257   child_range children() { return child_range(&Target, &Target+1); }
1258 };
1259
1260
1261 /// ContinueStmt - This represents a continue.
1262 ///
1263 class ContinueStmt : public Stmt {
1264   SourceLocation ContinueLoc;
1265 public:
1266   ContinueStmt(SourceLocation CL) : Stmt(ContinueStmtClass), ContinueLoc(CL) {}
1267
1268   /// \brief Build an empty continue statement.
1269   explicit ContinueStmt(EmptyShell Empty) : Stmt(ContinueStmtClass, Empty) { }
1270
1271   SourceLocation getContinueLoc() const { return ContinueLoc; }
1272   void setContinueLoc(SourceLocation L) { ContinueLoc = L; }
1273
1274   SourceRange getSourceRange() const LLVM_READONLY {
1275     return SourceRange(ContinueLoc);
1276   }
1277
1278   static bool classof(const Stmt *T) {
1279     return T->getStmtClass() == ContinueStmtClass;
1280   }
1281   static bool classof(const ContinueStmt *) { return true; }
1282
1283   // Iterators
1284   child_range children() { return child_range(); }
1285 };
1286
1287 /// BreakStmt - This represents a break.
1288 ///
1289 class BreakStmt : public Stmt {
1290   SourceLocation BreakLoc;
1291 public:
1292   BreakStmt(SourceLocation BL) : Stmt(BreakStmtClass), BreakLoc(BL) {}
1293
1294   /// \brief Build an empty break statement.
1295   explicit BreakStmt(EmptyShell Empty) : Stmt(BreakStmtClass, Empty) { }
1296
1297   SourceLocation getBreakLoc() const { return BreakLoc; }
1298   void setBreakLoc(SourceLocation L) { BreakLoc = L; }
1299
1300   SourceRange getSourceRange() const LLVM_READONLY { return SourceRange(BreakLoc); }
1301
1302   static bool classof(const Stmt *T) {
1303     return T->getStmtClass() == BreakStmtClass;
1304   }
1305   static bool classof(const BreakStmt *) { return true; }
1306
1307   // Iterators
1308   child_range children() { return child_range(); }
1309 };
1310
1311
1312 /// ReturnStmt - This represents a return, optionally of an expression:
1313 ///   return;
1314 ///   return 4;
1315 ///
1316 /// Note that GCC allows return with no argument in a function declared to
1317 /// return a value, and it allows returning a value in functions declared to
1318 /// return void.  We explicitly model this in the AST, which means you can't
1319 /// depend on the return type of the function and the presence of an argument.
1320 ///
1321 class ReturnStmt : public Stmt {
1322   Stmt *RetExpr;
1323   SourceLocation RetLoc;
1324   const VarDecl *NRVOCandidate;
1325
1326 public:
1327   ReturnStmt(SourceLocation RL)
1328     : Stmt(ReturnStmtClass), RetExpr(0), RetLoc(RL), NRVOCandidate(0) { }
1329
1330   ReturnStmt(SourceLocation RL, Expr *E, const VarDecl *NRVOCandidate)
1331     : Stmt(ReturnStmtClass), RetExpr((Stmt*) E), RetLoc(RL),
1332       NRVOCandidate(NRVOCandidate) {}
1333
1334   /// \brief Build an empty return expression.
1335   explicit ReturnStmt(EmptyShell Empty) : Stmt(ReturnStmtClass, Empty) { }
1336
1337   const Expr *getRetValue() const;
1338   Expr *getRetValue();
1339   void setRetValue(Expr *E) { RetExpr = reinterpret_cast<Stmt*>(E); }
1340
1341   SourceLocation getReturnLoc() const { return RetLoc; }
1342   void setReturnLoc(SourceLocation L) { RetLoc = L; }
1343
1344   /// \brief Retrieve the variable that might be used for the named return
1345   /// value optimization.
1346   ///
1347   /// The optimization itself can only be performed if the variable is
1348   /// also marked as an NRVO object.
1349   const VarDecl *getNRVOCandidate() const { return NRVOCandidate; }
1350   void setNRVOCandidate(const VarDecl *Var) { NRVOCandidate = Var; }
1351
1352   SourceRange getSourceRange() const LLVM_READONLY;
1353
1354   static bool classof(const Stmt *T) {
1355     return T->getStmtClass() == ReturnStmtClass;
1356   }
1357   static bool classof(const ReturnStmt *) { return true; }
1358
1359   // Iterators
1360   child_range children() {
1361     if (RetExpr) return child_range(&RetExpr, &RetExpr+1);
1362     return child_range();
1363   }
1364 };
1365
1366 /// AsmStmt - This represents a GNU inline-assembly statement extension.
1367 ///
1368 class AsmStmt : public Stmt {
1369   SourceLocation AsmLoc, RParenLoc;
1370   StringLiteral *AsmStr;
1371
1372   bool IsSimple;
1373   bool IsVolatile;
1374   bool MSAsm;
1375
1376   unsigned NumOutputs;
1377   unsigned NumInputs;
1378   unsigned NumClobbers;
1379
1380   // FIXME: If we wanted to, we could allocate all of these in one big array.
1381   IdentifierInfo **Names;
1382   StringLiteral **Constraints;
1383   Stmt **Exprs;
1384   StringLiteral **Clobbers;
1385
1386 public:
1387   AsmStmt(ASTContext &C, SourceLocation asmloc, bool issimple, bool isvolatile,
1388           bool msasm, unsigned numoutputs, unsigned numinputs,
1389           IdentifierInfo **names, StringLiteral **constraints,
1390           Expr **exprs, StringLiteral *asmstr, unsigned numclobbers,
1391           StringLiteral **clobbers, SourceLocation rparenloc);
1392
1393   /// \brief Build an empty inline-assembly statement.
1394   explicit AsmStmt(EmptyShell Empty) : Stmt(AsmStmtClass, Empty),
1395     Names(0), Constraints(0), Exprs(0), Clobbers(0) { }
1396
1397   SourceLocation getAsmLoc() const { return AsmLoc; }
1398   void setAsmLoc(SourceLocation L) { AsmLoc = L; }
1399   SourceLocation getRParenLoc() const { return RParenLoc; }
1400   void setRParenLoc(SourceLocation L) { RParenLoc = L; }
1401
1402   bool isVolatile() const { return IsVolatile; }
1403   void setVolatile(bool V) { IsVolatile = V; }
1404   bool isSimple() const { return IsSimple; }
1405   void setSimple(bool V) { IsSimple = V; }
1406   bool isMSAsm() const { return MSAsm; }
1407   void setMSAsm(bool V) { MSAsm = V; }
1408
1409   //===--- Asm String Analysis ---===//
1410
1411   const StringLiteral *getAsmString() const { return AsmStr; }
1412   StringLiteral *getAsmString() { return AsmStr; }
1413   void setAsmString(StringLiteral *E) { AsmStr = E; }
1414
1415   /// AsmStringPiece - this is part of a decomposed asm string specification
1416   /// (for use with the AnalyzeAsmString function below).  An asm string is
1417   /// considered to be a concatenation of these parts.
1418   class AsmStringPiece {
1419   public:
1420     enum Kind {
1421       String,  // String in .ll asm string form, "$" -> "$$" and "%%" -> "%".
1422       Operand  // Operand reference, with optional modifier %c4.
1423     };
1424   private:
1425     Kind MyKind;
1426     std::string Str;
1427     unsigned OperandNo;
1428   public:
1429     AsmStringPiece(const std::string &S) : MyKind(String), Str(S) {}
1430     AsmStringPiece(unsigned OpNo, char Modifier)
1431       : MyKind(Operand), Str(), OperandNo(OpNo) {
1432       Str += Modifier;
1433     }
1434
1435     bool isString() const { return MyKind == String; }
1436     bool isOperand() const { return MyKind == Operand; }
1437
1438     const std::string &getString() const {
1439       assert(isString());
1440       return Str;
1441     }
1442
1443     unsigned getOperandNo() const {
1444       assert(isOperand());
1445       return OperandNo;
1446     }
1447
1448     /// getModifier - Get the modifier for this operand, if present.  This
1449     /// returns '\0' if there was no modifier.
1450     char getModifier() const {
1451       assert(isOperand());
1452       return Str[0];
1453     }
1454   };
1455
1456   /// AnalyzeAsmString - Analyze the asm string of the current asm, decomposing
1457   /// it into pieces.  If the asm string is erroneous, emit errors and return
1458   /// true, otherwise return false.  This handles canonicalization and
1459   /// translation of strings from GCC syntax to LLVM IR syntax, and handles
1460   //// flattening of named references like %[foo] to Operand AsmStringPiece's.
1461   unsigned AnalyzeAsmString(SmallVectorImpl<AsmStringPiece> &Pieces,
1462                             ASTContext &C, unsigned &DiagOffs) const;
1463
1464
1465   //===--- Output operands ---===//
1466
1467   unsigned getNumOutputs() const { return NumOutputs; }
1468
1469   IdentifierInfo *getOutputIdentifier(unsigned i) const {
1470     return Names[i];
1471   }
1472
1473   StringRef getOutputName(unsigned i) const {
1474     if (IdentifierInfo *II = getOutputIdentifier(i))
1475       return II->getName();
1476
1477     return StringRef();
1478   }
1479
1480   /// getOutputConstraint - Return the constraint string for the specified
1481   /// output operand.  All output constraints are known to be non-empty (either
1482   /// '=' or '+').
1483   StringRef getOutputConstraint(unsigned i) const;
1484
1485   const StringLiteral *getOutputConstraintLiteral(unsigned i) const {
1486     return Constraints[i];
1487   }
1488   StringLiteral *getOutputConstraintLiteral(unsigned i) {
1489     return Constraints[i];
1490   }
1491
1492   Expr *getOutputExpr(unsigned i);
1493
1494   const Expr *getOutputExpr(unsigned i) const {
1495     return const_cast<AsmStmt*>(this)->getOutputExpr(i);
1496   }
1497
1498   /// isOutputPlusConstraint - Return true if the specified output constraint
1499   /// is a "+" constraint (which is both an input and an output) or false if it
1500   /// is an "=" constraint (just an output).
1501   bool isOutputPlusConstraint(unsigned i) const {
1502     return getOutputConstraint(i)[0] == '+';
1503   }
1504
1505   /// getNumPlusOperands - Return the number of output operands that have a "+"
1506   /// constraint.
1507   unsigned getNumPlusOperands() const;
1508
1509   //===--- Input operands ---===//
1510
1511   unsigned getNumInputs() const { return NumInputs; }
1512
1513   IdentifierInfo *getInputIdentifier(unsigned i) const {
1514     return Names[i + NumOutputs];
1515   }
1516
1517   StringRef getInputName(unsigned i) const {
1518     if (IdentifierInfo *II = getInputIdentifier(i))
1519       return II->getName();
1520
1521     return StringRef();
1522   }
1523
1524   /// getInputConstraint - Return the specified input constraint.  Unlike output
1525   /// constraints, these can be empty.
1526   StringRef getInputConstraint(unsigned i) const;
1527
1528   const StringLiteral *getInputConstraintLiteral(unsigned i) const {
1529     return Constraints[i + NumOutputs];
1530   }
1531   StringLiteral *getInputConstraintLiteral(unsigned i) {
1532     return Constraints[i + NumOutputs];
1533   }
1534
1535   Expr *getInputExpr(unsigned i);
1536   void setInputExpr(unsigned i, Expr *E);
1537
1538   const Expr *getInputExpr(unsigned i) const {
1539     return const_cast<AsmStmt*>(this)->getInputExpr(i);
1540   }
1541
1542   void setOutputsAndInputsAndClobbers(ASTContext &C,
1543                                       IdentifierInfo **Names,
1544                                       StringLiteral **Constraints,
1545                                       Stmt **Exprs,
1546                                       unsigned NumOutputs,
1547                                       unsigned NumInputs,
1548                                       StringLiteral **Clobbers,
1549                                       unsigned NumClobbers);
1550
1551   //===--- Other ---===//
1552
1553   /// getNamedOperand - Given a symbolic operand reference like %[foo],
1554   /// translate this into a numeric value needed to reference the same operand.
1555   /// This returns -1 if the operand name is invalid.
1556   int getNamedOperand(StringRef SymbolicName) const;
1557
1558   unsigned getNumClobbers() const { return NumClobbers; }
1559   StringLiteral *getClobber(unsigned i) { return Clobbers[i]; }
1560   const StringLiteral *getClobber(unsigned i) const { return Clobbers[i]; }
1561
1562   SourceRange getSourceRange() const LLVM_READONLY {
1563     return SourceRange(AsmLoc, RParenLoc);
1564   }
1565
1566   static bool classof(const Stmt *T) {return T->getStmtClass() == AsmStmtClass;}
1567   static bool classof(const AsmStmt *) { return true; }
1568
1569   // Input expr iterators.
1570
1571   typedef ExprIterator inputs_iterator;
1572   typedef ConstExprIterator const_inputs_iterator;
1573
1574   inputs_iterator begin_inputs() {
1575     return &Exprs[0] + NumOutputs;
1576   }
1577
1578   inputs_iterator end_inputs() {
1579     return &Exprs[0] + NumOutputs + NumInputs;
1580   }
1581
1582   const_inputs_iterator begin_inputs() const {
1583     return &Exprs[0] + NumOutputs;
1584   }
1585
1586   const_inputs_iterator end_inputs() const {
1587     return &Exprs[0] + NumOutputs + NumInputs;
1588   }
1589
1590   // Output expr iterators.
1591
1592   typedef ExprIterator outputs_iterator;
1593   typedef ConstExprIterator const_outputs_iterator;
1594
1595   outputs_iterator begin_outputs() {
1596     return &Exprs[0];
1597   }
1598   outputs_iterator end_outputs() {
1599     return &Exprs[0] + NumOutputs;
1600   }
1601
1602   const_outputs_iterator begin_outputs() const {
1603     return &Exprs[0];
1604   }
1605   const_outputs_iterator end_outputs() const {
1606     return &Exprs[0] + NumOutputs;
1607   }
1608
1609   child_range children() {
1610     return child_range(&Exprs[0], &Exprs[0] + NumOutputs + NumInputs);
1611   }
1612 };
1613
1614 /// MSAsmStmt - This represents a MS inline-assembly statement extension.
1615 ///
1616 class MSAsmStmt : public Stmt {
1617   SourceLocation AsmLoc, LBraceLoc, EndLoc;
1618   std::string AsmStr;
1619
1620   bool IsSimple;
1621   bool IsVolatile;
1622
1623   unsigned NumAsmToks;
1624   unsigned NumInputs;
1625   unsigned NumOutputs;
1626   unsigned NumClobbers;
1627
1628   Token *AsmToks;
1629   IdentifierInfo **Names;
1630   Stmt **Exprs;
1631   StringRef *Clobbers;
1632
1633 public:
1634   MSAsmStmt(ASTContext &C, SourceLocation asmloc, SourceLocation lbraceloc,
1635             bool issimple, bool isvolatile, ArrayRef<Token> asmtoks,
1636             ArrayRef<IdentifierInfo*> inputs, ArrayRef<IdentifierInfo*> outputs,
1637             StringRef asmstr, ArrayRef<StringRef> clobbers,
1638             SourceLocation endloc);
1639
1640   SourceLocation getAsmLoc() const { return AsmLoc; }
1641   void setAsmLoc(SourceLocation L) { AsmLoc = L; }
1642   SourceLocation getLBraceLoc() const { return LBraceLoc; }
1643   void setLBraceLoc(SourceLocation L) { LBraceLoc = L; }
1644   SourceLocation getEndLoc() const { return EndLoc; }
1645   void setEndLoc(SourceLocation L) { EndLoc = L; }
1646
1647   bool hasBraces() const { return LBraceLoc.isValid(); }
1648
1649   unsigned getNumAsmToks() { return NumAsmToks; }
1650   Token *getAsmToks() { return AsmToks; }
1651
1652   bool isVolatile() const { return IsVolatile; }
1653   void setVolatile(bool V) { IsVolatile = V; }
1654   bool isSimple() const { return IsSimple; }
1655   void setSimple(bool V) { IsSimple = V; }
1656
1657   //===--- Asm String Analysis ---===//
1658
1659   const std::string *getAsmString() const { return &AsmStr; }
1660   std::string *getAsmString() { return &AsmStr; }
1661   void setAsmString(StringRef &E) { AsmStr = E.str(); }
1662
1663   //===--- Other ---===//
1664
1665   unsigned getNumClobbers() const { return NumClobbers; }
1666   StringRef getClobber(unsigned i) const { return Clobbers[i]; }
1667
1668   SourceRange getSourceRange() const LLVM_READONLY {
1669     return SourceRange(AsmLoc, EndLoc);
1670   }
1671   static bool classof(const Stmt *T) {
1672     return T->getStmtClass() == MSAsmStmtClass;
1673   }
1674   static bool classof(const MSAsmStmt *) { return true; }
1675
1676   child_range children() {
1677     return child_range(&Exprs[0], &Exprs[0]);
1678   }
1679 };
1680
1681 class SEHExceptStmt : public Stmt {
1682   SourceLocation  Loc;
1683   Stmt           *Children[2];
1684
1685   enum { FILTER_EXPR, BLOCK };
1686
1687   SEHExceptStmt(SourceLocation Loc,
1688                 Expr *FilterExpr,
1689                 Stmt *Block);
1690
1691   friend class ASTReader;
1692   friend class ASTStmtReader;
1693   explicit SEHExceptStmt(EmptyShell E) : Stmt(SEHExceptStmtClass, E) { }
1694
1695 public:
1696   static SEHExceptStmt* Create(ASTContext &C,
1697                                SourceLocation ExceptLoc,
1698                                Expr *FilterExpr,
1699                                Stmt *Block);
1700   SourceRange getSourceRange() const LLVM_READONLY {
1701     return SourceRange(getExceptLoc(), getEndLoc());
1702   }
1703
1704   SourceLocation getExceptLoc() const { return Loc; }
1705   SourceLocation getEndLoc() const { return getBlock()->getLocEnd(); }
1706
1707   Expr *getFilterExpr() const {
1708     return reinterpret_cast<Expr*>(Children[FILTER_EXPR]);
1709   }
1710
1711   CompoundStmt *getBlock() const {
1712     return llvm::cast<CompoundStmt>(Children[BLOCK]);
1713   }
1714
1715   child_range children() {
1716     return child_range(Children,Children+2);
1717   }
1718
1719   static bool classof(const Stmt *T) {
1720     return T->getStmtClass() == SEHExceptStmtClass;
1721   }
1722
1723   static bool classof(SEHExceptStmt *) { return true; }
1724
1725 };
1726
1727 class SEHFinallyStmt : public Stmt {
1728   SourceLocation  Loc;
1729   Stmt           *Block;
1730
1731   SEHFinallyStmt(SourceLocation Loc,
1732                  Stmt *Block);
1733
1734   friend class ASTReader;
1735   friend class ASTStmtReader;
1736   explicit SEHFinallyStmt(EmptyShell E) : Stmt(SEHFinallyStmtClass, E) { }
1737
1738 public:
1739   static SEHFinallyStmt* Create(ASTContext &C,
1740                                 SourceLocation FinallyLoc,
1741                                 Stmt *Block);
1742
1743   SourceRange getSourceRange() const LLVM_READONLY {
1744     return SourceRange(getFinallyLoc(), getEndLoc());
1745   }
1746
1747   SourceLocation getFinallyLoc() const { return Loc; }
1748   SourceLocation getEndLoc() const { return Block->getLocEnd(); }
1749
1750   CompoundStmt *getBlock() const { return llvm::cast<CompoundStmt>(Block); }
1751
1752   child_range children() {
1753     return child_range(&Block,&Block+1);
1754   }
1755
1756   static bool classof(const Stmt *T) {
1757     return T->getStmtClass() == SEHFinallyStmtClass;
1758   }
1759
1760   static bool classof(SEHFinallyStmt *) { return true; }
1761
1762 };
1763
1764 class SEHTryStmt : public Stmt {
1765   bool            IsCXXTry;
1766   SourceLocation  TryLoc;
1767   Stmt           *Children[2];
1768
1769   enum { TRY = 0, HANDLER = 1 };
1770
1771   SEHTryStmt(bool isCXXTry, // true if 'try' otherwise '__try'
1772              SourceLocation TryLoc,
1773              Stmt *TryBlock,
1774              Stmt *Handler);
1775
1776   friend class ASTReader;
1777   friend class ASTStmtReader;
1778   explicit SEHTryStmt(EmptyShell E) : Stmt(SEHTryStmtClass, E) { }
1779
1780 public:
1781   static SEHTryStmt* Create(ASTContext &C,
1782                             bool isCXXTry,
1783                             SourceLocation TryLoc,
1784                             Stmt *TryBlock,
1785                             Stmt *Handler);
1786
1787   SourceRange getSourceRange() const LLVM_READONLY {
1788     return SourceRange(getTryLoc(), getEndLoc());
1789   }
1790
1791   SourceLocation getTryLoc() const { return TryLoc; }
1792   SourceLocation getEndLoc() const { return Children[HANDLER]->getLocEnd(); }
1793
1794   bool getIsCXXTry() const { return IsCXXTry; }
1795
1796   CompoundStmt* getTryBlock() const {
1797     return llvm::cast<CompoundStmt>(Children[TRY]);
1798   }
1799
1800   Stmt *getHandler() const { return Children[HANDLER]; }
1801
1802   /// Returns 0 if not defined
1803   SEHExceptStmt  *getExceptHandler() const;
1804   SEHFinallyStmt *getFinallyHandler() const;
1805
1806   child_range children() {
1807     return child_range(Children,Children+2);
1808   }
1809
1810   static bool classof(const Stmt *T) {
1811     return T->getStmtClass() == SEHTryStmtClass;
1812   }
1813
1814   static bool classof(SEHTryStmt *) { return true; }
1815 };
1816
1817 }  // end namespace clang
1818
1819 #endif