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 class VarTemplateDecl;
34 class VarTemplateSpecializationDecl;
36 /// \brief An abstract interface that should be implemented by listeners
37 /// that want to be notified when an AST entity gets modified after its
39 class ASTMutationListener {
41 virtual ~ASTMutationListener();
43 /// \brief A new TagDecl definition was completed.
44 virtual void CompletedTagDefinition(const TagDecl *D) { }
46 /// \brief A new declaration with name has been added to a DeclContext.
47 virtual void AddedVisibleDecl(const DeclContext *DC, const Decl *D) {}
49 /// \brief An implicit member was added after the definition was completed.
50 virtual void AddedCXXImplicitMember(const CXXRecordDecl *RD, const Decl *D) {}
52 /// \brief A template specialization (or partial one) was added to the
53 /// template declaration.
54 virtual void AddedCXXTemplateSpecialization(const ClassTemplateDecl *TD,
55 const ClassTemplateSpecializationDecl *D) {}
57 /// \brief A template specialization (or partial one) was added to the
58 /// template declaration.
60 AddedCXXTemplateSpecialization(const VarTemplateDecl *TD,
61 const VarTemplateSpecializationDecl *D) {}
63 /// \brief A template specialization (or partial one) was added to the
64 /// template declaration.
65 virtual void AddedCXXTemplateSpecialization(const FunctionTemplateDecl *TD,
66 const FunctionDecl *D) {}
68 /// \brief A function's return type has been deduced.
69 virtual void DeducedReturnType(const FunctionDecl *FD, QualType ReturnType);
71 /// \brief An implicit member got a definition.
72 virtual void CompletedImplicitDefinition(const FunctionDecl *D) {}
74 /// \brief A static data member was implicitly instantiated.
75 virtual void StaticDataMemberInstantiated(const VarDecl *D) {}
77 /// \brief A new objc category class was added for an interface.
78 virtual void AddedObjCCategoryToInterface(const ObjCCategoryDecl *CatD,
79 const ObjCInterfaceDecl *IFD) {}
81 /// \brief A objc class extension redeclared or introduced a property.
83 /// \param Prop the property in the class extension
85 /// \param OrigProp the property from the original interface that was declared
86 /// or null if the property was introduced.
88 /// \param ClassExt the class extension.
89 virtual void AddedObjCPropertyInClassExtension(const ObjCPropertyDecl *Prop,
90 const ObjCPropertyDecl *OrigProp,
91 const ObjCCategoryDecl *ClassExt) {}
93 /// \brief A declaration is marked used which was not previously marked used.
95 /// \param D the declaration marked used
96 virtual void DeclarationMarkedUsed(const Decl *D) {}
98 // NOTE: If new methods are added they should also be added to
99 // MultiplexASTMutationListener.
102 } // end namespace clang