1 //===--- SelectorMap.h - Maps selectors to methods and messages -*- 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 // SelectorMap creates a mapping from selectors to ObjC method declarations 11 // and ObjC message expressions. 12 // 13 //===----------------------------------------------------------------------===// 14 15 #ifndef LLVM_CLANG_INDEX_SELECTORMAP_H 16 #define LLVM_CLANG_INDEX_SELECTORMAP_H 17 18 #include "clang/Index/ASTLocation.h" 19 #include "clang/Index/STLExtras.h" 20 #include "clang/Basic/IdentifierTable.h" 21 #include <map> 22 23 namespace clang { 24 class ASTContext; 25 class ObjCMethodDecl; 26 27 namespace idx { 28 29 /// \brief Maps NamedDecls with the ASTLocations that reference them. 30 /// 31 /// References are mapped and retrieved using the canonical decls. 32 class SelectorMap { 33 public: 34 explicit SelectorMap(ASTContext &Ctx); 35 36 typedef std::multimap<Selector, ObjCMethodDecl *> SelMethMapTy; 37 typedef std::multimap<Selector, ASTLocation> SelRefMapTy; 38 39 typedef pair_value_iterator<SelMethMapTy::iterator> method_iterator; 40 typedef pair_value_iterator<SelRefMapTy::iterator> astlocation_iterator; 41 42 method_iterator methods_begin(Selector Sel) const; 43 method_iterator methods_end(Selector Sel) const; 44 45 astlocation_iterator refs_begin(Selector Sel) const; 46 astlocation_iterator refs_end(Selector Sel) const; 47 48 private: 49 mutable SelMethMapTy SelMethMap; 50 mutable SelRefMapTy SelRefMap; 51 }; 52 53 } // end idx namespace 54 55 } // end clang namespace 56 57 #endif 58