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
16 #include "clang/Basic/SourceLocation.h"
20 class ClassTemplateDecl;
21 class ClassTemplateSpecializationDecl;
25 class FunctionTemplateDecl;
26 class ObjCCategoryDecl;
27 class ObjCContainerDecl;
28 class ObjCInterfaceDecl;
29 class ObjCPropertyDecl;
33 /// \brief An abstract interface that should be implemented by listeners
34 /// that want to be notified when an AST entity gets modified after its
36 class ASTMutationListener {
38 virtual ~ASTMutationListener();
40 /// \brief A new TagDecl definition was completed.
41 virtual void CompletedTagDefinition(const TagDecl *D) { }
43 /// \brief A new declaration with name has been added to a DeclContext.
44 virtual void AddedVisibleDecl(const DeclContext *DC, const Decl *D) {}
46 /// \brief An implicit member was added after the definition was completed.
47 virtual void AddedCXXImplicitMember(const CXXRecordDecl *RD, const Decl *D) {}
49 /// \brief A template specialization (or partial one) was added to the
50 /// template declaration.
51 virtual void AddedCXXTemplateSpecialization(const ClassTemplateDecl *TD,
52 const ClassTemplateSpecializationDecl *D) {}
54 /// \brief A template specialization (or partial one) was added to the
55 /// template declaration.
56 virtual void AddedCXXTemplateSpecialization(const FunctionTemplateDecl *TD,
57 const FunctionDecl *D) {}
59 /// \brief An implicit member got a definition.
60 virtual void CompletedImplicitDefinition(const FunctionDecl *D) {}
62 /// \brief A static data member was implicitly instantiated.
63 virtual void StaticDataMemberInstantiated(const VarDecl *D) {}
65 /// \brief A new objc category class was added for an interface.
66 virtual void AddedObjCCategoryToInterface(const ObjCCategoryDecl *CatD,
67 const ObjCInterfaceDecl *IFD) {}
69 /// \brief A objc class extension redeclared or introduced a property.
71 /// \param Prop the property in the class extension
73 /// \param OrigProp the property from the original interface that was declared
74 /// or null if the property was introduced.
76 /// \param ClassExt the class extension.
77 virtual void AddedObjCPropertyInClassExtension(const ObjCPropertyDecl *Prop,
78 const ObjCPropertyDecl *OrigProp,
79 const ObjCCategoryDecl *ClassExt) {}
81 // NOTE: If new methods are added they should also be added to
82 // MultiplexASTMutationListener.
85 } // end namespace clang