clang API Documentation

ASTMutationListener.h
Go to the documentation of this file.
00001 //===--- ASTMutationListener.h - AST Mutation Interface --------*- C++ -*-===//
00002 //
00003 //                     The LLVM Compiler Infrastructure
00004 //
00005 // This file is distributed under the University of Illinois Open Source
00006 // License. See LICENSE.TXT for details.
00007 //
00008 //===----------------------------------------------------------------------===//
00009 //
00010 //  This file defines the ASTMutationListener interface.
00011 //
00012 //===----------------------------------------------------------------------===//
00013 #ifndef LLVM_CLANG_AST_ASTMUTATIONLISTENER_H
00014 #define LLVM_CLANG_AST_ASTMUTATIONLISTENER_H
00015 
00016 namespace clang {
00017   class Decl;
00018   class DeclContext;
00019   class TagDecl;
00020   class CXXRecordDecl;
00021   class ClassTemplateDecl;
00022   class ClassTemplateSpecializationDecl;
00023   class FunctionDecl;
00024   class FunctionTemplateDecl;
00025   class ObjCCategoryDecl;
00026   class ObjCInterfaceDecl;
00027   class ObjCContainerDecl;
00028   class ObjCPropertyDecl;
00029 
00030 /// \brief An abstract interface that should be implemented by listeners
00031 /// that want to be notified when an AST entity gets modified after its
00032 /// initial creation.
00033 class ASTMutationListener {
00034 public:
00035   virtual ~ASTMutationListener();
00036 
00037   /// \brief A new TagDecl definition was completed.
00038   virtual void CompletedTagDefinition(const TagDecl *D) { }
00039 
00040   /// \brief A new declaration with name has been added to a DeclContext.
00041   virtual void AddedVisibleDecl(const DeclContext *DC, const Decl *D) {}
00042 
00043   /// \brief An implicit member was added after the definition was completed.
00044   virtual void AddedCXXImplicitMember(const CXXRecordDecl *RD, const Decl *D) {}
00045 
00046   /// \brief A template specialization (or partial one) was added to the
00047   /// template declaration.
00048   virtual void AddedCXXTemplateSpecialization(const ClassTemplateDecl *TD,
00049                                     const ClassTemplateSpecializationDecl *D) {}
00050 
00051   /// \brief A template specialization (or partial one) was added to the
00052   /// template declaration.
00053   virtual void AddedCXXTemplateSpecialization(const FunctionTemplateDecl *TD,
00054                                               const FunctionDecl *D) {}
00055 
00056   /// \brief An implicit member got a definition.
00057   virtual void CompletedImplicitDefinition(const FunctionDecl *D) {}
00058 
00059   /// \brief A static data member was implicitly instantiated.
00060   virtual void StaticDataMemberInstantiated(const VarDecl *D) {}
00061 
00062   /// \brief A new objc category class was added for an interface.
00063   virtual void AddedObjCCategoryToInterface(const ObjCCategoryDecl *CatD,
00064                                             const ObjCInterfaceDecl *IFD) {}
00065 
00066   /// \brief A objc class extension redeclared or introduced a property.
00067   ///
00068   /// \param Prop the property in the class extension
00069   ///
00070   /// \param OrigProp the property from the original interface that was declared
00071   /// or null if the property was introduced.
00072   ///
00073   /// \param ClassExt the class extension.
00074   virtual void AddedObjCPropertyInClassExtension(const ObjCPropertyDecl *Prop,
00075                                             const ObjCPropertyDecl *OrigProp,
00076                                             const ObjCCategoryDecl *ClassExt) {}
00077 
00078   // NOTE: If new methods are added they should also be added to
00079   // MultiplexASTMutationListener.
00080 };
00081 
00082 } // end namespace clang
00083 
00084 #endif