ASTMutationListener.h revision 2fa67efeaf66a9332c30a026dc1c21bef6c33a6c
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#include "clang/Basic/SourceLocation.h" 17 18namespace clang { 19 class CXXRecordDecl; 20 class ClassTemplateDecl; 21 class ClassTemplateSpecializationDecl; 22 class Decl; 23 class DeclContext; 24 class FunctionDecl; 25 class FunctionTemplateDecl; 26 class ObjCCategoryDecl; 27 class ObjCContainerDecl; 28 class ObjCInterfaceDecl; 29 class ObjCPropertyDecl; 30 class TagDecl; 31 class VarDecl; 32 33/// \brief An abstract interface that should be implemented by listeners 34/// that want to be notified when an AST entity gets modified after its 35/// initial creation. 36class ASTMutationListener { 37public: 38 virtual ~ASTMutationListener(); 39 40 /// \brief A new TagDecl definition was completed. 41 virtual void CompletedTagDefinition(const TagDecl *D) { } 42 43 /// \brief A new declaration with name has been added to a DeclContext. 44 virtual void AddedVisibleDecl(const DeclContext *DC, const Decl *D) {} 45 46 /// \brief An implicit member was added after the definition was completed. 47 virtual void AddedCXXImplicitMember(const CXXRecordDecl *RD, const Decl *D) {} 48 49 /// \brief A template specialization (or partial one) was added to the 50 /// template declaration. 51 virtual void AddedCXXTemplateSpecialization(const ClassTemplateDecl *TD, 52 const ClassTemplateSpecializationDecl *D) {} 53 54 /// \brief A template specialization (or partial one) was added to the 55 /// template declaration. 56 virtual void AddedCXXTemplateSpecialization(const FunctionTemplateDecl *TD, 57 const FunctionDecl *D) {} 58 59 /// \brief An implicit member got a definition. 60 virtual void CompletedImplicitDefinition(const FunctionDecl *D) {} 61 62 /// \brief A static data member was implicitly instantiated. 63 virtual void StaticDataMemberInstantiated(const VarDecl *D) {} 64 65 /// \brief A new objc category class was added for an interface. 66 virtual void AddedObjCCategoryToInterface(const ObjCCategoryDecl *CatD, 67 const ObjCInterfaceDecl *IFD) {} 68 69 /// \brief A objc class extension redeclared or introduced a property. 70 /// 71 /// \param Prop the property in the class extension 72 /// 73 /// \param OrigProp the property from the original interface that was declared 74 /// or null if the property was introduced. 75 /// 76 /// \param ClassExt the class extension. 77 virtual void AddedObjCPropertyInClassExtension(const ObjCPropertyDecl *Prop, 78 const ObjCPropertyDecl *OrigProp, 79 const ObjCCategoryDecl *ClassExt) {} 80 81 // NOTE: If new methods are added they should also be added to 82 // MultiplexASTMutationListener. 83}; 84 85} // end namespace clang 86 87#endif 88