1 //===--- ASTMutationListener.h - AST Mutation Interface --------*- C++ -*-===// 2 // 3 // The LLVM Compiler Infrastructure 4 // 5 // This file is distributed under the University of Illinois Open Source 6 // License. See LICENSE.TXT for details. 7 // 8 //===----------------------------------------------------------------------===// 9 // 10 // This file defines the ASTMutationListener interface. 11 // 12 //===----------------------------------------------------------------------===// 13 #ifndef LLVM_CLANG_AST_ASTMUTATIONLISTENER_H 14 #define LLVM_CLANG_AST_ASTMUTATIONLISTENER_H 15 16 namespace clang { 17 class Decl; 18 class DeclContext; 19 class TagDecl; 20 class CXXRecordDecl; 21 class ClassTemplateDecl; 22 class ClassTemplateSpecializationDecl; 23 class FunctionDecl; 24 class FunctionTemplateDecl; 25 26 /// \brief An abstract interface that should be implemented by listeners 27 /// that want to be notified when an AST entity gets modified after its 28 /// initial creation. 29 class ASTMutationListener { 30 public: 31 virtual ~ASTMutationListener(); 32 33 /// \brief A new TagDecl definition was completed. CompletedTagDefinition(const TagDecl * D)34 virtual void CompletedTagDefinition(const TagDecl *D) { } 35 36 /// \brief A new declaration with name has been added to a DeclContext. AddedVisibleDecl(const DeclContext * DC,const Decl * D)37 virtual void AddedVisibleDecl(const DeclContext *DC, const Decl *D) {} 38 39 /// \brief An implicit member was added after the definition was completed. AddedCXXImplicitMember(const CXXRecordDecl * RD,const Decl * D)40 virtual void AddedCXXImplicitMember(const CXXRecordDecl *RD, const Decl *D) {} 41 42 /// \brief A template specialization (or partial one) was added to the 43 /// template declaration. AddedCXXTemplateSpecialization(const ClassTemplateDecl * TD,const ClassTemplateSpecializationDecl * D)44 virtual void AddedCXXTemplateSpecialization(const ClassTemplateDecl *TD, 45 const ClassTemplateSpecializationDecl *D) {} 46 47 /// \brief A template specialization (or partial one) was added to the 48 /// template declaration. AddedCXXTemplateSpecialization(const FunctionTemplateDecl * TD,const FunctionDecl * D)49 virtual void AddedCXXTemplateSpecialization(const FunctionTemplateDecl *TD, 50 const FunctionDecl *D) {} 51 52 /// \brief An implicit member got a definition. CompletedImplicitDefinition(const FunctionDecl * D)53 virtual void CompletedImplicitDefinition(const FunctionDecl *D) {} 54 55 /// \brief A static data member was implicitly instantiated. StaticDataMemberInstantiated(const VarDecl * D)56 virtual void StaticDataMemberInstantiated(const VarDecl *D) {} 57 }; 58 59 } // end namespace clang 60 61 #endif 62