ASTMutationListener.h revision 1da95dbf2a341faec43439802b23a4f847baa6ad
1//===--- ASTMutationListener.h - AST Mutation Interface --------*- 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 ASTMutationListener interface.
11//
12//===----------------------------------------------------------------------===//
13#ifndef LLVM_CLANG_AST_ASTMUTATIONLISTENER_H
14#define LLVM_CLANG_AST_ASTMUTATIONLISTENER_H
15
16namespace clang {
17  class Decl;
18  class DeclContext;
19  class TagDecl;
20  class CXXRecordDecl;
21  class ClassTemplateDecl;
22  class ClassTemplateSpecializationDecl;
23  class FunctionDecl;
24  class FunctionTemplateDecl;
25  class ObjCCategoryDecl;
26  class ObjCInterfaceDecl;
27  class ObjCContainerDecl;
28  class ObjCPropertyDecl;
29
30/// \brief An abstract interface that should be implemented by listeners
31/// that want to be notified when an AST entity gets modified after its
32/// initial creation.
33class ASTMutationListener {
34public:
35  virtual ~ASTMutationListener();
36
37  /// \brief A new TagDecl definition was completed.
38  virtual void CompletedTagDefinition(const TagDecl *D) { }
39
40  /// \brief A new declaration with name has been added to a DeclContext.
41  virtual void AddedVisibleDecl(const DeclContext *DC, const Decl *D) {}
42
43  /// \brief An implicit member was added after the definition was completed.
44  virtual void AddedCXXImplicitMember(const CXXRecordDecl *RD, const Decl *D) {}
45
46  /// \brief A template specialization (or partial one) was added to the
47  /// template declaration.
48  virtual void AddedCXXTemplateSpecialization(const ClassTemplateDecl *TD,
49                                    const ClassTemplateSpecializationDecl *D) {}
50
51  /// \brief A template specialization (or partial one) was added to the
52  /// template declaration.
53  virtual void AddedCXXTemplateSpecialization(const FunctionTemplateDecl *TD,
54                                              const FunctionDecl *D) {}
55
56  /// \brief An implicit member got a definition.
57  virtual void CompletedImplicitDefinition(const FunctionDecl *D) {}
58
59  /// \brief A static data member was implicitly instantiated.
60  virtual void StaticDataMemberInstantiated(const VarDecl *D) {}
61
62  /// \brief A new objc category class was added for an interface.
63  virtual void AddedObjCCategoryToInterface(const ObjCCategoryDecl *CatD,
64                                            const ObjCInterfaceDecl *IFD) {}
65
66  /// \brief A objc class extension redeclared or introduced a property.
67  ///
68  /// \param Prop the property in the class extension
69  ///
70  /// \param OrigProp the property from the original interface that was declared
71  /// or null if the property was introduced.
72  ///
73  /// \param ClassExt the class extension.
74  virtual void AddedObjCPropertyInClassExtension(const ObjCPropertyDecl *Prop,
75                                            const ObjCPropertyDecl *OrigProp,
76                                            const ObjCCategoryDecl *ClassExt) {}
77
78  // NOTE: If new methods are added they should also be added to
79  // MultiplexASTMutationListener.
80};
81
82} // end namespace clang
83
84#endif
85