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"
23 class ClassTemplateDecl;
24 class ClassTemplateSpecializationDecl;
26 class FunctionTemplateDecl;
27 class ObjCCategoryDecl;
28 class ObjCInterfaceDecl;
29 class ObjCContainerDecl;
30 class ObjCPropertyDecl;
32 /// \brief An abstract interface that should be implemented by listeners
33 /// that want to be notified when an AST entity gets modified after its
35 class ASTMutationListener {
37 virtual ~ASTMutationListener();
39 /// \brief A new TagDecl definition was completed.
40 virtual void CompletedTagDefinition(const TagDecl *D) { }
42 /// \brief A new declaration with name has been added to a DeclContext.
43 virtual void AddedVisibleDecl(const DeclContext *DC, const Decl *D) {}
45 /// \brief An implicit member was added after the definition was completed.
46 virtual void AddedCXXImplicitMember(const CXXRecordDecl *RD, const Decl *D) {}
48 /// \brief A template specialization (or partial one) was added to the
49 /// template declaration.
50 virtual void AddedCXXTemplateSpecialization(const ClassTemplateDecl *TD,
51 const ClassTemplateSpecializationDecl *D) {}
53 /// \brief A template specialization (or partial one) was added to the
54 /// template declaration.
55 virtual void AddedCXXTemplateSpecialization(const FunctionTemplateDecl *TD,
56 const FunctionDecl *D) {}
58 /// \brief An implicit member got a definition.
59 virtual void CompletedImplicitDefinition(const FunctionDecl *D) {}
61 /// \brief A static data member was implicitly instantiated.
62 virtual void StaticDataMemberInstantiated(const VarDecl *D) {}
64 /// \brief A new objc category class was added for an interface.
65 virtual void AddedObjCCategoryToInterface(const ObjCCategoryDecl *CatD,
66 const ObjCInterfaceDecl *IFD) {}
68 /// \brief A objc class extension redeclared or introduced a property.
70 /// \param Prop the property in the class extension
72 /// \param OrigProp the property from the original interface that was declared
73 /// or null if the property was introduced.
75 /// \param ClassExt the class extension.
76 virtual void AddedObjCPropertyInClassExtension(const ObjCPropertyDecl *Prop,
77 const ObjCPropertyDecl *OrigProp,
78 const ObjCCategoryDecl *ClassExt) {}
80 // NOTE: If new methods are added they should also be added to
81 // MultiplexASTMutationListener.
84 } // end namespace clang