clang 22.0.0git
ASTMutationListener.h
Go to the documentation of this file.
1//===--- ASTMutationListener.h - AST Mutation Interface --------*- C++ -*-===//
2//
3// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4// See https://llvm.org/LICENSE.txt for license information.
5// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
6//
7//===----------------------------------------------------------------------===//
8//
9// This file defines the ASTMutationListener interface.
10//
11//===----------------------------------------------------------------------===//
12#ifndef LLVM_CLANG_AST_ASTMUTATIONLISTENER_H
13#define LLVM_CLANG_AST_ASTMUTATIONLISTENER_H
14
15namespace clang {
16 class Attr;
21 class CXXRecordDecl;
22 class Decl;
23 class DeclContext;
24 class Expr;
25 class FieldDecl;
26 class FunctionDecl;
28 class Module;
29 class NamedDecl;
30 class NamespaceDecl;
31 class ObjCCategoryDecl;
34 class ObjCPropertyDecl;
35 class ParmVarDecl;
36 class QualType;
37 class RecordDecl;
38 class TagDecl;
40 class ValueDecl;
41 class VarDecl;
42 class VarTemplateDecl;
44
45/// An abstract interface that should be implemented by listeners
46/// that want to be notified when an AST entity gets modified after its
47/// initial creation.
49public:
51
52 /// A new TagDecl definition was completed.
53 virtual void CompletedTagDefinition(const TagDecl *D) { }
54
55 /// A new declaration with name has been added to a DeclContext.
56 virtual void AddedVisibleDecl(const DeclContext *DC, const Decl *D) {}
57
58 /// An implicit member was added after the definition was completed.
59 virtual void AddedCXXImplicitMember(const CXXRecordDecl *RD, const Decl *D) {}
60
61 /// A template specialization (or partial one) was added to the
62 /// template declaration.
65
66 /// A template specialization (or partial one) was added to the
67 /// template declaration.
68 virtual void
71
72 /// A template specialization (or partial one) was added to the
73 /// template declaration.
75 const FunctionDecl *D) {}
76
77 /// A function's exception specification has been evaluated or
78 /// instantiated.
79 virtual void ResolvedExceptionSpec(const FunctionDecl *FD) {}
80
81 /// A function's return type has been deduced.
82 virtual void DeducedReturnType(const FunctionDecl *FD, QualType ReturnType);
83
84 /// A virtual destructor's operator delete has been resolved.
86 const FunctionDecl *Delete,
87 Expr *ThisArg) {}
88
89 /// A virtual destructor's operator global delete has been resolved.
91 const FunctionDecl *GlobDelete) {}
92
93 /// A virtual destructor's operator array delete has been resolved.
95 const FunctionDecl *ArrayDelete) {}
96
97 /// A virtual destructor's operator global array delete has been resolved.
98 virtual void
100 const FunctionDecl *GlobArrayDelete) {}
101
102 /// An implicit member got a definition.
104
105 /// The instantiation of a templated function or variable was
106 /// requested. In particular, the point of instantiation and template
107 /// specialization kind of \p D may have changed.
108 virtual void InstantiationRequested(const ValueDecl *D) {}
109
110 /// A templated variable's definition was implicitly instantiated.
111 virtual void VariableDefinitionInstantiated(const VarDecl *D) {}
112
113 /// A function template's definition was instantiated.
115
116 /// A default argument was instantiated.
117 virtual void DefaultArgumentInstantiated(const ParmVarDecl *D) {}
118
119 /// A default member initializer was instantiated.
121
122 /// A new objc category class was added for an interface.
124 const ObjCInterfaceDecl *IFD) {}
125
126 /// A declaration is marked used which was not previously marked used.
127 ///
128 /// \param D the declaration marked used
129 virtual void DeclarationMarkedUsed(const Decl *D) {}
130
131 /// A declaration is marked as OpenMP threadprivate which was not
132 /// previously marked as threadprivate.
133 ///
134 /// \param D the declaration marked OpenMP threadprivate.
136
137 /// A declaration is marked as OpenMP groupprivate which was not
138 /// previously marked as groupprivate.
139 ///
140 /// \param D the declaration marked OpenMP groupprivate.
142
143 /// A declaration is marked as OpenMP declaretarget which was not
144 /// previously marked as declaretarget.
145 ///
146 /// \param D the declaration marked OpenMP declaretarget.
147 /// \param Attr the added attribute.
149 const Attr *Attr) {}
150
151 /// A declaration is marked as a variable with OpenMP allocator.
152 ///
153 /// \param D the declaration marked as a variable with OpenMP allocator.
154 virtual void DeclarationMarkedOpenMPAllocate(const Decl *D, const Attr *A) {}
155
156 /// A definition has been made visible by being redefined locally.
157 ///
158 /// \param D The definition that was previously not visible.
159 /// \param M The containing module in which the definition was made visible,
160 /// if any.
161 virtual void RedefinedHiddenDefinition(const NamedDecl *D, Module *M) {}
162
163 /// An attribute was added to a RecordDecl
164 ///
165 /// \param Attr The attribute that was added to the Record
166 ///
167 /// \param Record The RecordDecl that got a new attribute
168 virtual void AddedAttributeToRecord(const Attr *Attr,
169 const RecordDecl *Record) {}
170
171 /// The parser find the named module declaration.
172 virtual void EnteringModulePurview() {}
173
174 /// An mangling number was added to a Decl
175 ///
176 /// \param D The decl that got a mangling number
177 ///
178 /// \param Number The mangling number that was added to the Decl
179 virtual void AddedManglingNumber(const Decl *D, unsigned Number) {}
180
181 /// An static local number was added to a Decl
182 ///
183 /// \param D The decl that got a static local number
184 ///
185 /// \param Number The static local number that was added to the Decl
186 virtual void AddedStaticLocalNumbers(const Decl *D, unsigned Number) {}
187
188 /// An anonymous namespace was added the translation unit decl
189 ///
190 /// \param TU The translation unit decl that got a new anonymous namespace
191 ///
192 /// \param AnonNamespace The anonymous namespace that was added
194 NamespaceDecl *AnonNamespace) {}
195
196 // NOTE: If new methods are added they should also be added to
197 // MultiplexASTMutationListener.
198};
199
200} // end namespace clang
201
202#endif
llvm::MachO::Record Record
Definition MachO.h:31
An abstract interface that should be implemented by listeners that want to be notified when an AST en...
virtual void DeclarationMarkedOpenMPThreadPrivate(const Decl *D)
A declaration is marked as OpenMP threadprivate which was not previously marked as threadprivate.
virtual void ResolvedOperatorGlobArrayDelete(const CXXDestructorDecl *DD, const FunctionDecl *GlobArrayDelete)
A virtual destructor's operator global array delete has been resolved.
virtual void AddedCXXTemplateSpecialization(const VarTemplateDecl *TD, const VarTemplateSpecializationDecl *D)
A template specialization (or partial one) was added to the template declaration.
virtual void EnteringModulePurview()
The parser find the named module declaration.
virtual void DefaultArgumentInstantiated(const ParmVarDecl *D)
A default argument was instantiated.
virtual void AddedStaticLocalNumbers(const Decl *D, unsigned Number)
An static local number was added to a Decl.
virtual void VariableDefinitionInstantiated(const VarDecl *D)
A templated variable's definition was implicitly instantiated.
virtual void ResolvedExceptionSpec(const FunctionDecl *FD)
A function's exception specification has been evaluated or instantiated.
virtual void ResolvedOperatorDelete(const CXXDestructorDecl *DD, const FunctionDecl *Delete, Expr *ThisArg)
A virtual destructor's operator delete has been resolved.
virtual void AddedObjCCategoryToInterface(const ObjCCategoryDecl *CatD, const ObjCInterfaceDecl *IFD)
A new objc category class was added for an interface.
virtual void DeclarationMarkedUsed(const Decl *D)
A declaration is marked used which was not previously marked used.
virtual void RedefinedHiddenDefinition(const NamedDecl *D, Module *M)
A definition has been made visible by being redefined locally.
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 CompletedTagDefinition(const TagDecl *D)
A new TagDecl definition was completed.
virtual void DeclarationMarkedOpenMPGroupPrivate(const Decl *D)
A declaration is marked as OpenMP groupprivate which was not previously marked as groupprivate.
virtual void AddedManglingNumber(const Decl *D, unsigned Number)
An mangling number was added to a Decl.
virtual void DeclarationMarkedOpenMPAllocate(const Decl *D, const Attr *A)
A declaration is marked as a variable with OpenMP allocator.
virtual void AddedVisibleDecl(const DeclContext *DC, const Decl *D)
A new declaration with name has been added to a DeclContext.
virtual void DefaultMemberInitializerInstantiated(const FieldDecl *D)
A default member initializer was instantiated.
virtual void AddedCXXImplicitMember(const CXXRecordDecl *RD, const Decl *D)
An implicit member was added after the definition was completed.
virtual void FunctionDefinitionInstantiated(const FunctionDecl *D)
A function template's definition was instantiated.
virtual void ResolvedOperatorGlobDelete(const CXXDestructorDecl *DD, const FunctionDecl *GlobDelete)
A virtual destructor's operator global delete has been resolved.
virtual void DeducedReturnType(const FunctionDecl *FD, QualType ReturnType)
A function's return type has been deduced.
virtual void ResolvedOperatorArrayDelete(const CXXDestructorDecl *DD, const FunctionDecl *ArrayDelete)
A virtual destructor's operator array delete has been resolved.
virtual void AddedAttributeToRecord(const Attr *Attr, const RecordDecl *Record)
An attribute was added to a RecordDecl.
virtual void InstantiationRequested(const ValueDecl *D)
The instantiation of a templated function or variable was requested.
virtual void AddedCXXTemplateSpecialization(const FunctionTemplateDecl *TD, const FunctionDecl *D)
A template specialization (or partial one) was added to the template declaration.
virtual void AddedCXXTemplateSpecialization(const ClassTemplateDecl *TD, const ClassTemplateSpecializationDecl *D)
A template specialization (or partial one) was added to the template declaration.
virtual void CompletedImplicitDefinition(const FunctionDecl *D)
An implicit member got a definition.
virtual void AddedAnonymousNamespace(const TranslationUnitDecl *TU, NamespaceDecl *AnonNamespace)
An anonymous namespace was added the translation unit decl.
Attr - This represents one attribute.
Definition Attr.h:45
Represents a C++ destructor within a class.
Definition DeclCXX.h:2869
Represents a C++ struct/union/class.
Definition DeclCXX.h:258
Declaration of a class template.
Represents a class template specialization, which refers to a class template with a given set of temp...
Represents a shadow constructor declaration introduced into a class by a C++11 using-declaration that...
Definition DeclCXX.h:3673
DeclContext - This is used only as base class of specific decl types that can act as declaration cont...
Definition DeclBase.h:1449
Decl - This represents one declaration (or definition), e.g.
Definition DeclBase.h:86
This represents one expression.
Definition Expr.h:112
Represents a member of a struct/union/class.
Definition Decl.h:3160
Represents a function declaration or definition.
Definition Decl.h:2000
Declaration of a template function.
Describes a module or submodule.
Definition Module.h:144
This represents a decl that may have a name.
Definition Decl.h:274
Represent a C++ namespace.
Definition Decl.h:592
ObjCCategoryDecl - Represents a category declaration.
Definition DeclObjC.h:2329
ObjCContainerDecl - Represents a container for method declarations.
Definition DeclObjC.h:948
Represents an ObjC class declaration.
Definition DeclObjC.h:1154
Represents one property declaration in an Objective-C interface.
Definition DeclObjC.h:731
Represents a parameter to a function.
Definition Decl.h:1790
A (possibly-)qualified type.
Definition TypeBase.h:937
Represents a struct/union/class.
Definition Decl.h:4321
Represents the declaration of a struct/union/class/enum.
Definition Decl.h:3717
The top declaration context.
Definition Decl.h:105
Represent the declaration of a variable (in which case it is an lvalue) a function (in which case it ...
Definition Decl.h:712
Represents a variable declaration or definition.
Definition Decl.h:926
Declaration of a variable template.
Represents a variable template specialization, which refers to a variable template with a given set o...
The JSON file list parser is used to communicate input to InstallAPI.
@ Delete
'delete' clause, allowed on the 'exit data' construct.