clang  3.7.0
ASTMutationListener.h
Go to the documentation of this file.
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.
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.
59 
60  /// \brief A template specialization (or partial one) was added to the
61  /// template declaration.
62  virtual void
65 
66  /// \brief A template specialization (or partial one) was added to the
67  /// template declaration.
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.
93  const ObjCInterfaceDecl *IFD) {}
94 
95  /// \brief A objc class extension redeclared or introduced a property.
96  ///
97  /// \param Prop the property in the class extension
98  ///
99  /// \param OrigProp the property from the original interface that was declared
100  /// or null if the property was introduced.
101  ///
102  /// \param ClassExt the class extension.
104  const ObjCPropertyDecl *OrigProp,
105  const ObjCCategoryDecl *ClassExt) {}
106 
107  /// \brief A declaration is marked used which was not previously marked used.
108  ///
109  /// \param D the declaration marked used
110  virtual void DeclarationMarkedUsed(const Decl *D) {}
111 
112  /// \brief A declaration is marked as OpenMP threadprivate which was not
113  /// previously marked as threadprivate.
114  ///
115  /// \param D the declaration marked OpenMP threadprivate.
116  virtual void DeclarationMarkedOpenMPThreadPrivate(const Decl *D) {}
117 
118  /// \brief A definition has been made visible by being redefined locally.
119  ///
120  /// \param D The definition that was previously not visible.
121  /// \param M The containing module in which the definition was made visible,
122  /// if any.
123  virtual void RedefinedHiddenDefinition(const NamedDecl *D, Module *M) {}
124 
125  /// \brief An attribute was added to a RecordDecl
126  ///
127  /// \param Attr The attribute that was added to the Record
128  ///
129  /// \param Record The RecordDecl that got a new attribute
130  virtual void AddedAttributeToRecord(const Attr *Attr,
131  const RecordDecl *Record) {}
132 
133  // NOTE: If new methods are added they should also be added to
134  // MultiplexASTMutationListener.
135 };
136 
137 } // end namespace clang
138 
139 #endif
virtual void AddedObjCCategoryToInterface(const ObjCCategoryDecl *CatD, const ObjCInterfaceDecl *IFD)
A new objc category class was added for an interface.
virtual void DeducedReturnType(const FunctionDecl *FD, QualType ReturnType)
A function's return type has been deduced.
virtual void CompletedImplicitDefinition(const FunctionDecl *D)
An implicit member got a definition.
Declaration of a variable template.
virtual void AddedCXXTemplateSpecialization(const FunctionTemplateDecl *TD, const FunctionDecl *D)
A template specialization (or partial one) was added to the template declaration. ...
Represents a variable template specialization, which refers to a variable template with a given set o...
Represents a class template specialization, which refers to a class template with a given set of temp...
Describes a module or submodule.
Definition: Basic/Module.h:49
virtual void AddedVisibleDecl(const DeclContext *DC, const Decl *D)
A new declaration with name has been added to a DeclContext.
Represents an ObjC class declaration.
Definition: DeclObjC.h:851
virtual void AddedCXXTemplateSpecialization(const ClassTemplateDecl *TD, const ClassTemplateSpecializationDecl *D)
A template specialization (or partial one) was added to the template declaration. ...
virtual void FunctionDefinitionInstantiated(const FunctionDecl *D)
A function template's definition was instantiated.
Represents a C++ destructor within a class.
Definition: DeclCXX.h:2358
virtual void DeclarationMarkedOpenMPThreadPrivate(const Decl *D)
A declaration is marked as OpenMP threadprivate which was not previously marked as threadprivate...
An abstract interface that should be implemented by listeners that want to be notified when an AST en...
virtual void RedefinedHiddenDefinition(const NamedDecl *D, Module *M)
A definition has been made visible by being redefined locally.
virtual void StaticDataMemberInstantiated(const VarDecl *D)
A static data member was implicitly instantiated.
virtual void DeclarationMarkedUsed(const Decl *D)
A declaration is marked used which was not previously marked used.
virtual void AddedAttributeToRecord(const Attr *Attr, const RecordDecl *Record)
An attribute was added to a RecordDecl.
virtual void ResolvedExceptionSpec(const FunctionDecl *FD)
A function's exception specification has been evaluated or instantiated.
TagDecl - Represents the declaration of a struct/union/class/enum.
Definition: Decl.h:2694
virtual void CompletedTagDefinition(const TagDecl *D)
A new TagDecl definition was completed.
Represents one property declaration in an Objective-C interface.
Definition: DeclObjC.h:2424
virtual void AddedCXXTemplateSpecialization(const VarTemplateDecl *TD, const VarTemplateSpecializationDecl *D)
A template specialization (or partial one) was added to the template declaration. ...
virtual void AddedCXXImplicitMember(const CXXRecordDecl *RD, const Decl *D)
An implicit member was added after the definition was completed.
virtual void AddedObjCPropertyInClassExtension(const ObjCPropertyDecl *Prop, const ObjCPropertyDecl *OrigProp, const ObjCCategoryDecl *ClassExt)
A objc class extension redeclared or introduced a property.
Represents a C++ struct/union/class.
Definition: DeclCXX.h:285
Declaration of a class template.
virtual void ResolvedOperatorDelete(const CXXDestructorDecl *DD, const FunctionDecl *Delete)
A virtual destructor's operator delete has been resolved.
Declaration of a template function.
Definition: DeclTemplate.h:821
Attr - This represents one attribute.
Definition: Attr.h:44