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