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