17b90340c9c7d07aef4e301e72b5e8a30d5f4f0c8Argyrios Kyrtzidis//===--- ASTMutationListener.h - AST Mutation Interface --------*- C++ -*-===// 27b90340c9c7d07aef4e301e72b5e8a30d5f4f0c8Argyrios Kyrtzidis// 37b90340c9c7d07aef4e301e72b5e8a30d5f4f0c8Argyrios Kyrtzidis// The LLVM Compiler Infrastructure 47b90340c9c7d07aef4e301e72b5e8a30d5f4f0c8Argyrios Kyrtzidis// 57b90340c9c7d07aef4e301e72b5e8a30d5f4f0c8Argyrios Kyrtzidis// This file is distributed under the University of Illinois Open Source 67b90340c9c7d07aef4e301e72b5e8a30d5f4f0c8Argyrios Kyrtzidis// License. See LICENSE.TXT for details. 77b90340c9c7d07aef4e301e72b5e8a30d5f4f0c8Argyrios Kyrtzidis// 87b90340c9c7d07aef4e301e72b5e8a30d5f4f0c8Argyrios Kyrtzidis//===----------------------------------------------------------------------===// 97b90340c9c7d07aef4e301e72b5e8a30d5f4f0c8Argyrios Kyrtzidis// 107b90340c9c7d07aef4e301e72b5e8a30d5f4f0c8Argyrios Kyrtzidis// This file defines the ASTMutationListener interface. 117b90340c9c7d07aef4e301e72b5e8a30d5f4f0c8Argyrios Kyrtzidis// 127b90340c9c7d07aef4e301e72b5e8a30d5f4f0c8Argyrios Kyrtzidis//===----------------------------------------------------------------------===// 137b90340c9c7d07aef4e301e72b5e8a30d5f4f0c8Argyrios Kyrtzidis#ifndef LLVM_CLANG_AST_ASTMUTATIONLISTENER_H 147b90340c9c7d07aef4e301e72b5e8a30d5f4f0c8Argyrios Kyrtzidis#define LLVM_CLANG_AST_ASTMUTATIONLISTENER_H 157b90340c9c7d07aef4e301e72b5e8a30d5f4f0c8Argyrios Kyrtzidis 16a8235d6c4093cd38dcf742909651f867de62e55bDouglas Gregor#include "clang/Basic/SourceLocation.h" 17a8235d6c4093cd38dcf742909651f867de62e55bDouglas Gregor 187b90340c9c7d07aef4e301e72b5e8a30d5f4f0c8Argyrios Kyrtzidisnamespace clang { 19bef1a7b9c175d37e4a727e6ce68bd05232fa6970Argyrios Kyrtzidis class ClassTemplateDecl; 20bef1a7b9c175d37e4a727e6ce68bd05232fa6970Argyrios Kyrtzidis class ClassTemplateSpecializationDecl; 213ea9e33ea25e0c2b12db56418ba3f994eb662c04Pirama Arumuga Nainar class CXXDestructorDecl; 223ea9e33ea25e0c2b12db56418ba3f994eb662c04Pirama Arumuga Nainar class CXXRecordDecl; 232fa67efeaf66a9332c30a026dc1c21bef6c33a6cBenjamin Kramer class Decl; 242fa67efeaf66a9332c30a026dc1c21bef6c33a6cBenjamin Kramer class DeclContext; 255bbcdbf36f8cf79d99703ef20848c55960065e43Sebastian Redl class FunctionDecl; 265bbcdbf36f8cf79d99703ef20848c55960065e43Sebastian Redl class FunctionTemplateDecl; 273ea9e33ea25e0c2b12db56418ba3f994eb662c04Pirama Arumuga Nainar class NamedDecl; 28e6b8d68a927368b06ac06cc9ac9e7f60aa966d5fArgyrios Kyrtzidis class ObjCCategoryDecl; 29ad834d534e9a5db3d3baa09593775f83ceaff1f2Argyrios Kyrtzidis class ObjCContainerDecl; 302fa67efeaf66a9332c30a026dc1c21bef6c33a6cBenjamin Kramer class ObjCInterfaceDecl; 31c80553efdc269dabd4ed0c3210555f45729ab5ddArgyrios Kyrtzidis class ObjCPropertyDecl; 329dadfab2faebe40e7dbbfd0801c15174b69bd726Richard Smith class QualType; 332fa67efeaf66a9332c30a026dc1c21bef6c33a6cBenjamin Kramer class TagDecl; 342fa67efeaf66a9332c30a026dc1c21bef6c33a6cBenjamin Kramer class VarDecl; 35ef4579cda09b73e3d4d98af48201da25adc29326Larisse Voufo class VarTemplateDecl; 36ef4579cda09b73e3d4d98af48201da25adc29326Larisse Voufo class VarTemplateSpecializationDecl; 377b90340c9c7d07aef4e301e72b5e8a30d5f4f0c8Argyrios Kyrtzidis 387b90340c9c7d07aef4e301e72b5e8a30d5f4f0c8Argyrios Kyrtzidis/// \brief An abstract interface that should be implemented by listeners 397b90340c9c7d07aef4e301e72b5e8a30d5f4f0c8Argyrios Kyrtzidis/// that want to be notified when an AST entity gets modified after its 407b90340c9c7d07aef4e301e72b5e8a30d5f4f0c8Argyrios Kyrtzidis/// initial creation. 417b90340c9c7d07aef4e301e72b5e8a30d5f4f0c8Argyrios Kyrtzidisclass ASTMutationListener { 427b90340c9c7d07aef4e301e72b5e8a30d5f4f0c8Argyrios Kyrtzidispublic: 437b90340c9c7d07aef4e301e72b5e8a30d5f4f0c8Argyrios Kyrtzidis virtual ~ASTMutationListener(); 44565bf30bf5607b9740d288d8d9c45cf38ea75298Argyrios Kyrtzidis 45565bf30bf5607b9740d288d8d9c45cf38ea75298Argyrios Kyrtzidis /// \brief A new TagDecl definition was completed. 46565bf30bf5607b9740d288d8d9c45cf38ea75298Argyrios Kyrtzidis virtual void CompletedTagDefinition(const TagDecl *D) { } 47b6cc0e1a789c3f33e3f4b1ee768e679a9beab941Argyrios Kyrtzidis 48100050bf643bcfe2d06bdcef491e387171249260Argyrios Kyrtzidis /// \brief A new declaration with name has been added to a DeclContext. 49100050bf643bcfe2d06bdcef491e387171249260Argyrios Kyrtzidis virtual void AddedVisibleDecl(const DeclContext *DC, const Decl *D) {} 50100050bf643bcfe2d06bdcef491e387171249260Argyrios Kyrtzidis 51b6cc0e1a789c3f33e3f4b1ee768e679a9beab941Argyrios Kyrtzidis /// \brief An implicit member was added after the definition was completed. 52b6cc0e1a789c3f33e3f4b1ee768e679a9beab941Argyrios Kyrtzidis virtual void AddedCXXImplicitMember(const CXXRecordDecl *RD, const Decl *D) {} 53bef1a7b9c175d37e4a727e6ce68bd05232fa6970Argyrios Kyrtzidis 54bef1a7b9c175d37e4a727e6ce68bd05232fa6970Argyrios Kyrtzidis /// \brief A template specialization (or partial one) was added to the 55bef1a7b9c175d37e4a727e6ce68bd05232fa6970Argyrios Kyrtzidis /// template declaration. 56bef1a7b9c175d37e4a727e6ce68bd05232fa6970Argyrios Kyrtzidis virtual void AddedCXXTemplateSpecialization(const ClassTemplateDecl *TD, 57bef1a7b9c175d37e4a727e6ce68bd05232fa6970Argyrios Kyrtzidis const ClassTemplateSpecializationDecl *D) {} 585bbcdbf36f8cf79d99703ef20848c55960065e43Sebastian Redl 595bbcdbf36f8cf79d99703ef20848c55960065e43Sebastian Redl /// \brief A template specialization (or partial one) was added to the 605bbcdbf36f8cf79d99703ef20848c55960065e43Sebastian Redl /// template declaration. 61ef4579cda09b73e3d4d98af48201da25adc29326Larisse Voufo virtual void 62ef4579cda09b73e3d4d98af48201da25adc29326Larisse Voufo AddedCXXTemplateSpecialization(const VarTemplateDecl *TD, 63ef4579cda09b73e3d4d98af48201da25adc29326Larisse Voufo const VarTemplateSpecializationDecl *D) {} 64ef4579cda09b73e3d4d98af48201da25adc29326Larisse Voufo 65ef4579cda09b73e3d4d98af48201da25adc29326Larisse Voufo /// \brief A template specialization (or partial one) was added to the 66ef4579cda09b73e3d4d98af48201da25adc29326Larisse Voufo /// template declaration. 675bbcdbf36f8cf79d99703ef20848c55960065e43Sebastian Redl virtual void AddedCXXTemplateSpecialization(const FunctionTemplateDecl *TD, 685bbcdbf36f8cf79d99703ef20848c55960065e43Sebastian Redl const FunctionDecl *D) {} 6958a2cd8c0d52e710cbcc57a67eac7b51b0b831c4Sebastian Redl 70651f13cea278ec967336033dd032faef0e9fc2ecStephen Hines /// \brief A function's exception specification has been evaluated or 71651f13cea278ec967336033dd032faef0e9fc2ecStephen Hines /// instantiated. 72651f13cea278ec967336033dd032faef0e9fc2ecStephen Hines virtual void ResolvedExceptionSpec(const FunctionDecl *FD) {} 73651f13cea278ec967336033dd032faef0e9fc2ecStephen Hines 749dadfab2faebe40e7dbbfd0801c15174b69bd726Richard Smith /// \brief A function's return type has been deduced. 759dadfab2faebe40e7dbbfd0801c15174b69bd726Richard Smith virtual void DeducedReturnType(const FunctionDecl *FD, QualType ReturnType); 769dadfab2faebe40e7dbbfd0801c15174b69bd726Richard Smith 773ea9e33ea25e0c2b12db56418ba3f994eb662c04Pirama Arumuga Nainar /// \brief A virtual destructor's operator delete has been resolved. 783ea9e33ea25e0c2b12db56418ba3f994eb662c04Pirama Arumuga Nainar virtual void ResolvedOperatorDelete(const CXXDestructorDecl *DD, 793ea9e33ea25e0c2b12db56418ba3f994eb662c04Pirama Arumuga Nainar const FunctionDecl *Delete) {} 803ea9e33ea25e0c2b12db56418ba3f994eb662c04Pirama Arumuga Nainar 8158a2cd8c0d52e710cbcc57a67eac7b51b0b831c4Sebastian Redl /// \brief An implicit member got a definition. 8258a2cd8c0d52e710cbcc57a67eac7b51b0b831c4Sebastian Redl virtual void CompletedImplicitDefinition(const FunctionDecl *D) {} 83f79a71908d6f28cb2bc0c081d9a801ed14d61d82Sebastian Redl 84f79a71908d6f28cb2bc0c081d9a801ed14d61d82Sebastian Redl /// \brief A static data member was implicitly instantiated. 85f79a71908d6f28cb2bc0c081d9a801ed14d61d82Sebastian Redl virtual void StaticDataMemberInstantiated(const VarDecl *D) {} 86e6b8d68a927368b06ac06cc9ac9e7f60aa966d5fArgyrios Kyrtzidis 87651f13cea278ec967336033dd032faef0e9fc2ecStephen Hines /// \brief A function template's definition was instantiated. 88651f13cea278ec967336033dd032faef0e9fc2ecStephen Hines virtual void FunctionDefinitionInstantiated(const FunctionDecl *D) {} 89651f13cea278ec967336033dd032faef0e9fc2ecStephen Hines 90e6b8d68a927368b06ac06cc9ac9e7f60aa966d5fArgyrios Kyrtzidis /// \brief A new objc category class was added for an interface. 91e6b8d68a927368b06ac06cc9ac9e7f60aa966d5fArgyrios Kyrtzidis virtual void AddedObjCCategoryToInterface(const ObjCCategoryDecl *CatD, 92e6b8d68a927368b06ac06cc9ac9e7f60aa966d5fArgyrios Kyrtzidis const ObjCInterfaceDecl *IFD) {} 93ad834d534e9a5db3d3baa09593775f83ceaff1f2Argyrios Kyrtzidis 94c80553efdc269dabd4ed0c3210555f45729ab5ddArgyrios Kyrtzidis /// \brief A objc class extension redeclared or introduced a property. 95c80553efdc269dabd4ed0c3210555f45729ab5ddArgyrios Kyrtzidis /// 96c80553efdc269dabd4ed0c3210555f45729ab5ddArgyrios Kyrtzidis /// \param Prop the property in the class extension 97c80553efdc269dabd4ed0c3210555f45729ab5ddArgyrios Kyrtzidis /// 98c80553efdc269dabd4ed0c3210555f45729ab5ddArgyrios Kyrtzidis /// \param OrigProp the property from the original interface that was declared 99c80553efdc269dabd4ed0c3210555f45729ab5ddArgyrios Kyrtzidis /// or null if the property was introduced. 100c80553efdc269dabd4ed0c3210555f45729ab5ddArgyrios Kyrtzidis /// 101c80553efdc269dabd4ed0c3210555f45729ab5ddArgyrios Kyrtzidis /// \param ClassExt the class extension. 102c80553efdc269dabd4ed0c3210555f45729ab5ddArgyrios Kyrtzidis virtual void AddedObjCPropertyInClassExtension(const ObjCPropertyDecl *Prop, 103c80553efdc269dabd4ed0c3210555f45729ab5ddArgyrios Kyrtzidis const ObjCPropertyDecl *OrigProp, 104c80553efdc269dabd4ed0c3210555f45729ab5ddArgyrios Kyrtzidis const ObjCCategoryDecl *ClassExt) {} 1051da95dbf2a341faec43439802b23a4f847baa6adArgyrios Kyrtzidis 10686164e8f51fa89a3ec904607c3848dc4a21b12cfEli Friedman /// \brief A declaration is marked used which was not previously marked used. 10786164e8f51fa89a3ec904607c3848dc4a21b12cfEli Friedman /// 10886164e8f51fa89a3ec904607c3848dc4a21b12cfEli Friedman /// \param D the declaration marked used 10986164e8f51fa89a3ec904607c3848dc4a21b12cfEli Friedman virtual void DeclarationMarkedUsed(const Decl *D) {} 11086164e8f51fa89a3ec904607c3848dc4a21b12cfEli Friedman 111176edba5311f6eff0cad2631449885ddf4fbc9eaStephen Hines /// \brief A declaration is marked as OpenMP threadprivate which was not 112176edba5311f6eff0cad2631449885ddf4fbc9eaStephen Hines /// previously marked as threadprivate. 113176edba5311f6eff0cad2631449885ddf4fbc9eaStephen Hines /// 114176edba5311f6eff0cad2631449885ddf4fbc9eaStephen Hines /// \param D the declaration marked OpenMP threadprivate. 115176edba5311f6eff0cad2631449885ddf4fbc9eaStephen Hines virtual void DeclarationMarkedOpenMPThreadPrivate(const Decl *D) {} 116176edba5311f6eff0cad2631449885ddf4fbc9eaStephen Hines 1173ea9e33ea25e0c2b12db56418ba3f994eb662c04Pirama Arumuga Nainar /// \brief A definition has been made visible by being redefined locally. 1183ea9e33ea25e0c2b12db56418ba3f994eb662c04Pirama Arumuga Nainar /// 1193ea9e33ea25e0c2b12db56418ba3f994eb662c04Pirama Arumuga Nainar /// \param D The definition that was previously not visible. 1203ea9e33ea25e0c2b12db56418ba3f994eb662c04Pirama Arumuga Nainar virtual void RedefinedHiddenDefinition(const NamedDecl *D, 1213ea9e33ea25e0c2b12db56418ba3f994eb662c04Pirama Arumuga Nainar SourceLocation Loc) {} 1223ea9e33ea25e0c2b12db56418ba3f994eb662c04Pirama Arumuga Nainar 1231da95dbf2a341faec43439802b23a4f847baa6adArgyrios Kyrtzidis // NOTE: If new methods are added they should also be added to 1241da95dbf2a341faec43439802b23a4f847baa6adArgyrios Kyrtzidis // MultiplexASTMutationListener. 1257b90340c9c7d07aef4e301e72b5e8a30d5f4f0c8Argyrios Kyrtzidis}; 1267b90340c9c7d07aef4e301e72b5e8a30d5f4f0c8Argyrios Kyrtzidis 1277b90340c9c7d07aef4e301e72b5e8a30d5f4f0c8Argyrios Kyrtzidis} // end namespace clang 1287b90340c9c7d07aef4e301e72b5e8a30d5f4f0c8Argyrios Kyrtzidis 1297b90340c9c7d07aef4e301e72b5e8a30d5f4f0c8Argyrios Kyrtzidis#endif 130