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 ConstructorUsingShadowDecl;
21 class CXXDestructorDecl;
26 class FunctionTemplateDecl;
29 class ObjCCategoryDecl;
30 class ObjCContainerDecl;
31 class ObjCInterfaceDecl;
32 class ObjCPropertyDecl;
38 class VarTemplateDecl;
39 class VarTemplateSpecializationDecl;
41 /// \brief An abstract interface that should be implemented by listeners
42 /// that want to be notified when an AST entity gets modified after its
44 class ASTMutationListener {
46 virtual ~ASTMutationListener();
48 /// \brief A new TagDecl definition was completed.
49 virtual void CompletedTagDefinition(const TagDecl *D) { }
51 /// \brief A new declaration with name has been added to a DeclContext.
52 virtual void AddedVisibleDecl(const DeclContext *DC, const Decl *D) {}
54 /// \brief An implicit member was added after the definition was completed.
55 virtual void AddedCXXImplicitMember(const CXXRecordDecl *RD, const Decl *D) {}
57 /// \brief A template specialization (or partial one) was added to the
58 /// template declaration.
59 virtual void AddedCXXTemplateSpecialization(const ClassTemplateDecl *TD,
60 const ClassTemplateSpecializationDecl *D) {}
62 /// \brief A template specialization (or partial one) was added to the
63 /// template declaration.
65 AddedCXXTemplateSpecialization(const VarTemplateDecl *TD,
66 const VarTemplateSpecializationDecl *D) {}
68 /// \brief A template specialization (or partial one) was added to the
69 /// template declaration.
70 virtual void AddedCXXTemplateSpecialization(const FunctionTemplateDecl *TD,
71 const FunctionDecl *D) {}
73 /// \brief A function's exception specification has been evaluated or
75 virtual void ResolvedExceptionSpec(const FunctionDecl *FD) {}
77 /// \brief A function's return type has been deduced.
78 virtual void DeducedReturnType(const FunctionDecl *FD, QualType ReturnType);
80 /// \brief A virtual destructor's operator delete has been resolved.
81 virtual void ResolvedOperatorDelete(const CXXDestructorDecl *DD,
82 const FunctionDecl *Delete) {}
84 /// \brief An implicit member got a definition.
85 virtual void CompletedImplicitDefinition(const FunctionDecl *D) {}
87 /// \brief A static data member was implicitly instantiated.
88 virtual void StaticDataMemberInstantiated(const VarDecl *D) {}
90 /// \brief A function template's definition was instantiated.
91 virtual void FunctionDefinitionInstantiated(const FunctionDecl *D) {}
93 /// \brief A default argument was instantiated.
94 virtual void DefaultArgumentInstantiated(const ParmVarDecl *D) {}
96 /// \brief A new objc category class was added for an interface.
97 virtual void AddedObjCCategoryToInterface(const ObjCCategoryDecl *CatD,
98 const ObjCInterfaceDecl *IFD) {}
100 /// \brief A declaration is marked used which was not previously marked used.
102 /// \param D the declaration marked used
103 virtual void DeclarationMarkedUsed(const Decl *D) {}
105 /// \brief A declaration is marked as OpenMP threadprivate which was not
106 /// previously marked as threadprivate.
108 /// \param D the declaration marked OpenMP threadprivate.
109 virtual void DeclarationMarkedOpenMPThreadPrivate(const Decl *D) {}
111 /// \brief A declaration is marked as OpenMP declaretarget which was not
112 /// previously marked as declaretarget.
114 /// \param D the declaration marked OpenMP declaretarget.
115 /// \param Attr the added attribute.
116 virtual void DeclarationMarkedOpenMPDeclareTarget(const Decl *D,
119 /// \brief A definition has been made visible by being redefined locally.
121 /// \param D The definition that was previously not visible.
122 /// \param M The containing module in which the definition was made visible,
124 virtual void RedefinedHiddenDefinition(const NamedDecl *D, Module *M) {}
126 /// \brief An attribute was added to a RecordDecl
128 /// \param Attr The attribute that was added to the Record
130 /// \param Record The RecordDecl that got a new attribute
131 virtual void AddedAttributeToRecord(const Attr *Attr,
132 const RecordDecl *Record) {}
134 // NOTE: If new methods are added they should also be added to
135 // MultiplexASTMutationListener.
138 } // end namespace clang