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;
27 class FunctionTemplateDecl;
30 class ObjCCategoryDecl;
31 class ObjCContainerDecl;
32 class ObjCInterfaceDecl;
33 class ObjCPropertyDecl;
39 class VarTemplateDecl;
40 class VarTemplateSpecializationDecl;
42 /// \brief An abstract interface that should be implemented by listeners
43 /// that want to be notified when an AST entity gets modified after its
45 class ASTMutationListener {
47 virtual ~ASTMutationListener();
49 /// \brief A new TagDecl definition was completed.
50 virtual void CompletedTagDefinition(const TagDecl *D) { }
52 /// \brief A new declaration with name has been added to a DeclContext.
53 virtual void AddedVisibleDecl(const DeclContext *DC, const Decl *D) {}
55 /// \brief An implicit member was added after the definition was completed.
56 virtual void AddedCXXImplicitMember(const CXXRecordDecl *RD, const Decl *D) {}
58 /// \brief A template specialization (or partial one) was added to the
59 /// template declaration.
60 virtual void AddedCXXTemplateSpecialization(const ClassTemplateDecl *TD,
61 const ClassTemplateSpecializationDecl *D) {}
63 /// \brief A template specialization (or partial one) was added to the
64 /// template declaration.
66 AddedCXXTemplateSpecialization(const VarTemplateDecl *TD,
67 const VarTemplateSpecializationDecl *D) {}
69 /// \brief A template specialization (or partial one) was added to the
70 /// template declaration.
71 virtual void AddedCXXTemplateSpecialization(const FunctionTemplateDecl *TD,
72 const FunctionDecl *D) {}
74 /// \brief A function's exception specification has been evaluated or
76 virtual void ResolvedExceptionSpec(const FunctionDecl *FD) {}
78 /// \brief A function's return type has been deduced.
79 virtual void DeducedReturnType(const FunctionDecl *FD, QualType ReturnType);
81 /// \brief A virtual destructor's operator delete has been resolved.
82 virtual void ResolvedOperatorDelete(const CXXDestructorDecl *DD,
83 const FunctionDecl *Delete) {}
85 /// \brief An implicit member got a definition.
86 virtual void CompletedImplicitDefinition(const FunctionDecl *D) {}
88 /// \brief A static data member was implicitly instantiated.
89 virtual void StaticDataMemberInstantiated(const VarDecl *D) {}
91 /// \brief A function template's definition was instantiated.
92 virtual void FunctionDefinitionInstantiated(const FunctionDecl *D) {}
94 /// \brief A default argument was instantiated.
95 virtual void DefaultArgumentInstantiated(const ParmVarDecl *D) {}
97 /// \brief A default member initializer was instantiated.
98 virtual void DefaultMemberInitializerInstantiated(const FieldDecl *D) {}
100 /// \brief A new objc category class was added for an interface.
101 virtual void AddedObjCCategoryToInterface(const ObjCCategoryDecl *CatD,
102 const ObjCInterfaceDecl *IFD) {}
104 /// \brief A declaration is marked used which was not previously marked used.
106 /// \param D the declaration marked used
107 virtual void DeclarationMarkedUsed(const Decl *D) {}
109 /// \brief A declaration is marked as OpenMP threadprivate which was not
110 /// previously marked as threadprivate.
112 /// \param D the declaration marked OpenMP threadprivate.
113 virtual void DeclarationMarkedOpenMPThreadPrivate(const Decl *D) {}
115 /// \brief A declaration is marked as OpenMP declaretarget which was not
116 /// previously marked as declaretarget.
118 /// \param D the declaration marked OpenMP declaretarget.
119 /// \param Attr the added attribute.
120 virtual void DeclarationMarkedOpenMPDeclareTarget(const Decl *D,
123 /// \brief A definition has been made visible by being redefined locally.
125 /// \param D The definition that was previously not visible.
126 /// \param M The containing module in which the definition was made visible,
128 virtual void RedefinedHiddenDefinition(const NamedDecl *D, Module *M) {}
130 /// \brief An attribute was added to a RecordDecl
132 /// \param Attr The attribute that was added to the Record
134 /// \param Record The RecordDecl that got a new attribute
135 virtual void AddedAttributeToRecord(const Attr *Attr,
136 const RecordDecl *Record) {}
138 // NOTE: If new methods are added they should also be added to
139 // MultiplexASTMutationListener.
142 } // end namespace clang