1218887Sdim//===--- ASTMutationListener.h - AST Mutation Interface --------*- C++ -*-===//
2218887Sdim//
3218887Sdim//                     The LLVM Compiler Infrastructure
4218887Sdim//
5218887Sdim// This file is distributed under the University of Illinois Open Source
6218887Sdim// License. See LICENSE.TXT for details.
7218887Sdim//
8218887Sdim//===----------------------------------------------------------------------===//
9218887Sdim//
10218887Sdim//  This file defines the ASTMutationListener interface.
11218887Sdim//
12218887Sdim//===----------------------------------------------------------------------===//
13218887Sdim#ifndef LLVM_CLANG_AST_ASTMUTATIONLISTENER_H
14218887Sdim#define LLVM_CLANG_AST_ASTMUTATIONLISTENER_H
15218887Sdim
16243830Sdim#include "clang/Basic/SourceLocation.h"
17243830Sdim
18218887Sdimnamespace clang {
19218887Sdim  class CXXRecordDecl;
20218887Sdim  class ClassTemplateDecl;
21218887Sdim  class ClassTemplateSpecializationDecl;
22249423Sdim  class Decl;
23249423Sdim  class DeclContext;
24221345Sdim  class FunctionDecl;
25221345Sdim  class FunctionTemplateDecl;
26226633Sdim  class ObjCCategoryDecl;
27249423Sdim  class ObjCContainerDecl;
28226633Sdim  class ObjCInterfaceDecl;
29234353Sdim  class ObjCPropertyDecl;
30263508Sdim  class QualType;
31249423Sdim  class TagDecl;
32249423Sdim  class VarDecl;
33263508Sdim  class VarTemplateDecl;
34263508Sdim  class VarTemplateSpecializationDecl;
35218887Sdim
36218887Sdim/// \brief An abstract interface that should be implemented by listeners
37218887Sdim/// that want to be notified when an AST entity gets modified after its
38218887Sdim/// initial creation.
39218887Sdimclass ASTMutationListener {
40218887Sdimpublic:
41218887Sdim  virtual ~ASTMutationListener();
42218887Sdim
43218887Sdim  /// \brief A new TagDecl definition was completed.
44218887Sdim  virtual void CompletedTagDefinition(const TagDecl *D) { }
45218887Sdim
46218887Sdim  /// \brief A new declaration with name has been added to a DeclContext.
47218887Sdim  virtual void AddedVisibleDecl(const DeclContext *DC, const Decl *D) {}
48218887Sdim
49218887Sdim  /// \brief An implicit member was added after the definition was completed.
50218887Sdim  virtual void AddedCXXImplicitMember(const CXXRecordDecl *RD, const Decl *D) {}
51218887Sdim
52218887Sdim  /// \brief A template specialization (or partial one) was added to the
53218887Sdim  /// template declaration.
54218887Sdim  virtual void AddedCXXTemplateSpecialization(const ClassTemplateDecl *TD,
55218887Sdim                                    const ClassTemplateSpecializationDecl *D) {}
56221345Sdim
57221345Sdim  /// \brief A template specialization (or partial one) was added to the
58221345Sdim  /// template declaration.
59263508Sdim  virtual void
60263508Sdim  AddedCXXTemplateSpecialization(const VarTemplateDecl *TD,
61263508Sdim                                 const VarTemplateSpecializationDecl *D) {}
62263508Sdim
63263508Sdim  /// \brief A template specialization (or partial one) was added to the
64263508Sdim  /// template declaration.
65221345Sdim  virtual void AddedCXXTemplateSpecialization(const FunctionTemplateDecl *TD,
66221345Sdim                                              const FunctionDecl *D) {}
67221345Sdim
68263508Sdim  /// \brief A function's return type has been deduced.
69263508Sdim  virtual void DeducedReturnType(const FunctionDecl *FD, QualType ReturnType);
70263508Sdim
71221345Sdim  /// \brief An implicit member got a definition.
72221345Sdim  virtual void CompletedImplicitDefinition(const FunctionDecl *D) {}
73221345Sdim
74221345Sdim  /// \brief A static data member was implicitly instantiated.
75221345Sdim  virtual void StaticDataMemberInstantiated(const VarDecl *D) {}
76226633Sdim
77226633Sdim  /// \brief A new objc category class was added for an interface.
78226633Sdim  virtual void AddedObjCCategoryToInterface(const ObjCCategoryDecl *CatD,
79226633Sdim                                            const ObjCInterfaceDecl *IFD) {}
80234353Sdim
81234353Sdim  /// \brief A objc class extension redeclared or introduced a property.
82234353Sdim  ///
83234353Sdim  /// \param Prop the property in the class extension
84234353Sdim  ///
85234353Sdim  /// \param OrigProp the property from the original interface that was declared
86234353Sdim  /// or null if the property was introduced.
87234353Sdim  ///
88234353Sdim  /// \param ClassExt the class extension.
89234353Sdim  virtual void AddedObjCPropertyInClassExtension(const ObjCPropertyDecl *Prop,
90234353Sdim                                            const ObjCPropertyDecl *OrigProp,
91234353Sdim                                            const ObjCCategoryDecl *ClassExt) {}
92234353Sdim
93263508Sdim  /// \brief A declaration is marked used which was not previously marked used.
94263508Sdim  ///
95263508Sdim  /// \param D the declaration marked used
96263508Sdim  virtual void DeclarationMarkedUsed(const Decl *D) {}
97263508Sdim
98234353Sdim  // NOTE: If new methods are added they should also be added to
99234353Sdim  // MultiplexASTMutationListener.
100218887Sdim};
101218887Sdim
102218887Sdim} // end namespace clang
103218887Sdim
104218887Sdim#endif
105