 |
|
 |
|
| Files: |
1 |
|
Branches Taken: |
31.2% |
20 / 64 |
| Generated: |
2010-02-10 01:31 |
|
Branches Executed: |
100.0% |
64 / 64 |
| |
|
Line Coverage: |
60.0% |
3 / 5 |
| |
 |
|
 |
1 : //===--- TypeVisitor.h - Visitor for Stmt subclasses ------------*- 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 TypeVisitor interface.
11 : //
12 : //===----------------------------------------------------------------------===//
13 :
14 : #ifndef LLVM_CLANG_AST_TYPEVISITOR_H
15 : #define LLVM_CLANG_AST_TYPEVISITOR_H
16 :
17 : #include "clang/AST/Type.h"
18 :
19 : namespace clang {
20 :
21 : #define DISPATCH(CLASS) \
22 : return static_cast<ImplClass*>(this)->Visit ## CLASS(static_cast<CLASS*>(T))
23 :
24 : template<typename ImplClass, typename RetTy=void>
25 126: class TypeVisitor {
26 : public:
27 118: RetTy Visit(Type *T) {
28 : // Top switch stmt: dispatch to VisitFooStmt for each FooStmt.
0: branch 1 not taken
15: branch 2 taken
1: branch 3 taken
17: branch 4 taken
0: branch 5 not taken
1: branch 6 taken
0: branch 7 not taken
0: branch 8 not taken
6: branch 9 taken
0: branch 10 not taken
0: branch 11 not taken
0: branch 12 not taken
0: branch 13 not taken
0: branch 14 not taken
2: branch 15 taken
9: branch 16 taken
2: branch 17 taken
0: branch 18 not taken
5: branch 19 taken
0: branch 20 not taken
0: branch 21 not taken
0: branch 22 not taken
6: branch 23 taken
0: branch 24 not taken
0: branch 25 not taken
0: branch 26 not taken
0: branch 27 not taken
0: branch 28 not taken
0: branch 29 not taken
0: branch 30 not taken
0: branch 31 not taken
0: branch 32 not taken
0: branch 34 not taken
10: branch 35 taken
1: branch 36 taken
12: branch 37 taken
0: branch 38 not taken
1: branch 39 taken
0: branch 40 not taken
0: branch 41 not taken
6: branch 42 taken
0: branch 43 not taken
0: branch 44 not taken
0: branch 45 not taken
0: branch 46 not taken
0: branch 47 not taken
2: branch 48 taken
9: branch 49 taken
2: branch 50 taken
0: branch 51 not taken
5: branch 52 taken
0: branch 53 not taken
0: branch 54 not taken
0: branch 55 not taken
6: branch 56 taken
0: branch 57 not taken
0: branch 58 not taken
0: branch 59 not taken
0: branch 60 not taken
0: branch 61 not taken
0: branch 62 not taken
0: branch 63 not taken
0: branch 64 not taken
0: branch 65 not taken
29 118: switch (T->getTypeClass()) {
30 0: default: assert(0 && "Unknown type class!");
31 : #define ABSTRACT_TYPE(CLASS, PARENT)
32 : #define TYPE(CLASS, PARENT) case Type::CLASS: DISPATCH(CLASS##Type);
33 : #include "clang/AST/TypeNodes.def"
34 : }
35 : }
36 :
37 : // If the implementation chooses not to implement a certain visit method, fall
38 : // back on superclass.
39 : #define TYPE(CLASS, PARENT) RetTy Visit##CLASS##Type(CLASS##Type *T) { \
40 : DISPATCH(PARENT); \
41 : }
42 : #include "clang/AST/TypeNodes.def"
43 :
44 : // Base case, ignore it. :)
45 0: RetTy VisitType(Type*) { return RetTy(); }
46 : };
47 :
48 : #undef DISPATCH
49 :
50 : } // end namespace clang
51 :
52 : #endif
Generated: 2010-02-10 01:31 by zcov