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