clang API Documentation
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 #include "clang/Basic/SourceLocation.h" 00017 00018 namespace clang { 00019 class CXXRecordDecl; 00020 class ClassTemplateDecl; 00021 class ClassTemplateSpecializationDecl; 00022 class Decl; 00023 class DeclContext; 00024 class FunctionDecl; 00025 class FunctionTemplateDecl; 00026 class ObjCCategoryDecl; 00027 class ObjCContainerDecl; 00028 class ObjCInterfaceDecl; 00029 class ObjCPropertyDecl; 00030 class QualType; 00031 class TagDecl; 00032 class VarDecl; 00033 class VarTemplateDecl; 00034 class VarTemplateSpecializationDecl; 00035 00036 /// \brief An abstract interface that should be implemented by listeners 00037 /// that want to be notified when an AST entity gets modified after its 00038 /// initial creation. 00039 class ASTMutationListener { 00040 public: 00041 virtual ~ASTMutationListener(); 00042 00043 /// \brief A new TagDecl definition was completed. 00044 virtual void CompletedTagDefinition(const TagDecl *D) { } 00045 00046 /// \brief A new declaration with name has been added to a DeclContext. 00047 virtual void AddedVisibleDecl(const DeclContext *DC, const Decl *D) {} 00048 00049 /// \brief An implicit member was added after the definition was completed. 00050 virtual void AddedCXXImplicitMember(const CXXRecordDecl *RD, const Decl *D) {} 00051 00052 /// \brief A template specialization (or partial one) was added to the 00053 /// template declaration. 00054 virtual void AddedCXXTemplateSpecialization(const ClassTemplateDecl *TD, 00055 const ClassTemplateSpecializationDecl *D) {} 00056 00057 /// \brief A template specialization (or partial one) was added to the 00058 /// template declaration. 00059 virtual void 00060 AddedCXXTemplateSpecialization(const VarTemplateDecl *TD, 00061 const VarTemplateSpecializationDecl *D) {} 00062 00063 /// \brief A template specialization (or partial one) was added to the 00064 /// template declaration. 00065 virtual void AddedCXXTemplateSpecialization(const FunctionTemplateDecl *TD, 00066 const FunctionDecl *D) {} 00067 00068 /// \brief A function's exception specification has been evaluated or 00069 /// instantiated. 00070 virtual void ResolvedExceptionSpec(const FunctionDecl *FD) {} 00071 00072 /// \brief A function's return type has been deduced. 00073 virtual void DeducedReturnType(const FunctionDecl *FD, QualType ReturnType); 00074 00075 /// \brief An implicit member got a definition. 00076 virtual void CompletedImplicitDefinition(const FunctionDecl *D) {} 00077 00078 /// \brief A static data member was implicitly instantiated. 00079 virtual void StaticDataMemberInstantiated(const VarDecl *D) {} 00080 00081 /// \brief A function template's definition was instantiated. 00082 virtual void FunctionDefinitionInstantiated(const FunctionDecl *D) {} 00083 00084 /// \brief A new objc category class was added for an interface. 00085 virtual void AddedObjCCategoryToInterface(const ObjCCategoryDecl *CatD, 00086 const ObjCInterfaceDecl *IFD) {} 00087 00088 /// \brief A objc class extension redeclared or introduced a property. 00089 /// 00090 /// \param Prop the property in the class extension 00091 /// 00092 /// \param OrigProp the property from the original interface that was declared 00093 /// or null if the property was introduced. 00094 /// 00095 /// \param ClassExt the class extension. 00096 virtual void AddedObjCPropertyInClassExtension(const ObjCPropertyDecl *Prop, 00097 const ObjCPropertyDecl *OrigProp, 00098 const ObjCCategoryDecl *ClassExt) {} 00099 00100 /// \brief A declaration is marked used which was not previously marked used. 00101 /// 00102 /// \param D the declaration marked used 00103 virtual void DeclarationMarkedUsed(const Decl *D) {} 00104 00105 /// \brief A declaration is marked as OpenMP threadprivate which was not 00106 /// previously marked as threadprivate. 00107 /// 00108 /// \param D the declaration marked OpenMP threadprivate. 00109 virtual void DeclarationMarkedOpenMPThreadPrivate(const Decl *D) {} 00110 00111 // NOTE: If new methods are added they should also be added to 00112 // MultiplexASTMutationListener. 00113 }; 00114 00115 } // end namespace clang 00116 00117 #endif