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