1 //===--- ASTMutationListener.h - AST Mutation Interface --------*- C++ -*-===//
3 // The LLVM Compiler Infrastructure
5 // This file is distributed under the University of Illinois Open Source
6 // License. See LICENSE.TXT for details.
8 //===----------------------------------------------------------------------===//
10 // This file defines the ASTMutationListener interface.
12 //===----------------------------------------------------------------------===//
13 #ifndef LLVM_CLANG_AST_ASTMUTATIONLISTENER_H
14 #define LLVM_CLANG_AST_ASTMUTATIONLISTENER_H
21 class ClassTemplateDecl;
22 class ClassTemplateSpecializationDecl;
24 class FunctionTemplateDecl;
25 class ObjCCategoryDecl;
26 class ObjCInterfaceDecl;
27 class ObjCContainerDecl;
28 class ObjCPropertyDecl;
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
33 class ASTMutationListener {
35 virtual ~ASTMutationListener();
37 /// \brief A new TagDecl definition was completed.
38 virtual void CompletedTagDefinition(const TagDecl *D) { }
40 /// \brief A new declaration with name has been added to a DeclContext.
41 virtual void AddedVisibleDecl(const DeclContext *DC, const Decl *D) {}
43 /// \brief An implicit member was added after the definition was completed.
44 virtual void AddedCXXImplicitMember(const CXXRecordDecl *RD, const Decl *D) {}
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) {}
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) {}
56 /// \brief An implicit member got a definition.
57 virtual void CompletedImplicitDefinition(const FunctionDecl *D) {}
59 /// \brief A static data member was implicitly instantiated.
60 virtual void StaticDataMemberInstantiated(const VarDecl *D) {}
62 /// \brief A new objc category class was added for an interface.
63 virtual void AddedObjCCategoryToInterface(const ObjCCategoryDecl *CatD,
64 const ObjCInterfaceDecl *IFD) {}
66 /// \brief A objc class extension redeclared or introduced a property.
68 /// \param Prop the property in the class extension
70 /// \param OrigProp the property from the original interface that was declared
71 /// or null if the property was introduced.
73 /// \param ClassExt the class extension.
74 virtual void AddedObjCPropertyInClassExtension(const ObjCPropertyDecl *Prop,
75 const ObjCPropertyDecl *OrigProp,
76 const ObjCCategoryDecl *ClassExt) {}
78 // NOTE: If new methods are added they should also be added to
79 // MultiplexASTMutationListener.
82 } // end namespace clang