zcov: / include/clang/AST/StmtCXX.h


Files: 1 Branches Taken: 0.0% 0 / 8
Generated: 2010-02-10 01:31 Branches Executed: 0.0% 0 / 8
Line Coverage: 93.8% 30 / 32


Programs: 25 Runs 44665


       1                 : //===--- StmtCXX.h - Classes for representing C++ 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 C++ statement AST node classes.
      11                 : //
      12                 : //===----------------------------------------------------------------------===//
      13                 : 
      14                 : #ifndef LLVM_CLANG_AST_STMTCXX_H
      15                 : #define LLVM_CLANG_AST_STMTCXX_H
      16                 : 
      17                 : #include "clang/AST/Stmt.h"
      18                 : 
      19                 : namespace clang {
      20                 : 
      21                 : class VarDecl;
      22                 : 
      23                 : /// CXXCatchStmt - This represents a C++ catch block.
      24                 : ///
                        0: branch 1 not taken
                        0: branch 2 not taken
                        0: branch 5 not taken
                        0: branch 6 not taken
      25                0: class CXXCatchStmt : public Stmt {
      26                 :   SourceLocation CatchLoc;
      27                 :   /// The exception-declaration of the type.
      28                 :   VarDecl *ExceptionDecl;
      29                 :   /// The handler block.
      30                 :   Stmt *HandlerBlock;
      31                 : 
      32                 : protected:
      33                 :   virtual void DoDestroy(ASTContext& Ctx);
      34                 : 
      35                 : public:
      36               40:   CXXCatchStmt(SourceLocation catchLoc, VarDecl *exDecl, Stmt *handlerBlock)
      37                 :   : Stmt(CXXCatchStmtClass), CatchLoc(catchLoc), ExceptionDecl(exDecl),
      38               40:     HandlerBlock(handlerBlock) {}
      39                 : 
      40               55:   virtual SourceRange getSourceRange() const {
      41               55:     return SourceRange(CatchLoc, HandlerBlock->getLocEnd());
      42                 :   }
      43                 : 
      44                2:   SourceLocation getCatchLoc() const { return CatchLoc; }
      45               63:   VarDecl *getExceptionDecl() const { return ExceptionDecl; }
      46                 :   QualType getCaughtType() const;
      47               42:   Stmt *getHandlerBlock() const { return HandlerBlock; }
      48                 : 
      49               89:   static bool classof(const Stmt *T) {
      50               89:     return T->getStmtClass() == CXXCatchStmtClass;
      51                 :   }
      52                 :   static bool classof(const CXXCatchStmt *) { return true; }
      53                 : 
      54                 :   virtual child_iterator child_begin();
      55                 :   virtual child_iterator child_end();
      56                 : };
      57                 : 
      58                 : /// CXXTryStmt - A C++ try block, including all handlers.
      59                 : ///
                        0: branch 1 not taken
                        0: branch 2 not taken
                        0: branch 5 not taken
                        0: branch 6 not taken
      60                0: class CXXTryStmt : public Stmt {
      61                 :   SourceLocation TryLoc;
      62                 :   unsigned NumHandlers;
      63                 : 
      64                 :   CXXTryStmt(SourceLocation tryLoc, Stmt *tryBlock, Stmt **handlers,
      65                 :              unsigned numHandlers);
      66                 : 
      67                 : public:
      68                 :   static CXXTryStmt *Create(ASTContext &C, SourceLocation tryLoc,
      69                 :                             Stmt *tryBlock, Stmt **handlers,
      70                 :                             unsigned numHandlers);
      71                 : 
      72               25:   virtual SourceRange getSourceRange() const {
      73               25:     return SourceRange(getTryLoc(), getEndLoc());
      74                 :   }
      75                 : 
      76               27:   SourceLocation getTryLoc() const { return TryLoc; }
      77               25:   SourceLocation getEndLoc() const {
      78               25:     Stmt const * const*Stmts = reinterpret_cast<Stmt const * const*>(this + 1);
      79               25:     return Stmts[NumHandlers]->getLocEnd();
      80                 :   }
      81                 : 
      82               33:   CompoundStmt *getTryBlock() {
      83               33:     Stmt **Stmts = reinterpret_cast<Stmt **>(this + 1);
      84               33:     return llvm::cast<CompoundStmt>(Stmts[0]);
      85                 :   }
      86                1:   const CompoundStmt *getTryBlock() const {
      87                1:     Stmt const * const*Stmts = reinterpret_cast<Stmt const * const*>(this + 1);
      88                1:     return llvm::cast<CompoundStmt>(Stmts[0]);
      89                 :   }
      90                 : 
      91               40:   unsigned getNumHandlers() const { return NumHandlers; }
      92               47:   CXXCatchStmt *getHandler(unsigned i) {
      93               47:     Stmt **Stmts = reinterpret_cast<Stmt **>(this + 1);
      94               47:     return llvm::cast<CXXCatchStmt>(Stmts[i + 1]);
      95                 :   }
      96                2:   const CXXCatchStmt *getHandler(unsigned i) const {
      97                2:     Stmt const * const*Stmts = reinterpret_cast<Stmt const * const*>(this + 1);
      98                2:     return llvm::cast<CXXCatchStmt>(Stmts[i + 1]);
      99                 :   }
     100                 : 
     101             2519:   static bool classof(const Stmt *T) {
     102             2519:     return T->getStmtClass() == CXXTryStmtClass;
     103                 :   }
     104                 :   static bool classof(const CXXTryStmt *) { return true; }
     105                 : 
     106                 :   virtual child_iterator child_begin();
     107                 :   virtual child_iterator child_end();
     108                 : };
     109                 : 
     110                 : 
     111                 : }  // end namespace clang
     112                 : 
     113                 : #endif

Generated: 2010-02-10 01:31 by zcov