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;
37 class VarTemplateDecl;
38 class VarTemplateSpecializationDecl;
40 /// \brief An abstract interface that should be implemented by listeners
41 /// that want to be notified when an AST entity gets modified after its
43 class ASTMutationListener {
45 virtual ~ASTMutationListener();
47 /// \brief A new TagDecl definition was completed.
48 virtual void CompletedTagDefinition(const TagDecl *D) { }
50 /// \brief A new declaration with name has been added to a DeclContext.
51 virtual void AddedVisibleDecl(const DeclContext *DC, const Decl *D) {}
53 /// \brief An implicit member was added after the definition was completed.
54 virtual void AddedCXXImplicitMember(const CXXRecordDecl *RD, const Decl *D) {}
56 /// \brief A template specialization (or partial one) was added to the
57 /// template declaration.
58 virtual void AddedCXXTemplateSpecialization(const ClassTemplateDecl *TD,
59 const ClassTemplateSpecializationDecl *D) {}
61 /// \brief A template specialization (or partial one) was added to the
62 /// template declaration.
64 AddedCXXTemplateSpecialization(const VarTemplateDecl *TD,
65 const VarTemplateSpecializationDecl *D) {}
67 /// \brief A template specialization (or partial one) was added to the
68 /// template declaration.
69 virtual void AddedCXXTemplateSpecialization(const FunctionTemplateDecl *TD,
70 const FunctionDecl *D) {}
72 /// \brief A function's exception specification has been evaluated or
74 virtual void ResolvedExceptionSpec(const FunctionDecl *FD) {}
76 /// \brief A function's return type has been deduced.
77 virtual void DeducedReturnType(const FunctionDecl *FD, QualType ReturnType);
79 /// \brief A virtual destructor's operator delete has been resolved.
80 virtual void ResolvedOperatorDelete(const CXXDestructorDecl *DD,
81 const FunctionDecl *Delete) {}
83 /// \brief An implicit member got a definition.
84 virtual void CompletedImplicitDefinition(const FunctionDecl *D) {}
86 /// \brief A static data member was implicitly instantiated.
87 virtual void StaticDataMemberInstantiated(const VarDecl *D) {}
89 /// \brief A function template's definition was instantiated.
90 virtual void FunctionDefinitionInstantiated(const FunctionDecl *D) {}
92 /// \brief A default argument was instantiated.
93 virtual void DefaultArgumentInstantiated(const ParmVarDecl *D) {}
95 /// \brief A new objc category class was added for an interface.
96 virtual void AddedObjCCategoryToInterface(const ObjCCategoryDecl *CatD,
97 const ObjCInterfaceDecl *IFD) {}
99 /// \brief A declaration is marked used which was not previously marked used.
101 /// \param D the declaration marked used
102 virtual void DeclarationMarkedUsed(const Decl *D) {}
104 /// \brief A declaration is marked as OpenMP threadprivate which was not
105 /// previously marked as threadprivate.
107 /// \param D the declaration marked OpenMP threadprivate.
108 virtual void DeclarationMarkedOpenMPThreadPrivate(const Decl *D) {}
110 /// \brief A definition has been made visible by being redefined locally.
112 /// \param D The definition that was previously not visible.
113 /// \param M The containing module in which the definition was made visible,
115 virtual void RedefinedHiddenDefinition(const NamedDecl *D, Module *M) {}
117 /// \brief An attribute was added to a RecordDecl
119 /// \param Attr The attribute that was added to the Record
121 /// \param Record The RecordDecl that got a new attribute
122 virtual void AddedAttributeToRecord(const Attr *Attr,
123 const RecordDecl *Record) {}
125 // NOTE: If new methods are added they should also be added to
126 // MultiplexASTMutationListener.
129 } // end namespace clang