clang  3.9.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 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.
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.
61 
62  /// \brief A template specialization (or partial one) was added to the
63  /// template declaration.
64  virtual void
67 
68  /// \brief A template specialization (or partial one) was added to the
69  /// template declaration.
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.
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.
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
FunctionDecl - An instance of this class is created to represent a function declaration or definition...
Definition: Decl.h:1561
A (possibly-)qualified type.
Definition: Type.h:598
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. ...
VarDecl - An instance of this class is created to represent a variable declaration or definition...
Definition: Decl.h:768
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:1377
RecordDecl - Represents a struct/union/class.
Definition: Decl.h:3253
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:1091
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:2414
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:2727
virtual void CompletedTagDefinition(const TagDecl *D)
A new TagDecl definition was completed.
ObjCCategoryDecl - Represents a category declaration.
Definition: DeclObjC.h:2171
virtual void DeclarationMarkedOpenMPDeclareTarget(const Decl *D, const Attr *Attr)
A declaration is marked as OpenMP declaretarget which was not previously marked as declaretarget...
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:1135
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:263
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:213
Declaration of a template function.
Definition: DeclTemplate.h:838
Attr - This represents one attribute.
Definition: Attr.h:45