clang  6.0.0svn
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 Expr;
26  class FieldDecl;
27  class FunctionDecl;
28  class FunctionTemplateDecl;
29  class Module;
30  class NamedDecl;
31  class ObjCCategoryDecl;
32  class ObjCContainerDecl;
33  class ObjCInterfaceDecl;
34  class ObjCPropertyDecl;
35  class ParmVarDecl;
36  class QualType;
37  class RecordDecl;
38  class TagDecl;
39  class ValueDecl;
40  class VarDecl;
41  class VarTemplateDecl;
42  class VarTemplateSpecializationDecl;
43 
44 /// \brief An abstract interface that should be implemented by listeners
45 /// that want to be notified when an AST entity gets modified after its
46 /// initial creation.
48 public:
49  virtual ~ASTMutationListener();
50 
51  /// \brief A new TagDecl definition was completed.
52  virtual void CompletedTagDefinition(const TagDecl *D) { }
53 
54  /// \brief A new declaration with name has been added to a DeclContext.
55  virtual void AddedVisibleDecl(const DeclContext *DC, const Decl *D) {}
56 
57  /// \brief An implicit member was added after the definition was completed.
58  virtual void AddedCXXImplicitMember(const CXXRecordDecl *RD, const Decl *D) {}
59 
60  /// \brief A template specialization (or partial one) was added to the
61  /// template declaration.
64 
65  /// \brief A template specialization (or partial one) was added to the
66  /// template declaration.
67  virtual void
70 
71  /// \brief A template specialization (or partial one) was added to the
72  /// template declaration.
74  const FunctionDecl *D) {}
75 
76  /// \brief A function's exception specification has been evaluated or
77  /// instantiated.
78  virtual void ResolvedExceptionSpec(const FunctionDecl *FD) {}
79 
80  /// \brief A function's return type has been deduced.
81  virtual void DeducedReturnType(const FunctionDecl *FD, QualType ReturnType);
82 
83  /// \brief A virtual destructor's operator delete has been resolved.
84  virtual void ResolvedOperatorDelete(const CXXDestructorDecl *DD,
85  const FunctionDecl *Delete,
86  Expr *ThisArg) {}
87 
88  /// \brief An implicit member got a definition.
89  virtual void CompletedImplicitDefinition(const FunctionDecl *D) {}
90 
91  /// \brief The instantiation of a templated function or variable was
92  /// requested. In particular, the point of instantiation and template
93  /// specialization kind of \p D may have changed.
94  virtual void InstantiationRequested(const ValueDecl *D) {}
95 
96  /// \brief A templated variable's definition was implicitly instantiated.
97  virtual void VariableDefinitionInstantiated(const VarDecl *D) {}
98 
99  /// \brief A function template's definition was instantiated.
101 
102  /// \brief A default argument was instantiated.
103  virtual void DefaultArgumentInstantiated(const ParmVarDecl *D) {}
104 
105  /// \brief A default member initializer was instantiated.
107 
108  /// \brief A new objc category class was added for an interface.
110  const ObjCInterfaceDecl *IFD) {}
111 
112  /// \brief A declaration is marked used which was not previously marked used.
113  ///
114  /// \param D the declaration marked used
115  virtual void DeclarationMarkedUsed(const Decl *D) {}
116 
117  /// \brief A declaration is marked as OpenMP threadprivate which was not
118  /// previously marked as threadprivate.
119  ///
120  /// \param D the declaration marked OpenMP threadprivate.
121  virtual void DeclarationMarkedOpenMPThreadPrivate(const Decl *D) {}
122 
123  /// \brief A declaration is marked as OpenMP declaretarget which was not
124  /// previously marked as declaretarget.
125  ///
126  /// \param D the declaration marked OpenMP declaretarget.
127  /// \param Attr the added attribute.
129  const Attr *Attr) {}
130 
131  /// \brief A definition has been made visible by being redefined locally.
132  ///
133  /// \param D The definition that was previously not visible.
134  /// \param M The containing module in which the definition was made visible,
135  /// if any.
136  virtual void RedefinedHiddenDefinition(const NamedDecl *D, Module *M) {}
137 
138  /// \brief An attribute was added to a RecordDecl
139  ///
140  /// \param Attr The attribute that was added to the Record
141  ///
142  /// \param Record The RecordDecl that got a new attribute
143  virtual void AddedAttributeToRecord(const Attr *Attr,
144  const RecordDecl *Record) {}
145 
146  // NOTE: If new methods are added they should also be added to
147  // MultiplexASTMutationListener.
148 };
149 
150 } // end namespace clang
151 
152 #endif
An instance of this class is created to represent a function declaration or definition.
Definition: Decl.h:1697
A (possibly-)qualified type.
Definition: Type.h:653
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:86
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:806
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:1513
RecordDecl - Represents a struct/union/class.
Definition: Decl.h:3478
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:2457
Describes a module or submodule.
Definition: Module.h:65
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:1191
virtual void InstantiationRequested(const ValueDecl *D)
The instantiation of a templated function or variable was requested.
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. ...
ValueDecl - Represent the declaration of a variable (in which case it is an lvalue) a function (in wh...
Definition: Decl.h:627
Expr - This represents one expression.
Definition: Expr.h:106
virtual void FunctionDefinitionInstantiated(const FunctionDecl *D)
A function template's definition was instantiated.
Represents a C++ destructor within a class.
Definition: DeclCXX.h:2620
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 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:2934
virtual void CompletedTagDefinition(const TagDecl *D)
A new TagDecl definition was completed.
ObjCCategoryDecl - Represents a category declaration.
Definition: DeclObjC.h:2299
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. ...
Dataflow Directional Tag Classes.
DeclContext - This is used only as base class of specific decl types that can act as declaration cont...
Definition: DeclBase.h:1252
virtual void ResolvedOperatorDelete(const CXXDestructorDecl *DD, const FunctionDecl *Delete, Expr *ThisArg)
A virtual destructor's operator delete has been resolved.
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:299
virtual void VariableDefinitionInstantiated(const VarDecl *D)
A templated variable's definition was implicitly instantiated.
Declaration of a class template.
NamedDecl - This represents a decl with a name.
Definition: Decl.h:245
Declaration of a template function.
Definition: DeclTemplate.h:967
Attr - This represents one attribute.
Definition: Attr.h:43