clang API Documentation

SelectorMap.h
Go to the documentation of this file.
00001 //===--- SelectorMap.h - Maps selectors to methods and messages -*- C++ -*-===//
00002 //
00003 //                     The LLVM Compiler Infrastructure
00004 //
00005 // This file is distributed under the University of Illinois Open Source
00006 // License. See LICENSE.TXT for details.
00007 //
00008 //===----------------------------------------------------------------------===//
00009 //
00010 //  SelectorMap creates a mapping from selectors to ObjC method declarations
00011 //  and ObjC message expressions.
00012 //
00013 //===----------------------------------------------------------------------===//
00014 
00015 #ifndef LLVM_CLANG_INDEX_SELECTORMAP_H
00016 #define LLVM_CLANG_INDEX_SELECTORMAP_H
00017 
00018 #include "clang/Index/ASTLocation.h"
00019 #include "clang/Index/STLExtras.h"
00020 #include "clang/Basic/IdentifierTable.h"
00021 #include <map>
00022 
00023 namespace clang {
00024   class ASTContext;
00025   class ObjCMethodDecl;
00026 
00027 namespace idx {
00028 
00029 /// \brief Maps NamedDecls with the ASTLocations that reference them.
00030 ///
00031 /// References are mapped and retrieved using the canonical decls.
00032 class SelectorMap {
00033 public:
00034   explicit SelectorMap(ASTContext &Ctx);
00035 
00036   typedef std::multimap<Selector, ObjCMethodDecl *> SelMethMapTy;
00037   typedef std::multimap<Selector, ASTLocation> SelRefMapTy;
00038 
00039   typedef pair_value_iterator<SelMethMapTy::iterator> method_iterator;
00040   typedef pair_value_iterator<SelRefMapTy::iterator> astlocation_iterator;
00041 
00042   method_iterator methods_begin(Selector Sel) const;
00043   method_iterator methods_end(Selector Sel) const;
00044 
00045   astlocation_iterator refs_begin(Selector Sel) const;
00046   astlocation_iterator refs_end(Selector Sel) const;
00047 
00048 private:
00049   mutable SelMethMapTy SelMethMap;
00050   mutable SelRefMapTy SelRefMap;
00051 };
00052 
00053 } // end idx namespace
00054 
00055 } // end clang namespace
00056 
00057 #endif