Jim Ingham | 642036f | 2010-09-23 02:01:19 +0000 | [diff] [blame] | 1 | //===-- CPPLanguageRuntime.cpp -------------------------------------------------*- 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 | //===----------------------------------------------------------------------===// |
Jim Ingham | 324067b | 2010-09-30 00:54:27 +0000 | [diff] [blame] | 9 | #include "clang/AST/Type.h" |
Jim Ingham | 642036f | 2010-09-23 02:01:19 +0000 | [diff] [blame] | 10 | |
Jim Ingham | b66cd07 | 2010-09-28 01:25:32 +0000 | [diff] [blame] | 11 | #include "lldb/Core/Log.h" |
Jim Ingham | 642036f | 2010-09-23 02:01:19 +0000 | [diff] [blame] | 12 | #include "lldb/Core/PluginManager.h" |
Jim Ingham | 324067b | 2010-09-30 00:54:27 +0000 | [diff] [blame] | 13 | #include "lldb/Core/ValueObject.h" |
| 14 | #include "lldb/Symbol/ClangASTContext.h" |
Jim Ingham | b66cd07 | 2010-09-28 01:25:32 +0000 | [diff] [blame] | 15 | #include "lldb/Target/ObjCLanguageRuntime.h" |
Jim Ingham | 642036f | 2010-09-23 02:01:19 +0000 | [diff] [blame] | 16 | |
| 17 | using namespace lldb; |
| 18 | using namespace lldb_private; |
| 19 | |
| 20 | //---------------------------------------------------------------------- |
| 21 | // Destructor |
| 22 | //---------------------------------------------------------------------- |
| 23 | ObjCLanguageRuntime::~ObjCLanguageRuntime() |
| 24 | { |
| 25 | } |
| 26 | |
| 27 | ObjCLanguageRuntime::ObjCLanguageRuntime (Process *process) : |
| 28 | LanguageRuntime (process) |
| 29 | { |
| 30 | |
Jim Ingham | b66cd07 | 2010-09-28 01:25:32 +0000 | [diff] [blame] | 31 | } |
| 32 | |
| 33 | void |
| 34 | ObjCLanguageRuntime::AddToMethodCache (lldb::addr_t class_addr, lldb::addr_t selector, lldb::addr_t impl_addr) |
| 35 | { |
| 36 | Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_STEP); |
| 37 | if (log) |
| 38 | { |
| 39 | log->Printf ("Caching: class 0x%llx selector 0x%llx implementation 0x%llx.", class_addr, selector, impl_addr); |
| 40 | } |
| 41 | m_impl_cache.insert (std::pair<ClassAndSel,lldb::addr_t> (ClassAndSel(class_addr, selector), impl_addr)); |
| 42 | } |
| 43 | |
| 44 | lldb::addr_t |
| 45 | ObjCLanguageRuntime::LookupInMethodCache (lldb::addr_t class_addr, lldb::addr_t selector) |
| 46 | { |
| 47 | MsgImplMap::iterator pos, end = m_impl_cache.end(); |
| 48 | pos = m_impl_cache.find (ClassAndSel(class_addr, selector)); |
| 49 | if (pos != end) |
| 50 | return (*pos).second; |
| 51 | return LLDB_INVALID_ADDRESS; |
| 52 | } |
| 53 | |