clang  5.0.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 FieldDecl;
26  class FunctionDecl;
27  class FunctionTemplateDecl;
28  class Module;
29  class NamedDecl;
30  class ObjCCategoryDecl;
31  class ObjCContainerDecl;
32  class ObjCInterfaceDecl;
33  class ObjCPropertyDecl;
34  class ParmVarDecl;
35  class QualType;
36  class RecordDecl;
37  class TagDecl;
38  class VarDecl;
39  class VarTemplateDecl;
40  class VarTemplateSpecializationDecl;
41 
42 /// \brief An abstract interface that should be implemented by listeners
43 /// that want to be notified when an AST entity gets modified after its
44 /// initial creation.
46 public:
47  virtual ~ASTMutationListener();
48 
49  /// \brief A new TagDecl definition was completed.
50  virtual void CompletedTagDefinition(const TagDecl *D) { }
51 
52  /// \brief A new declaration with name has been added to a DeclContext.
53  virtual void AddedVisibleDecl(const DeclContext *DC, const Decl *D) {}
54 
55  /// \brief An implicit member was added after the definition was completed.
56  virtual void AddedCXXImplicitMember(const CXXRecordDecl *RD, const Decl *D) {}
57 
58  /// \brief A template specialization (or partial one) was added to the
59  /// template declaration.
62 
63  /// \brief A template specialization (or partial one) was added to the
64  /// template declaration.
65  virtual void
68 
69  /// \brief A template specialization (or partial one) was added to the
70  /// template declaration.
72  const FunctionDecl *D) {}
73 
74  /// \brief A function's exception specification has been evaluated or
75  /// instantiated.
76  virtual void ResolvedExceptionSpec(const FunctionDecl *FD) {}
77 
78  /// \brief A function's return type has been deduced.
79  virtual void DeducedReturnType(const FunctionDecl *FD, QualType ReturnType);
80 
81  /// \brief A virtual destructor's operator delete has been resolved.
82  virtual void ResolvedOperatorDelete(const CXXDestructorDecl *DD,
83  const FunctionDecl *Delete) {}
84 
85  /// \brief An implicit member got a definition.
86  virtual void CompletedImplicitDefinition(const FunctionDecl *D) {}
87 
88  /// \brief A static data member was implicitly instantiated.
89  virtual void StaticDataMemberInstantiated(const VarDecl *D) {}
90 
91  /// \brief A function template's definition was instantiated.
92  virtual void FunctionDefinitionInstantiated(const FunctionDecl *D) {}
93 
94  /// \brief A default argument was instantiated.
95  virtual void DefaultArgumentInstantiated(const ParmVarDecl *D) {}
96 
97  /// \brief A default member initializer was instantiated.
99 
100  /// \brief A new objc category class was added for an interface.
102  const ObjCInterfaceDecl *IFD) {}
103 
104  /// \brief A declaration is marked used which was not previously marked used.
105  ///
106  /// \param D the declaration marked used
107  virtual void DeclarationMarkedUsed(const Decl *D) {}
108 
109  /// \brief A declaration is marked as OpenMP threadprivate which was not
110  /// previously marked as threadprivate.
111  ///
112  /// \param D the declaration marked OpenMP threadprivate.
113  virtual void DeclarationMarkedOpenMPThreadPrivate(const Decl *D) {}
114 
115  /// \brief A declaration is marked as OpenMP declaretarget which was not
116  /// previously marked as declaretarget.
117  ///
118  /// \param D the declaration marked OpenMP declaretarget.
119  /// \param Attr the added attribute.
121  const Attr *Attr) {}
122 
123  /// \brief A definition has been made visible by being redefined locally.
124  ///
125  /// \param D The definition that was previously not visible.
126  /// \param M The containing module in which the definition was made visible,
127  /// if any.
128  virtual void RedefinedHiddenDefinition(const NamedDecl *D, Module *M) {}
129 
130  /// \brief An attribute was added to a RecordDecl
131  ///
132  /// \param Attr The attribute that was added to the Record
133  ///
134  /// \param Record The RecordDecl that got a new attribute
135  virtual void AddedAttributeToRecord(const Attr *Attr,
136  const RecordDecl *Record) {}
137 
138  // NOTE: If new methods are added they should also be added to
139  // MultiplexASTMutationListener.
140 };
141 
142 } // end namespace clang
143 
144 #endif
FunctionDecl - An instance of this class is created to represent a function declaration or definition...
Definition: Decl.h:1618
A (possibly-)qualified type.
Definition: Type.h:616
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:81
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:758
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:1434
RecordDecl - Represents a struct/union/class.
Definition: Decl.h:3354
Represents a class template specialization, which refers to a class template with a given set of temp...
FieldDecl - An instance of this class is created by Sema::ActOnField to represent a member of a struc...
Definition: Decl.h:2366
Describes a module or submodule.
Definition: Module.h:57
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:1108
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:2551
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:2816
virtual void CompletedTagDefinition(const TagDecl *D)
A new TagDecl definition was completed.
ObjCCategoryDecl - Represents a category declaration.
Definition: DeclObjC.h:2189
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:1215
virtual void AddedCXXImplicitMember(const CXXRecordDecl *RD, const Decl *D)
An implicit member was added after the definition was completed.
virtual void DefaultMemberInitializerInstantiated(const FieldDecl *D)
A default member initializer was instantiated.
Represents a C++ struct/union/class.
Definition: DeclCXX.h:267
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:939
Attr - This represents one attribute.
Definition: Attr.h:43