]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/blob - contrib/llvm/tools/clang/include/clang/AST/ASTMutationListener.h
Merge ^/head r295601 through r295844.
[FreeBSD/FreeBSD.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 namespace clang {
17   class Attr;
18   class ClassTemplateDecl;
19   class ClassTemplateSpecializationDecl;
20   class CXXDestructorDecl;
21   class CXXRecordDecl;
22   class Decl;
23   class DeclContext;
24   class FunctionDecl;
25   class FunctionTemplateDecl;
26   class Module;
27   class NamedDecl;
28   class ObjCCategoryDecl;
29   class ObjCContainerDecl;
30   class ObjCInterfaceDecl;
31   class ObjCPropertyDecl;
32   class ParmVarDecl;
33   class QualType;
34   class RecordDecl;
35   class TagDecl;
36   class VarDecl;
37   class VarTemplateDecl;
38   class VarTemplateSpecializationDecl;
39
40 /// \brief An abstract interface that should be implemented by listeners
41 /// that want to be notified when an AST entity gets modified after its
42 /// initial creation.
43 class ASTMutationListener {
44 public:
45   virtual ~ASTMutationListener();
46
47   /// \brief A new TagDecl definition was completed.
48   virtual void CompletedTagDefinition(const TagDecl *D) { }
49
50   /// \brief A new declaration with name has been added to a DeclContext.
51   virtual void AddedVisibleDecl(const DeclContext *DC, const Decl *D) {}
52
53   /// \brief An implicit member was added after the definition was completed.
54   virtual void AddedCXXImplicitMember(const CXXRecordDecl *RD, const Decl *D) {}
55
56   /// \brief A template specialization (or partial one) was added to the
57   /// template declaration.
58   virtual void AddedCXXTemplateSpecialization(const ClassTemplateDecl *TD,
59                                     const ClassTemplateSpecializationDecl *D) {}
60
61   /// \brief A template specialization (or partial one) was added to the
62   /// template declaration.
63   virtual void
64   AddedCXXTemplateSpecialization(const VarTemplateDecl *TD,
65                                  const VarTemplateSpecializationDecl *D) {}
66
67   /// \brief A template specialization (or partial one) was added to the
68   /// template declaration.
69   virtual void AddedCXXTemplateSpecialization(const FunctionTemplateDecl *TD,
70                                               const FunctionDecl *D) {}
71
72   /// \brief A function's exception specification has been evaluated or
73   /// instantiated.
74   virtual void ResolvedExceptionSpec(const FunctionDecl *FD) {}
75
76   /// \brief A function's return type has been deduced.
77   virtual void DeducedReturnType(const FunctionDecl *FD, QualType ReturnType);
78
79   /// \brief A virtual destructor's operator delete has been resolved.
80   virtual void ResolvedOperatorDelete(const CXXDestructorDecl *DD,
81                                       const FunctionDecl *Delete) {}
82
83   /// \brief An implicit member got a definition.
84   virtual void CompletedImplicitDefinition(const FunctionDecl *D) {}
85
86   /// \brief A static data member was implicitly instantiated.
87   virtual void StaticDataMemberInstantiated(const VarDecl *D) {}
88
89   /// \brief A function template's definition was instantiated.
90   virtual void FunctionDefinitionInstantiated(const FunctionDecl *D) {}
91
92   /// \brief A default argument was instantiated.
93   virtual void DefaultArgumentInstantiated(const ParmVarDecl *D) {}
94
95   /// \brief A new objc category class was added for an interface.
96   virtual void AddedObjCCategoryToInterface(const ObjCCategoryDecl *CatD,
97                                             const ObjCInterfaceDecl *IFD) {}
98
99   /// \brief A declaration is marked used which was not previously marked used.
100   ///
101   /// \param D the declaration marked used
102   virtual void DeclarationMarkedUsed(const Decl *D) {}
103
104   /// \brief A declaration is marked as OpenMP threadprivate which was not
105   /// previously marked as threadprivate.
106   ///
107   /// \param D the declaration marked OpenMP threadprivate.
108   virtual void DeclarationMarkedOpenMPThreadPrivate(const Decl *D) {}
109
110   /// \brief A definition has been made visible by being redefined locally.
111   ///
112   /// \param D The definition that was previously not visible.
113   /// \param M The containing module in which the definition was made visible,
114   ///        if any.
115   virtual void RedefinedHiddenDefinition(const NamedDecl *D, Module *M) {}
116   
117   /// \brief An attribute was added to a RecordDecl
118   ///
119   /// \param Attr The attribute that was added to the Record
120   ///
121   /// \param Record The RecordDecl that got a new attribute
122   virtual void AddedAttributeToRecord(const Attr *Attr, 
123                                       const RecordDecl *Record) {}
124
125   // NOTE: If new methods are added they should also be added to
126   // MultiplexASTMutationListener.
127 };
128
129 } // end namespace clang
130
131 #endif