 |
|
 |
|
| Files: |
1 |
|
Branches Taken: |
100.0% |
4 / 4 |
| Generated: |
2010-02-10 01:31 |
|
Branches Executed: |
50.0% |
2 / 4 |
| |
|
Line Coverage: |
100.0% |
7 / 7 |
| |
 |
|
 |
1 : //===--- ASTConsumer.h - Abstract interface for reading ASTs ----*- 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 ASTConsumer class.
11 : //
12 : //===----------------------------------------------------------------------===//
13 :
14 : #ifndef LLVM_CLANG_AST_ASTCONSUMER_H
15 : #define LLVM_CLANG_AST_ASTCONSUMER_H
16 :
17 : namespace clang {
18 : class ASTContext;
19 : class DeclGroupRef;
20 : class TagDecl;
21 : class HandleTagDeclDefinition;
22 : class SemaConsumer; // layering violation required for safe SemaConsumer
23 : class VarDecl;
24 :
25 : /// ASTConsumer - This is an abstract interface that should be implemented by
26 : /// clients that read ASTs. This abstraction layer allows the client to be
27 : /// independent of the AST producer (e.g. parser vs AST dump file reader, etc).
28 : class ASTConsumer {
29 : /// \brief Whether this AST consumer also requires information about
30 : /// semantic analysis.
31 : bool SemaConsumer;
32 :
33 : friend class SemaConsumer;
34 :
35 : public:
36 2863: ASTConsumer() : SemaConsumer(false) { }
37 :
1221: branch 0 taken
1504: branch 1 taken
1221: branch 3 taken
1221: branch 4 taken
38 2725: virtual ~ASTConsumer() {}
39 :
40 : /// Initialize - This is called to initialize the consumer, providing the
41 : /// ASTContext.
42 1368: virtual void Initialize(ASTContext &Context) {}
43 :
44 : /// HandleTopLevelDecl - Handle the specified top-level declaration. This is
45 : /// called by the parser to process every top-level Decl*. Note that D can be
46 : /// the head of a chain of Decls (e.g. for `int a, b` the chain will have two
47 : /// elements). Use Decl::getNextDeclarator() to walk the chain.
48 : virtual void HandleTopLevelDecl(DeclGroupRef D);
49 :
50 : /// HandleTranslationUnit - This method is called when the ASTs for entire
51 : /// translation unit have been parsed.
52 1299: virtual void HandleTranslationUnit(ASTContext &Ctx) {}
53 :
54 : /// HandleTagDeclDefinition - This callback is invoked each time a TagDecl
55 : /// (e.g. struct, union, enum, class) is completed. This allows the client to
56 : /// hack on the type, which can occur at any point in the file (because these
57 : /// can be defined in declspecs).
58 4979: virtual void HandleTagDeclDefinition(TagDecl *D) {}
59 :
60 : /// CompleteTentativeDefinition - Callback invoked at the end of a translation
61 : /// unit to notify the consumer that the given tentative definition should be
62 : /// completed.
63 : ///
64 : /// The variable declaration itself will be a tentative
65 : /// definition. If it had an incomplete array type, its type will
66 : /// have already been changed to an array of size 1. However, the
67 : /// declaration remains a tentative definition and has not been
68 : /// modified by the introduction of an implicit zero initializer.
69 512: virtual void CompleteTentativeDefinition(VarDecl *D) {}
70 :
71 : /// PrintStats - If desired, print any statistics.
72 2: virtual void PrintStats() {}
73 :
74 : // Support isa/cast/dyn_cast
75 : static bool classof(const ASTConsumer *) { return true; }
76 : };
77 :
78 : } // end namespace clang.
79 :
80 : #endif
Generated: 2010-02-10 01:31 by zcov