clang  3.8.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 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.
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.
60 
61  /// \brief A template specialization (or partial one) was added to the
62  /// template declaration.
63  virtual void
66 
67  /// \brief A template specialization (or partial one) was added to the
68  /// template declaration.
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.
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
FunctionDecl - An instance of this class is created to represent a function declaration or definition...
Definition: Decl.h:1483
A (possibly-)qualified type.
Definition: Type.h:575
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.
Decl - This represents one declaration (or definition), e.g.
Definition: DeclBase.h:77
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. ...
The l-value was an access to a declared entity or something equivalently strong, like the address of ...
VarDecl - An instance of this class is created to represent a variable declaration or definition...
Definition: Decl.h:699
Represents a variable template specialization, which refers to a variable template with a given set o...
ParmVarDecl - Represents a parameter to a function.
Definition: Decl.h:1299
RecordDecl - Represents a struct/union/class.
Definition: Decl.h:3166
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:47
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:853
virtual void DefaultArgumentInstantiated(const ParmVarDecl *D)
A default argument was instantiated.
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:2345
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:2644
virtual void CompletedTagDefinition(const TagDecl *D)
A new TagDecl definition was completed.
ObjCCategoryDecl - Represents a category declaration.
Definition: DeclObjC.h:1931
virtual void AddedCXXTemplateSpecialization(const VarTemplateDecl *TD, const VarTemplateSpecializationDecl *D)
A template specialization (or partial one) was added to the template declaration. ...
DeclContext - This is used only as base class of specific decl types that can act as declaration cont...
Definition: DeclBase.h:1121
virtual void AddedCXXImplicitMember(const CXXRecordDecl *RD, const Decl *D)
An implicit member was added after the definition was completed.
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.
NamedDecl - This represents a decl with a name.
Definition: Decl.h:145
Declaration of a template function.
Definition: DeclTemplate.h:830
Attr - This represents one attribute.
Definition: Attr.h:44