]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/blob - contrib/llvm/tools/clang/include/clang/AST/ASTMutationListener.h
Merge clang 7.0.1 and several follow-up changes
[FreeBSD/FreeBSD.git] / contrib / llvm / tools / clang / include / clang / AST / ASTMutationListener.h
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 /// 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.
47 class ASTMutationListener {
48 public:
49   virtual ~ASTMutationListener();
50
51   /// A new TagDecl definition was completed.
52   virtual void CompletedTagDefinition(const TagDecl *D) { }
53
54   /// A new declaration with name has been added to a DeclContext.
55   virtual void AddedVisibleDecl(const DeclContext *DC, const Decl *D) {}
56
57   /// An implicit member was added after the definition was completed.
58   virtual void AddedCXXImplicitMember(const CXXRecordDecl *RD, const Decl *D) {}
59
60   /// A template specialization (or partial one) was added to the
61   /// template declaration.
62   virtual void AddedCXXTemplateSpecialization(const ClassTemplateDecl *TD,
63                                     const ClassTemplateSpecializationDecl *D) {}
64
65   /// A template specialization (or partial one) was added to the
66   /// template declaration.
67   virtual void
68   AddedCXXTemplateSpecialization(const VarTemplateDecl *TD,
69                                  const VarTemplateSpecializationDecl *D) {}
70
71   /// A template specialization (or partial one) was added to the
72   /// template declaration.
73   virtual void AddedCXXTemplateSpecialization(const FunctionTemplateDecl *TD,
74                                               const FunctionDecl *D) {}
75
76   /// A function's exception specification has been evaluated or
77   /// instantiated.
78   virtual void ResolvedExceptionSpec(const FunctionDecl *FD) {}
79
80   /// A function's return type has been deduced.
81   virtual void DeducedReturnType(const FunctionDecl *FD, QualType ReturnType);
82
83   /// 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   /// An implicit member got a definition.
89   virtual void CompletedImplicitDefinition(const FunctionDecl *D) {}
90
91   /// 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   /// A templated variable's definition was implicitly instantiated.
97   virtual void VariableDefinitionInstantiated(const VarDecl *D) {}
98
99   /// A function template's definition was instantiated.
100   virtual void FunctionDefinitionInstantiated(const FunctionDecl *D) {}
101
102   /// A default argument was instantiated.
103   virtual void DefaultArgumentInstantiated(const ParmVarDecl *D) {}
104
105   /// A default member initializer was instantiated.
106   virtual void DefaultMemberInitializerInstantiated(const FieldDecl *D) {}
107
108   /// A new objc category class was added for an interface.
109   virtual void AddedObjCCategoryToInterface(const ObjCCategoryDecl *CatD,
110                                             const ObjCInterfaceDecl *IFD) {}
111
112   /// 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   /// 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   /// 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.
128   virtual void DeclarationMarkedOpenMPDeclareTarget(const Decl *D,
129                                                     const Attr *Attr) {}
130
131   /// 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   /// 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