Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2026-05-10 08:36:28

0001 //===--- ASTMutationListener.h - AST Mutation Interface --------*- C++ -*-===//
0002 //
0003 // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
0004 // See https://llvm.org/LICENSE.txt for license information.
0005 // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
0006 //
0007 //===----------------------------------------------------------------------===//
0008 //
0009 //  This file defines the ASTMutationListener interface.
0010 //
0011 //===----------------------------------------------------------------------===//
0012 #ifndef LLVM_CLANG_AST_ASTMUTATIONLISTENER_H
0013 #define LLVM_CLANG_AST_ASTMUTATIONLISTENER_H
0014 
0015 namespace clang {
0016   class Attr;
0017   class ClassTemplateDecl;
0018   class ClassTemplateSpecializationDecl;
0019   class ConstructorUsingShadowDecl;
0020   class CXXDestructorDecl;
0021   class CXXRecordDecl;
0022   class Decl;
0023   class DeclContext;
0024   class Expr;
0025   class FieldDecl;
0026   class FunctionDecl;
0027   class FunctionTemplateDecl;
0028   class Module;
0029   class NamedDecl;
0030   class NamespaceDecl;
0031   class ObjCCategoryDecl;
0032   class ObjCContainerDecl;
0033   class ObjCInterfaceDecl;
0034   class ObjCPropertyDecl;
0035   class ParmVarDecl;
0036   class QualType;
0037   class RecordDecl;
0038   class TagDecl;
0039   class TranslationUnitDecl;
0040   class ValueDecl;
0041   class VarDecl;
0042   class VarTemplateDecl;
0043   class VarTemplateSpecializationDecl;
0044 
0045 /// An abstract interface that should be implemented by listeners
0046 /// that want to be notified when an AST entity gets modified after its
0047 /// initial creation.
0048 class ASTMutationListener {
0049 public:
0050   virtual ~ASTMutationListener();
0051 
0052   /// A new TagDecl definition was completed.
0053   virtual void CompletedTagDefinition(const TagDecl *D) { }
0054 
0055   /// A new declaration with name has been added to a DeclContext.
0056   virtual void AddedVisibleDecl(const DeclContext *DC, const Decl *D) {}
0057 
0058   /// An implicit member was added after the definition was completed.
0059   virtual void AddedCXXImplicitMember(const CXXRecordDecl *RD, const Decl *D) {}
0060 
0061   /// A template specialization (or partial one) was added to the
0062   /// template declaration.
0063   virtual void AddedCXXTemplateSpecialization(const ClassTemplateDecl *TD,
0064                                     const ClassTemplateSpecializationDecl *D) {}
0065 
0066   /// A template specialization (or partial one) was added to the
0067   /// template declaration.
0068   virtual void
0069   AddedCXXTemplateSpecialization(const VarTemplateDecl *TD,
0070                                  const VarTemplateSpecializationDecl *D) {}
0071 
0072   /// A template specialization (or partial one) was added to the
0073   /// template declaration.
0074   virtual void AddedCXXTemplateSpecialization(const FunctionTemplateDecl *TD,
0075                                               const FunctionDecl *D) {}
0076 
0077   /// A function's exception specification has been evaluated or
0078   /// instantiated.
0079   virtual void ResolvedExceptionSpec(const FunctionDecl *FD) {}
0080 
0081   /// A function's return type has been deduced.
0082   virtual void DeducedReturnType(const FunctionDecl *FD, QualType ReturnType);
0083 
0084   /// A virtual destructor's operator delete has been resolved.
0085   virtual void ResolvedOperatorDelete(const CXXDestructorDecl *DD,
0086                                       const FunctionDecl *Delete,
0087                                       Expr *ThisArg) {}
0088 
0089   /// An implicit member got a definition.
0090   virtual void CompletedImplicitDefinition(const FunctionDecl *D) {}
0091 
0092   /// The instantiation of a templated function or variable was
0093   /// requested. In particular, the point of instantiation and template
0094   /// specialization kind of \p D may have changed.
0095   virtual void InstantiationRequested(const ValueDecl *D) {}
0096 
0097   /// A templated variable's definition was implicitly instantiated.
0098   virtual void VariableDefinitionInstantiated(const VarDecl *D) {}
0099 
0100   /// A function template's definition was instantiated.
0101   virtual void FunctionDefinitionInstantiated(const FunctionDecl *D) {}
0102 
0103   /// A default argument was instantiated.
0104   virtual void DefaultArgumentInstantiated(const ParmVarDecl *D) {}
0105 
0106   /// A default member initializer was instantiated.
0107   virtual void DefaultMemberInitializerInstantiated(const FieldDecl *D) {}
0108 
0109   /// A new objc category class was added for an interface.
0110   virtual void AddedObjCCategoryToInterface(const ObjCCategoryDecl *CatD,
0111                                             const ObjCInterfaceDecl *IFD) {}
0112 
0113   /// A declaration is marked used which was not previously marked used.
0114   ///
0115   /// \param D the declaration marked used
0116   virtual void DeclarationMarkedUsed(const Decl *D) {}
0117 
0118   /// A declaration is marked as OpenMP threadprivate which was not
0119   /// previously marked as threadprivate.
0120   ///
0121   /// \param D the declaration marked OpenMP threadprivate.
0122   virtual void DeclarationMarkedOpenMPThreadPrivate(const Decl *D) {}
0123 
0124   /// A declaration is marked as OpenMP declaretarget which was not
0125   /// previously marked as declaretarget.
0126   ///
0127   /// \param D the declaration marked OpenMP declaretarget.
0128   /// \param Attr the added attribute.
0129   virtual void DeclarationMarkedOpenMPDeclareTarget(const Decl *D,
0130                                                     const Attr *Attr) {}
0131 
0132   /// A declaration is marked as a variable with OpenMP allocator.
0133   ///
0134   /// \param D the declaration marked as a variable with OpenMP allocator.
0135   virtual void DeclarationMarkedOpenMPAllocate(const Decl *D, const Attr *A) {}
0136 
0137   /// A definition has been made visible by being redefined locally.
0138   ///
0139   /// \param D The definition that was previously not visible.
0140   /// \param M The containing module in which the definition was made visible,
0141   ///        if any.
0142   virtual void RedefinedHiddenDefinition(const NamedDecl *D, Module *M) {}
0143 
0144   /// An attribute was added to a RecordDecl
0145   ///
0146   /// \param Attr The attribute that was added to the Record
0147   ///
0148   /// \param Record The RecordDecl that got a new attribute
0149   virtual void AddedAttributeToRecord(const Attr *Attr,
0150                                       const RecordDecl *Record) {}
0151 
0152   /// The parser find the named module declaration.
0153   virtual void EnteringModulePurview() {}
0154 
0155   /// An mangling number was added to a Decl
0156   ///
0157   /// \param D The decl that got a mangling number
0158   ///
0159   /// \param Number The mangling number that was added to the Decl
0160   virtual void AddedManglingNumber(const Decl *D, unsigned Number) {}
0161 
0162   /// An static local number was added to a Decl
0163   ///
0164   /// \param D The decl that got a static local number
0165   ///
0166   /// \param Number The static local number that was added to the Decl
0167   virtual void AddedStaticLocalNumbers(const Decl *D, unsigned Number) {}
0168 
0169   /// An anonymous namespace was added the translation unit decl
0170   ///
0171   /// \param TU The translation unit decl that got a new anonymous namespace
0172   ///
0173   /// \param AnonNamespace The anonymous namespace that was added
0174   virtual void AddedAnonymousNamespace(const TranslationUnitDecl *TU,
0175                                        NamespaceDecl *AnonNamespace) {}
0176 
0177   // NOTE: If new methods are added they should also be added to
0178   // MultiplexASTMutationListener.
0179 };
0180 
0181 } // end namespace clang
0182 
0183 #endif