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
18 class ClassTemplateDecl;
19 class ClassTemplateSpecializationDecl;
20 class CXXDestructorDecl;
25 class FunctionTemplateDecl;
28 class ObjCCategoryDecl;
29 class ObjCContainerDecl;
30 class ObjCInterfaceDecl;
31 class ObjCPropertyDecl;
36 class VarTemplateDecl;
37 class VarTemplateSpecializationDecl;
39 /// \brief An abstract interface that should be implemented by listeners
40 /// that want to be notified when an AST entity gets modified after its
42 class ASTMutationListener {
44 virtual ~ASTMutationListener();
46 /// \brief A new TagDecl definition was completed.
47 virtual void CompletedTagDefinition(const TagDecl *D) { }
49 /// \brief A new declaration with name has been added to a DeclContext.
50 virtual void AddedVisibleDecl(const DeclContext *DC, const Decl *D) {}
52 /// \brief An implicit member was added after the definition was completed.
53 virtual void AddedCXXImplicitMember(const CXXRecordDecl *RD, const Decl *D) {}
55 /// \brief A template specialization (or partial one) was added to the
56 /// template declaration.
57 virtual void AddedCXXTemplateSpecialization(const ClassTemplateDecl *TD,
58 const ClassTemplateSpecializationDecl *D) {}
60 /// \brief A template specialization (or partial one) was added to the
61 /// template declaration.
63 AddedCXXTemplateSpecialization(const VarTemplateDecl *TD,
64 const VarTemplateSpecializationDecl *D) {}
66 /// \brief A template specialization (or partial one) was added to the
67 /// template declaration.
68 virtual void AddedCXXTemplateSpecialization(const FunctionTemplateDecl *TD,
69 const FunctionDecl *D) {}
71 /// \brief A function's exception specification has been evaluated or
73 virtual void ResolvedExceptionSpec(const FunctionDecl *FD) {}
75 /// \brief A function's return type has been deduced.
76 virtual void DeducedReturnType(const FunctionDecl *FD, QualType ReturnType);
78 /// \brief A virtual destructor's operator delete has been resolved.
79 virtual void ResolvedOperatorDelete(const CXXDestructorDecl *DD,
80 const FunctionDecl *Delete) {}
82 /// \brief An implicit member got a definition.
83 virtual void CompletedImplicitDefinition(const FunctionDecl *D) {}
85 /// \brief A static data member was implicitly instantiated.
86 virtual void StaticDataMemberInstantiated(const VarDecl *D) {}
88 /// \brief A function template's definition was instantiated.
89 virtual void FunctionDefinitionInstantiated(const FunctionDecl *D) {}
91 /// \brief A new objc category class was added for an interface.
92 virtual void AddedObjCCategoryToInterface(const ObjCCategoryDecl *CatD,
93 const ObjCInterfaceDecl *IFD) {}
95 /// \brief A objc class extension redeclared or introduced a property.
97 /// \param Prop the property in the class extension
99 /// \param OrigProp the property from the original interface that was declared
100 /// or null if the property was introduced.
102 /// \param ClassExt the class extension.
103 virtual void AddedObjCPropertyInClassExtension(const ObjCPropertyDecl *Prop,
104 const ObjCPropertyDecl *OrigProp,
105 const ObjCCategoryDecl *ClassExt) {}
107 /// \brief A declaration is marked used which was not previously marked used.
109 /// \param D the declaration marked used
110 virtual void DeclarationMarkedUsed(const Decl *D) {}
112 /// \brief A declaration is marked as OpenMP threadprivate which was not
113 /// previously marked as threadprivate.
115 /// \param D the declaration marked OpenMP threadprivate.
116 virtual void DeclarationMarkedOpenMPThreadPrivate(const Decl *D) {}
118 /// \brief A definition has been made visible by being redefined locally.
120 /// \param D The definition that was previously not visible.
121 /// \param M The containing module in which the definition was made visible,
123 virtual void RedefinedHiddenDefinition(const NamedDecl *D, Module *M) {}
125 /// \brief An attribute was added to a RecordDecl
127 /// \param Attr The attribute that was added to the Record
129 /// \param Record The RecordDecl that got a new attribute
130 virtual void AddedAttributeToRecord(const Attr *Attr,
131 const RecordDecl *Record) {}
133 // NOTE: If new methods are added they should also be added to
134 // MultiplexASTMutationListener.
137 } // end namespace clang