ObjCLanguageRuntime.h revision 4155fe6231d3f7f55aeed2cf10d0529f11cc74e1
1ec3ed6a5ebf6f2c406d7bcf94b6bc34fcaeb976eepoger@google.com//===-- ObjCLanguageRuntime.h ---------------------------------------------------*- C++ -*-===//
2ec3ed6a5ebf6f2c406d7bcf94b6bc34fcaeb976eepoger@google.com//
3ec3ed6a5ebf6f2c406d7bcf94b6bc34fcaeb976eepoger@google.com//                     The LLVM Compiler Infrastructure
4ec3ed6a5ebf6f2c406d7bcf94b6bc34fcaeb976eepoger@google.com//
5ec3ed6a5ebf6f2c406d7bcf94b6bc34fcaeb976eepoger@google.com// This file is distributed under the University of Illinois Open Source
6ec3ed6a5ebf6f2c406d7bcf94b6bc34fcaeb976eepoger@google.com// License. See LICENSE.TXT for details.
7971d0c8049c6bfc7a58f0b41f8f59f9ec9ca077bbsalomon@google.com//
8b29c883fb46ac6099440d82ac57b86d25386daedbungeman@google.com//===----------------------------------------------------------------------===//
9971d0c8049c6bfc7a58f0b41f8f59f9ec9ca077bbsalomon@google.com
10971d0c8049c6bfc7a58f0b41f8f59f9ec9ca077bbsalomon@google.com#ifndef liblldb_ObjCLanguageRuntime_h_
11971d0c8049c6bfc7a58f0b41f8f59f9ec9ca077bbsalomon@google.com#define liblldb_ObjCLanguageRuntime_h_
12b9b9a18ab459c2616ac4a52c9f8cc0637d284229reed@android.com
138a85d0c4938173476d037d7af0ee3b9436a1234ereed@google.com// C Includes
14971d0c8049c6bfc7a58f0b41f8f59f9ec9ca077bbsalomon@google.com// C++ Includes
15971d0c8049c6bfc7a58f0b41f8f59f9ec9ca077bbsalomon@google.com#include <functional>
16971d0c8049c6bfc7a58f0b41f8f59f9ec9ca077bbsalomon@google.com#include <map>
17971d0c8049c6bfc7a58f0b41f8f59f9ec9ca077bbsalomon@google.com
188015dd83ae37147bb630d4751030868051ad0caereed@android.com// Other libraries and framework includes
198015dd83ae37147bb630d4751030868051ad0caereed@android.com// Project includes
208015dd83ae37147bb630d4751030868051ad0caereed@android.com#include "lldb/lldb-private.h"
219875dd14af6d768da8d1a4be58b98fc91ceca0ddtomhudson@google.com#include "lldb/Core/PluginInterface.h"
220770044da6d61dcbc8d9673fed8dd92460faa314reed@google.com#include "lldb/Symbol/Type.h"
230770044da6d61dcbc8d9673fed8dd92460faa314reed@google.com#include "lldb/Symbol/TypeVendor.h"
240770044da6d61dcbc8d9673fed8dd92460faa314reed@google.com#include "lldb/Target/LanguageRuntime.h"
250770044da6d61dcbc8d9673fed8dd92460faa314reed@google.com
269875dd14af6d768da8d1a4be58b98fc91ceca0ddtomhudson@google.comnamespace lldb_private {
279875dd14af6d768da8d1a4be58b98fc91ceca0ddtomhudson@google.com
280770044da6d61dcbc8d9673fed8dd92460faa314reed@google.comclass ClangUtilityFunction;
2900dae86f5872b60927b28a32b375bc01cd7c61c9reed@android.com
30b29c883fb46ac6099440d82ac57b86d25386daedbungeman@google.comclass ObjCLanguageRuntime :
31b29c883fb46ac6099440d82ac57b86d25386daedbungeman@google.com    public LanguageRuntime
32b29c883fb46ac6099440d82ac57b86d25386daedbungeman@google.com{
33b29c883fb46ac6099440d82ac57b86d25386daedbungeman@google.compublic:
3446cce91f4859b9c229938d4d649870c0a43b1806reed@google.com
3546cce91f4859b9c229938d4d649870c0a43b1806reed@google.com    typedef lldb::addr_t ObjCISA;
360a09eef79053f93a9b2311c6a29275abf39f189ebsalomon@google.com
3746cce91f4859b9c229938d4d649870c0a43b1806reed@google.com    class ClassDescriptor;
380a09eef79053f93a9b2311c6a29275abf39f189ebsalomon@google.com    typedef STD_SHARED_PTR(ClassDescriptor) ClassDescriptorSP;
3946cce91f4859b9c229938d4d649870c0a43b1806reed@google.com
4046cce91f4859b9c229938d4d649870c0a43b1806reed@google.com    // the information that we want to support retrieving from an ObjC class
4100dae86f5872b60927b28a32b375bc01cd7c61c9reed@android.com    // this needs to be pure virtual since there are at least 2 different implementations
4200dae86f5872b60927b28a32b375bc01cd7c61c9reed@android.com    // of the runtime, and more might come
4300dae86f5872b60927b28a32b375bc01cd7c61c9reed@android.com    class ClassDescriptor
44a87cd2af4c7f46ba8437c2e500805c9deb9e3a40tomhudson@google.com    {
4500dae86f5872b60927b28a32b375bc01cd7c61c9reed@android.com    public:
4600dae86f5872b60927b28a32b375bc01cd7c61c9reed@android.com
4700dae86f5872b60927b28a32b375bc01cd7c61c9reed@android.com        ClassDescriptor() :
4800dae86f5872b60927b28a32b375bc01cd7c61c9reed@android.com        m_is_kvo(eLazyBoolCalculate),
493914958a49ee089ddeb04acc16373aae8bc2eaf7bsalomon@google.com        m_is_cf(eLazyBoolCalculate)
503914958a49ee089ddeb04acc16373aae8bc2eaf7bsalomon@google.com        {}
513914958a49ee089ddeb04acc16373aae8bc2eaf7bsalomon@google.com
523914958a49ee089ddeb04acc16373aae8bc2eaf7bsalomon@google.com        ClassDescriptor (ObjCISA isa, lldb::ProcessSP process)  :
53dd0ac281e920b01a63789893cc3e7422789658ddreed@android.com        m_is_kvo(eLazyBoolCalculate),
5400dae86f5872b60927b28a32b375bc01cd7c61c9reed@android.com        m_is_cf(eLazyBoolCalculate)
55d4dfd10bb6f9bf3ac6e1ebc9bc3ae22c6d06321freed@google.com        {}
56dd0ac281e920b01a63789893cc3e7422789658ddreed@android.com
5700dae86f5872b60927b28a32b375bc01cd7c61c9reed@android.com        virtual ConstString
58dd0ac281e920b01a63789893cc3e7422789658ddreed@android.com        GetClassName () = 0;
5900dae86f5872b60927b28a32b375bc01cd7c61c9reed@android.com
60dd0ac281e920b01a63789893cc3e7422789658ddreed@android.com        virtual ClassDescriptorSP
6100dae86f5872b60927b28a32b375bc01cd7c61c9reed@android.com        GetSuperclass () = 0;
6200dae86f5872b60927b28a32b375bc01cd7c61c9reed@android.com
6300dae86f5872b60927b28a32b375bc01cd7c61c9reed@android.com        // virtual if any implementation has some other version-specific rules
64d4dfd10bb6f9bf3ac6e1ebc9bc3ae22c6d06321freed@google.com        // but for the known v1/v2 this is all that needs to be done
6500dae86f5872b60927b28a32b375bc01cd7c61c9reed@android.com        virtual bool
66dd0ac281e920b01a63789893cc3e7422789658ddreed@android.com        IsKVO ()
6700dae86f5872b60927b28a32b375bc01cd7c61c9reed@android.com        {
6800dae86f5872b60927b28a32b375bc01cd7c61c9reed@android.com            if (m_is_kvo == eLazyBoolCalculate)
6900dae86f5872b60927b28a32b375bc01cd7c61c9reed@android.com            {
7000dae86f5872b60927b28a32b375bc01cd7c61c9reed@android.com                const char* class_name = GetClassName().AsCString();
7100dae86f5872b60927b28a32b375bc01cd7c61c9reed@android.com                if (class_name && *class_name)
7200dae86f5872b60927b28a32b375bc01cd7c61c9reed@android.com                    m_is_kvo = (LazyBool)(strstr(class_name,"NSKVONotifying_") == class_name);
7300dae86f5872b60927b28a32b375bc01cd7c61c9reed@android.com            }
74d4dfd10bb6f9bf3ac6e1ebc9bc3ae22c6d06321freed@google.com            return (m_is_kvo == eLazyBoolYes);
7500dae86f5872b60927b28a32b375bc01cd7c61c9reed@android.com        }
7600dae86f5872b60927b28a32b375bc01cd7c61c9reed@android.com
7700dae86f5872b60927b28a32b375bc01cd7c61c9reed@android.com        // virtual if any implementation has some other version-specific rules
7800dae86f5872b60927b28a32b375bc01cd7c61c9reed@android.com        // but for the known v1/v2 this is all that needs to be done
798015dd83ae37147bb630d4751030868051ad0caereed@android.com        virtual bool
808015dd83ae37147bb630d4751030868051ad0caereed@android.com        IsCFType ()
818015dd83ae37147bb630d4751030868051ad0caereed@android.com        {
828015dd83ae37147bb630d4751030868051ad0caereed@android.com            if (m_is_cf == eLazyBoolCalculate)
838015dd83ae37147bb630d4751030868051ad0caereed@android.com            {
848015dd83ae37147bb630d4751030868051ad0caereed@android.com                const char* class_name = GetClassName().AsCString();
859875dd14af6d768da8d1a4be58b98fc91ceca0ddtomhudson@google.com                if (class_name && *class_name)
869875dd14af6d768da8d1a4be58b98fc91ceca0ddtomhudson@google.com                    m_is_cf = (LazyBool)(strcmp(class_name,"__NSCFType") == 0 ||
879875dd14af6d768da8d1a4be58b98fc91ceca0ddtomhudson@google.com                                         strcmp(class_name,"NSCFType") == 0);
889875dd14af6d768da8d1a4be58b98fc91ceca0ddtomhudson@google.com            }
898015dd83ae37147bb630d4751030868051ad0caereed@android.com            return (m_is_cf == eLazyBoolYes);
909875dd14af6d768da8d1a4be58b98fc91ceca0ddtomhudson@google.com        }
919875dd14af6d768da8d1a4be58b98fc91ceca0ddtomhudson@google.com
9200dae86f5872b60927b28a32b375bc01cd7c61c9reed@android.com        virtual bool
939875dd14af6d768da8d1a4be58b98fc91ceca0ddtomhudson@google.com        IsValid () = 0;
949875dd14af6d768da8d1a4be58b98fc91ceca0ddtomhudson@google.com
950770044da6d61dcbc8d9673fed8dd92460faa314reed@google.com        virtual bool
968015dd83ae37147bb630d4751030868051ad0caereed@android.com        IsTagged () = 0;
978015dd83ae37147bb630d4751030868051ad0caereed@android.com
988015dd83ae37147bb630d4751030868051ad0caereed@android.com        virtual uint64_t
99b9b9a18ab459c2616ac4a52c9f8cc0637d284229reed@android.com        GetInstanceSize () = 0;
100b9b9a18ab459c2616ac4a52c9f8cc0637d284229reed@android.com
101b9b9a18ab459c2616ac4a52c9f8cc0637d284229reed@android.com        virtual bool
102b9b9a18ab459c2616ac4a52c9f8cc0637d284229reed@android.com        IsRealized ()
103b9b9a18ab459c2616ac4a52c9f8cc0637d284229reed@android.com        {
104b9b9a18ab459c2616ac4a52c9f8cc0637d284229reed@android.com            // anything other than some instances of v2 classes are always realized
105b9b9a18ab459c2616ac4a52c9f8cc0637d284229reed@android.com            return true;
106b9b9a18ab459c2616ac4a52c9f8cc0637d284229reed@android.com        }
107b9b9a18ab459c2616ac4a52c9f8cc0637d284229reed@android.com
108b9b9a18ab459c2616ac4a52c9f8cc0637d284229reed@android.com        // use to implement version-specific additional constraints on pointers
109b9b9a18ab459c2616ac4a52c9f8cc0637d284229reed@android.com        virtual bool
110b9b9a18ab459c2616ac4a52c9f8cc0637d284229reed@android.com        CheckPointer (lldb::addr_t value,
111b9b9a18ab459c2616ac4a52c9f8cc0637d284229reed@android.com                      uint32_t ptr_size)
112b9b9a18ab459c2616ac4a52c9f8cc0637d284229reed@android.com        {
113b9b9a18ab459c2616ac4a52c9f8cc0637d284229reed@android.com            return true;
114b9b9a18ab459c2616ac4a52c9f8cc0637d284229reed@android.com        }
115b9b9a18ab459c2616ac4a52c9f8cc0637d284229reed@android.com
116b9b9a18ab459c2616ac4a52c9f8cc0637d284229reed@android.com        virtual ObjCISA
117b9b9a18ab459c2616ac4a52c9f8cc0637d284229reed@android.com        GetISA () = 0;
118b9b9a18ab459c2616ac4a52c9f8cc0637d284229reed@android.com
119b9b9a18ab459c2616ac4a52c9f8cc0637d284229reed@android.com        // This should return true iff the interface could be completed
1203d3f092a9547779a1f0fb6dac202349f50969ab2reed@google.com        virtual bool
1219875dd14af6d768da8d1a4be58b98fc91ceca0ddtomhudson@google.com        Describe (std::function <void (ObjCISA)> const &superclass_func,
1229875dd14af6d768da8d1a4be58b98fc91ceca0ddtomhudson@google.com                  std::function <void (const char*, const char*)> const &method_func)
1239875dd14af6d768da8d1a4be58b98fc91ceca0ddtomhudson@google.com        {
1249875dd14af6d768da8d1a4be58b98fc91ceca0ddtomhudson@google.com            return false;
1253d3f092a9547779a1f0fb6dac202349f50969ab2reed@google.com        }
1263d3f092a9547779a1f0fb6dac202349f50969ab2reed@google.com
1273d3f092a9547779a1f0fb6dac202349f50969ab2reed@google.com        virtual
1289875dd14af6d768da8d1a4be58b98fc91ceca0ddtomhudson@google.com        ~ClassDescriptor ()
1299875dd14af6d768da8d1a4be58b98fc91ceca0ddtomhudson@google.com        {}
1303d3f092a9547779a1f0fb6dac202349f50969ab2reed@google.com
1313d3f092a9547779a1f0fb6dac202349f50969ab2reed@google.com    protected:
1323d3f092a9547779a1f0fb6dac202349f50969ab2reed@google.com        bool
1333d3f092a9547779a1f0fb6dac202349f50969ab2reed@google.com        IsPointerValid (lldb::addr_t value,
1343d3f092a9547779a1f0fb6dac202349f50969ab2reed@google.com                        uint32_t ptr_size,
1353d3f092a9547779a1f0fb6dac202349f50969ab2reed@google.com                        bool allow_NULLs = false,
1363d3f092a9547779a1f0fb6dac202349f50969ab2reed@google.com                        bool allow_tagged = false,
1379875dd14af6d768da8d1a4be58b98fc91ceca0ddtomhudson@google.com                        bool check_version_specific = false);
1389875dd14af6d768da8d1a4be58b98fc91ceca0ddtomhudson@google.com
1399875dd14af6d768da8d1a4be58b98fc91ceca0ddtomhudson@google.com    private:
1409875dd14af6d768da8d1a4be58b98fc91ceca0ddtomhudson@google.com        LazyBool m_is_kvo;
1419875dd14af6d768da8d1a4be58b98fc91ceca0ddtomhudson@google.com        LazyBool m_is_cf;
1429875dd14af6d768da8d1a4be58b98fc91ceca0ddtomhudson@google.com    };
1439875dd14af6d768da8d1a4be58b98fc91ceca0ddtomhudson@google.com
1443d3f092a9547779a1f0fb6dac202349f50969ab2reed@google.com    // a convenience subclass of ClassDescriptor meant to represent invalid objects
1453d3f092a9547779a1f0fb6dac202349f50969ab2reed@google.com    class ClassDescriptor_Invalid : public ClassDescriptor
1463d3f092a9547779a1f0fb6dac202349f50969ab2reed@google.com    {
147ea325437bd5a9996422b640087b64742363e5b55tomhudson@google.com    public:
1486abfa49b9727cabb9550d35cdef28007df0c9b8btomhudson@google.com        ClassDescriptor_Invalid() {}
149b9b9a18ab459c2616ac4a52c9f8cc0637d284229reed@android.com
150b9b9a18ab459c2616ac4a52c9f8cc0637d284229reed@android.com        virtual ConstString
151b9b9a18ab459c2616ac4a52c9f8cc0637d284229reed@android.com        GetClassName () { return ConstString(""); }
152b9b9a18ab459c2616ac4a52c9f8cc0637d284229reed@android.com
153b9b9a18ab459c2616ac4a52c9f8cc0637d284229reed@android.com        virtual ClassDescriptorSP
154b9b9a18ab459c2616ac4a52c9f8cc0637d284229reed@android.com        GetSuperclass () { return ClassDescriptorSP(new ClassDescriptor_Invalid()); }
155cae6b3f1e85239f95fcdad2b341ccbe83a8a2a40tomhudson@google.com
156cae6b3f1e85239f95fcdad2b341ccbe83a8a2a40tomhudson@google.com        virtual bool
157cae6b3f1e85239f95fcdad2b341ccbe83a8a2a40tomhudson@google.com        IsValid () { return false; }
158cae6b3f1e85239f95fcdad2b341ccbe83a8a2a40tomhudson@google.com
159cae6b3f1e85239f95fcdad2b341ccbe83a8a2a40tomhudson@google.com        virtual bool
160cae6b3f1e85239f95fcdad2b341ccbe83a8a2a40tomhudson@google.com        IsTagged () { return false; }
161b9b9a18ab459c2616ac4a52c9f8cc0637d284229reed@android.com
162b9b9a18ab459c2616ac4a52c9f8cc0637d284229reed@android.com        virtual uint64_t
163cae6b3f1e85239f95fcdad2b341ccbe83a8a2a40tomhudson@google.com        GetInstanceSize () { return 0; }
164b9b9a18ab459c2616ac4a52c9f8cc0637d284229reed@android.com
165b9b9a18ab459c2616ac4a52c9f8cc0637d284229reed@android.com        virtual ObjCISA
166b9b9a18ab459c2616ac4a52c9f8cc0637d284229reed@android.com        GetISA () { return 0; }
167cae6b3f1e85239f95fcdad2b341ccbe83a8a2a40tomhudson@google.com
168ea325437bd5a9996422b640087b64742363e5b55tomhudson@google.com        virtual bool
169ea325437bd5a9996422b640087b64742363e5b55tomhudson@google.com        CheckPointer (lldb::addr_t value,
170ea325437bd5a9996422b640087b64742363e5b55tomhudson@google.com                      uint32_t ptr_size) { return false; }
171cae6b3f1e85239f95fcdad2b341ccbe83a8a2a40tomhudson@google.com
1723d3f092a9547779a1f0fb6dac202349f50969ab2reed@google.com        virtual
173b9b9a18ab459c2616ac4a52c9f8cc0637d284229reed@android.com        ~ClassDescriptor_Invalid ()
174b9b9a18ab459c2616ac4a52c9f8cc0637d284229reed@android.com        {}
175b9b9a18ab459c2616ac4a52c9f8cc0637d284229reed@android.com
176cae6b3f1e85239f95fcdad2b341ccbe83a8a2a40tomhudson@google.com    };
177b9b9a18ab459c2616ac4a52c9f8cc0637d284229reed@android.com
178b9b9a18ab459c2616ac4a52c9f8cc0637d284229reed@android.com    virtual ClassDescriptorSP
179b9b9a18ab459c2616ac4a52c9f8cc0637d284229reed@android.com    GetClassDescriptor (ValueObject& in_value)
180cae6b3f1e85239f95fcdad2b341ccbe83a8a2a40tomhudson@google.com    {
181b9b9a18ab459c2616ac4a52c9f8cc0637d284229reed@android.com        return ClassDescriptorSP();
182b9b9a18ab459c2616ac4a52c9f8cc0637d284229reed@android.com    }
183ea325437bd5a9996422b640087b64742363e5b55tomhudson@google.com
184ea325437bd5a9996422b640087b64742363e5b55tomhudson@google.com    virtual ClassDescriptorSP
185ea325437bd5a9996422b640087b64742363e5b55tomhudson@google.com    GetClassDescriptor (ObjCISA isa)
1863d3f092a9547779a1f0fb6dac202349f50969ab2reed@google.com    {
1879875dd14af6d768da8d1a4be58b98fc91ceca0ddtomhudson@google.com        return ClassDescriptorSP();
1889875dd14af6d768da8d1a4be58b98fc91ceca0ddtomhudson@google.com    }
1899875dd14af6d768da8d1a4be58b98fc91ceca0ddtomhudson@google.com
190cae6b3f1e85239f95fcdad2b341ccbe83a8a2a40tomhudson@google.com    virtual
1919875dd14af6d768da8d1a4be58b98fc91ceca0ddtomhudson@google.com    ~ObjCLanguageRuntime();
1923d3f092a9547779a1f0fb6dac202349f50969ab2reed@google.com
193b9b9a18ab459c2616ac4a52c9f8cc0637d284229reed@android.com    virtual lldb::LanguageType
194b9b9a18ab459c2616ac4a52c9f8cc0637d284229reed@android.com    GetLanguageType () const
195b9b9a18ab459c2616ac4a52c9f8cc0637d284229reed@android.com    {
1963d3f092a9547779a1f0fb6dac202349f50969ab2reed@google.com        return lldb::eLanguageTypeObjC;
1979875dd14af6d768da8d1a4be58b98fc91ceca0ddtomhudson@google.com    }
1989875dd14af6d768da8d1a4be58b98fc91ceca0ddtomhudson@google.com
1998015dd83ae37147bb630d4751030868051ad0caereed@android.com    virtual bool
20000dae86f5872b60927b28a32b375bc01cd7c61c9reed@android.com    IsModuleObjCLibrary (const lldb::ModuleSP &module_sp) = 0;
201b29c883fb46ac6099440d82ac57b86d25386daedbungeman@google.com
202b29c883fb46ac6099440d82ac57b86d25386daedbungeman@google.com    virtual bool
203686abdfab0e4c45de1fd30774896c46e43a299acvandebo@chromium.org    ReadObjCLibrary (const lldb::ModuleSP &module_sp) = 0;
204b29c883fb46ac6099440d82ac57b86d25386daedbungeman@google.com
2058a85d0c4938173476d037d7af0ee3b9436a1234ereed@google.com    virtual bool
2060770044da6d61dcbc8d9673fed8dd92460faa314reed@google.com    HasReadObjCLibrary () = 0;
2070770044da6d61dcbc8d9673fed8dd92460faa314reed@google.com
208686abdfab0e4c45de1fd30774896c46e43a299acvandebo@chromium.org    virtual lldb::ThreadPlanSP
209686abdfab0e4c45de1fd30774896c46e43a299acvandebo@chromium.org    GetStepThroughTrampolinePlan (Thread &thread, bool stop_others) = 0;
210686abdfab0e4c45de1fd30774896c46e43a299acvandebo@chromium.org
211686abdfab0e4c45de1fd30774896c46e43a299acvandebo@chromium.org    lldb::addr_t
212b29c883fb46ac6099440d82ac57b86d25386daedbungeman@google.com    LookupInMethodCache (lldb::addr_t class_addr, lldb::addr_t sel);
213686abdfab0e4c45de1fd30774896c46e43a299acvandebo@chromium.org
214686abdfab0e4c45de1fd30774896c46e43a299acvandebo@chromium.org    void
2159875dd14af6d768da8d1a4be58b98fc91ceca0ddtomhudson@google.com    AddToMethodCache (lldb::addr_t class_addr, lldb::addr_t sel, lldb::addr_t impl_addr);
2169875dd14af6d768da8d1a4be58b98fc91ceca0ddtomhudson@google.com
217686abdfab0e4c45de1fd30774896c46e43a299acvandebo@chromium.org    TypeAndOrName
2189875dd14af6d768da8d1a4be58b98fc91ceca0ddtomhudson@google.com    LookupInClassNameCache (lldb::addr_t class_addr);
2199875dd14af6d768da8d1a4be58b98fc91ceca0ddtomhudson@google.com
2209875dd14af6d768da8d1a4be58b98fc91ceca0ddtomhudson@google.com    void
2219875dd14af6d768da8d1a4be58b98fc91ceca0ddtomhudson@google.com    AddToClassNameCache (lldb::addr_t class_addr, const char *name, lldb::TypeSP type_sp);
2229875dd14af6d768da8d1a4be58b98fc91ceca0ddtomhudson@google.com
2239875dd14af6d768da8d1a4be58b98fc91ceca0ddtomhudson@google.com    void
2249875dd14af6d768da8d1a4be58b98fc91ceca0ddtomhudson@google.com    AddToClassNameCache (lldb::addr_t class_addr, const TypeAndOrName &class_or_type_name);
2259875dd14af6d768da8d1a4be58b98fc91ceca0ddtomhudson@google.com
2269875dd14af6d768da8d1a4be58b98fc91ceca0ddtomhudson@google.com    lldb::TypeSP
2279875dd14af6d768da8d1a4be58b98fc91ceca0ddtomhudson@google.com    LookupInCompleteClassCache (ConstString &name);
2289875dd14af6d768da8d1a4be58b98fc91ceca0ddtomhudson@google.com
2299875dd14af6d768da8d1a4be58b98fc91ceca0ddtomhudson@google.com    virtual ClangUtilityFunction *
2309875dd14af6d768da8d1a4be58b98fc91ceca0ddtomhudson@google.com    CreateObjectChecker (const char *) = 0;
2319875dd14af6d768da8d1a4be58b98fc91ceca0ddtomhudson@google.com
2329875dd14af6d768da8d1a4be58b98fc91ceca0ddtomhudson@google.com    virtual ObjCRuntimeVersions
2339875dd14af6d768da8d1a4be58b98fc91ceca0ddtomhudson@google.com    GetRuntimeVersion ()
2348e728d7467ae29dc1a53e4d8b436f91e112a5ee9tomhudson@google.com    {
2358e728d7467ae29dc1a53e4d8b436f91e112a5ee9tomhudson@google.com        return eObjC_VersionUnknown;
2369875dd14af6d768da8d1a4be58b98fc91ceca0ddtomhudson@google.com    }
2379875dd14af6d768da8d1a4be58b98fc91ceca0ddtomhudson@google.com
238971d0c8049c6bfc7a58f0b41f8f59f9ec9ca077bbsalomon@google.com    virtual bool
239cae6b3f1e85239f95fcdad2b341ccbe83a8a2a40tomhudson@google.com    IsValidISA(ObjCISA isa) = 0;
2409875dd14af6d768da8d1a4be58b98fc91ceca0ddtomhudson@google.com
241cae6b3f1e85239f95fcdad2b341ccbe83a8a2a40tomhudson@google.com    virtual ObjCISA
242cae6b3f1e85239f95fcdad2b341ccbe83a8a2a40tomhudson@google.com    GetISA(ValueObject& valobj) = 0;
2439875dd14af6d768da8d1a4be58b98fc91ceca0ddtomhudson@google.com
2449875dd14af6d768da8d1a4be58b98fc91ceca0ddtomhudson@google.com    virtual void
2459875dd14af6d768da8d1a4be58b98fc91ceca0ddtomhudson@google.com    UpdateISAToDescriptorMap_Impl()
2469875dd14af6d768da8d1a4be58b98fc91ceca0ddtomhudson@google.com    {
2479875dd14af6d768da8d1a4be58b98fc91ceca0ddtomhudson@google.com        // to be implemented by runtimes if they support doing this
2489875dd14af6d768da8d1a4be58b98fc91ceca0ddtomhudson@google.com    }
2499875dd14af6d768da8d1a4be58b98fc91ceca0ddtomhudson@google.com
250af951c9bc4cbb6e60b430194fe5127ebe99c53fbreed@google.com    void
251af951c9bc4cbb6e60b430194fe5127ebe99c53fbreed@google.com    UpdateISAToDescriptorMap()
2529875dd14af6d768da8d1a4be58b98fc91ceca0ddtomhudson@google.com    {
253af951c9bc4cbb6e60b430194fe5127ebe99c53fbreed@google.com        if (m_isa_to_descriptor_cache_is_up_to_date)
254af951c9bc4cbb6e60b430194fe5127ebe99c53fbreed@google.com            return;
255cae6b3f1e85239f95fcdad2b341ccbe83a8a2a40tomhudson@google.com
256cae6b3f1e85239f95fcdad2b341ccbe83a8a2a40tomhudson@google.com        m_isa_to_descriptor_cache_is_up_to_date = true;
2579875dd14af6d768da8d1a4be58b98fc91ceca0ddtomhudson@google.com
2589875dd14af6d768da8d1a4be58b98fc91ceca0ddtomhudson@google.com        UpdateISAToDescriptorMap_Impl();
2599875dd14af6d768da8d1a4be58b98fc91ceca0ddtomhudson@google.com    }
2609875dd14af6d768da8d1a4be58b98fc91ceca0ddtomhudson@google.com
2619875dd14af6d768da8d1a4be58b98fc91ceca0ddtomhudson@google.com    virtual ObjCISA
2629875dd14af6d768da8d1a4be58b98fc91ceca0ddtomhudson@google.com    GetISA(const ConstString &name);
2639875dd14af6d768da8d1a4be58b98fc91ceca0ddtomhudson@google.com
2649875dd14af6d768da8d1a4be58b98fc91ceca0ddtomhudson@google.com    virtual ConstString
2659875dd14af6d768da8d1a4be58b98fc91ceca0ddtomhudson@google.com    GetActualTypeName(ObjCISA isa);
2669875dd14af6d768da8d1a4be58b98fc91ceca0ddtomhudson@google.com
2679875dd14af6d768da8d1a4be58b98fc91ceca0ddtomhudson@google.com    virtual ObjCISA
2689875dd14af6d768da8d1a4be58b98fc91ceca0ddtomhudson@google.com    GetParentClass(ObjCISA isa);
2699875dd14af6d768da8d1a4be58b98fc91ceca0ddtomhudson@google.com
2709875dd14af6d768da8d1a4be58b98fc91ceca0ddtomhudson@google.com    virtual TypeVendor *
2719875dd14af6d768da8d1a4be58b98fc91ceca0ddtomhudson@google.com    GetTypeVendor()
2729875dd14af6d768da8d1a4be58b98fc91ceca0ddtomhudson@google.com    {
2739875dd14af6d768da8d1a4be58b98fc91ceca0ddtomhudson@google.com        return NULL;
274152612938020fa46999f33668027d5bc0f7afd18ctguil@chromium.org    }
2759875dd14af6d768da8d1a4be58b98fc91ceca0ddtomhudson@google.com
2769875dd14af6d768da8d1a4be58b98fc91ceca0ddtomhudson@google.com    // Finds the byte offset of the child_type ivar in parent_type.  If it can't find the
2779875dd14af6d768da8d1a4be58b98fc91ceca0ddtomhudson@google.com    // offset, returns LLDB_INVALID_IVAR_OFFSET.
2789875dd14af6d768da8d1a4be58b98fc91ceca0ddtomhudson@google.com
2799875dd14af6d768da8d1a4be58b98fc91ceca0ddtomhudson@google.com    virtual size_t
2809875dd14af6d768da8d1a4be58b98fc91ceca0ddtomhudson@google.com    GetByteOffsetForIvar (ClangASTType &parent_qual_type, const char *ivar_name);
2819875dd14af6d768da8d1a4be58b98fc91ceca0ddtomhudson@google.com
2829875dd14af6d768da8d1a4be58b98fc91ceca0ddtomhudson@google.com    //------------------------------------------------------------------
2839875dd14af6d768da8d1a4be58b98fc91ceca0ddtomhudson@google.com    /// Chop up an objective C function prototype.
2849875dd14af6d768da8d1a4be58b98fc91ceca0ddtomhudson@google.com    ///
2859875dd14af6d768da8d1a4be58b98fc91ceca0ddtomhudson@google.com    /// Chop up an objective C function fullname and optionally fill in
286b29c883fb46ac6099440d82ac57b86d25386daedbungeman@google.com    /// any non-NULL ConstString objects. If a ConstString * is NULL,
287b29c883fb46ac6099440d82ac57b86d25386daedbungeman@google.com    /// then this name doesn't get filled in
288b29c883fb46ac6099440d82ac57b86d25386daedbungeman@google.com    ///
289b29c883fb46ac6099440d82ac57b86d25386daedbungeman@google.com    /// @param[in] name
290b29c883fb46ac6099440d82ac57b86d25386daedbungeman@google.com    ///     A fully specified objective C function name. The string might
291b29c883fb46ac6099440d82ac57b86d25386daedbungeman@google.com    ///     contain a category and it includes the leading "+" or "-" and
292b29c883fb46ac6099440d82ac57b86d25386daedbungeman@google.com    ///     the square brackets, no types for the arguments, just the plain
293b29c883fb46ac6099440d82ac57b86d25386daedbungeman@google.com    ///     selector. A few examples:
294b29c883fb46ac6099440d82ac57b86d25386daedbungeman@google.com    ///         "-[NSStringDrawingContext init]"
295b29c883fb46ac6099440d82ac57b86d25386daedbungeman@google.com    ///         "-[NSStringDrawingContext addString:inRect:]"
296b29c883fb46ac6099440d82ac57b86d25386daedbungeman@google.com    ///         "-[NSString(NSStringDrawing) sizeWithAttributes:]"
297b29c883fb46ac6099440d82ac57b86d25386daedbungeman@google.com    ///         "+[NSString(NSStringDrawing) usesFontLeading]"
298b29c883fb46ac6099440d82ac57b86d25386daedbungeman@google.com    ///
299b29c883fb46ac6099440d82ac57b86d25386daedbungeman@google.com    /// @param[out] class_name
300b29c883fb46ac6099440d82ac57b86d25386daedbungeman@google.com    ///     If non-NULL, this string will be filled in with the class
301b29c883fb46ac6099440d82ac57b86d25386daedbungeman@google.com    ///     name including the category. The examples above would return:
302b29c883fb46ac6099440d82ac57b86d25386daedbungeman@google.com    ///         "NSStringDrawingContext"
303b29c883fb46ac6099440d82ac57b86d25386daedbungeman@google.com    ///         "NSStringDrawingContext"
304b29c883fb46ac6099440d82ac57b86d25386daedbungeman@google.com    ///         "NSString(NSStringDrawing)"
305b29c883fb46ac6099440d82ac57b86d25386daedbungeman@google.com    ///         "NSString(NSStringDrawing)"
306b29c883fb46ac6099440d82ac57b86d25386daedbungeman@google.com    ///
307b29c883fb46ac6099440d82ac57b86d25386daedbungeman@google.com    /// @param[out] selector_name
308b29c883fb46ac6099440d82ac57b86d25386daedbungeman@google.com    ///     If non-NULL, this string will be filled in with the selector
309b29c883fb46ac6099440d82ac57b86d25386daedbungeman@google.com    ///     name. The examples above would return:
310b29c883fb46ac6099440d82ac57b86d25386daedbungeman@google.com    ///         "init"
311b29c883fb46ac6099440d82ac57b86d25386daedbungeman@google.com    ///         "addString:inRect:"
312b29c883fb46ac6099440d82ac57b86d25386daedbungeman@google.com    ///         "sizeWithAttributes:"
3138e728d7467ae29dc1a53e4d8b436f91e112a5ee9tomhudson@google.com    ///         "usesFontLeading"
3149875dd14af6d768da8d1a4be58b98fc91ceca0ddtomhudson@google.com    ///
315ea325437bd5a9996422b640087b64742363e5b55tomhudson@google.com    /// @param[out] name_sans_category
3169875dd14af6d768da8d1a4be58b98fc91ceca0ddtomhudson@google.com    ///     If non-NULL, this string will be filled in with the class
3179875dd14af6d768da8d1a4be58b98fc91ceca0ddtomhudson@google.com    ///     name _without_ the category. If there is no category, and empty
318b29c883fb46ac6099440d82ac57b86d25386daedbungeman@google.com    ///     string will be returned (as the result would be normally returned
3199875dd14af6d768da8d1a4be58b98fc91ceca0ddtomhudson@google.com    ///     in the "class_name" argument). The examples above would return:
3209875dd14af6d768da8d1a4be58b98fc91ceca0ddtomhudson@google.com    ///         <empty>
321b29c883fb46ac6099440d82ac57b86d25386daedbungeman@google.com    ///         <empty>
322b29c883fb46ac6099440d82ac57b86d25386daedbungeman@google.com    ///         "-[NSString sizeWithAttributes:]"
323b29c883fb46ac6099440d82ac57b86d25386daedbungeman@google.com    ///         "+[NSString usesFontLeading]"
324b29c883fb46ac6099440d82ac57b86d25386daedbungeman@google.com    ///
325ea325437bd5a9996422b640087b64742363e5b55tomhudson@google.com    /// @param[out] class_name_sans_category
3269875dd14af6d768da8d1a4be58b98fc91ceca0ddtomhudson@google.com    ///     If non-NULL, this string will be filled in with the prototype
32746cce91f4859b9c229938d4d649870c0a43b1806reed@google.com    ///     name _without_ the category. If there is no category, and empty
32846cce91f4859b9c229938d4d649870c0a43b1806reed@google.com    ///     string will be returned (as this is already the value that was
329ea325437bd5a9996422b640087b64742363e5b55tomhudson@google.com    ///     passed in). The examples above would return:
330b29c883fb46ac6099440d82ac57b86d25386daedbungeman@google.com    ///         <empty>
331b29c883fb46ac6099440d82ac57b86d25386daedbungeman@google.com    ///         <empty>
332b29c883fb46ac6099440d82ac57b86d25386daedbungeman@google.com    ///         "NSString"
333b29c883fb46ac6099440d82ac57b86d25386daedbungeman@google.com    ///         "NSString"
334b29c883fb46ac6099440d82ac57b86d25386daedbungeman@google.com    ///
3359875dd14af6d768da8d1a4be58b98fc91ceca0ddtomhudson@google.com    /// @return
3369875dd14af6d768da8d1a4be58b98fc91ceca0ddtomhudson@google.com    ///     Returns the number of strings that were successfully filled
3379875dd14af6d768da8d1a4be58b98fc91ceca0ddtomhudson@google.com    ///     in.
3389875dd14af6d768da8d1a4be58b98fc91ceca0ddtomhudson@google.com    //------------------------------------------------------------------
3398e728d7467ae29dc1a53e4d8b436f91e112a5ee9tomhudson@google.com    static uint32_t
3409875dd14af6d768da8d1a4be58b98fc91ceca0ddtomhudson@google.com    ParseMethodName (const char *name,
3419875dd14af6d768da8d1a4be58b98fc91ceca0ddtomhudson@google.com                     ConstString *class_name,               // Class name (with category if there is one)
342cae6b3f1e85239f95fcdad2b341ccbe83a8a2a40tomhudson@google.com                     ConstString *selector_name,            // selector only
343cae6b3f1e85239f95fcdad2b341ccbe83a8a2a40tomhudson@google.com                     ConstString *name_sans_category,       // full function name with no category (empty if no category)
344cae6b3f1e85239f95fcdad2b341ccbe83a8a2a40tomhudson@google.com                     ConstString *class_name_sans_category);// Class name without category (empty if no category)
345cae6b3f1e85239f95fcdad2b341ccbe83a8a2a40tomhudson@google.com
346cae6b3f1e85239f95fcdad2b341ccbe83a8a2a40tomhudson@google.com    static bool
347cae6b3f1e85239f95fcdad2b341ccbe83a8a2a40tomhudson@google.com    IsPossibleObjCMethodName (const char *name)
348cae6b3f1e85239f95fcdad2b341ccbe83a8a2a40tomhudson@google.com    {
349cae6b3f1e85239f95fcdad2b341ccbe83a8a2a40tomhudson@google.com        if (!name)
350cae6b3f1e85239f95fcdad2b341ccbe83a8a2a40tomhudson@google.com            return false;
351cae6b3f1e85239f95fcdad2b341ccbe83a8a2a40tomhudson@google.com        bool starts_right = (name[0] == '+' || name[0] == '-') && name[1] == '[';
352cae6b3f1e85239f95fcdad2b341ccbe83a8a2a40tomhudson@google.com        bool ends_right = (name[strlen(name) - 1] == ']');
353cae6b3f1e85239f95fcdad2b341ccbe83a8a2a40tomhudson@google.com        return (starts_right && ends_right);
354cae6b3f1e85239f95fcdad2b341ccbe83a8a2a40tomhudson@google.com    }
355cae6b3f1e85239f95fcdad2b341ccbe83a8a2a40tomhudson@google.com
356cae6b3f1e85239f95fcdad2b341ccbe83a8a2a40tomhudson@google.com    static bool
357cae6b3f1e85239f95fcdad2b341ccbe83a8a2a40tomhudson@google.com    IsPossibleObjCSelector (const char *name)
3588e728d7467ae29dc1a53e4d8b436f91e112a5ee9tomhudson@google.com    {
3599875dd14af6d768da8d1a4be58b98fc91ceca0ddtomhudson@google.com        if (!name)
3609875dd14af6d768da8d1a4be58b98fc91ceca0ddtomhudson@google.com            return false;
3616abfa49b9727cabb9550d35cdef28007df0c9b8btomhudson@google.com
362ea325437bd5a9996422b640087b64742363e5b55tomhudson@google.com        if (strchr(name, ':') == NULL)
3639875dd14af6d768da8d1a4be58b98fc91ceca0ddtomhudson@google.com            return true;
3649875dd14af6d768da8d1a4be58b98fc91ceca0ddtomhudson@google.com        else if (name[strlen(name) - 1] == ':')
3659875dd14af6d768da8d1a4be58b98fc91ceca0ddtomhudson@google.com            return true;
3669875dd14af6d768da8d1a4be58b98fc91ceca0ddtomhudson@google.com        else
3679875dd14af6d768da8d1a4be58b98fc91ceca0ddtomhudson@google.com            return false;
3689875dd14af6d768da8d1a4be58b98fc91ceca0ddtomhudson@google.com    }
369cae6b3f1e85239f95fcdad2b341ccbe83a8a2a40tomhudson@google.com
370cae6b3f1e85239f95fcdad2b341ccbe83a8a2a40tomhudson@google.com    bool
371cae6b3f1e85239f95fcdad2b341ccbe83a8a2a40tomhudson@google.com    HasNewLiteralsAndIndexing ()
3729875dd14af6d768da8d1a4be58b98fc91ceca0ddtomhudson@google.com    {
3739875dd14af6d768da8d1a4be58b98fc91ceca0ddtomhudson@google.com        if (m_has_new_literals_and_indexing == eLazyBoolCalculate)
374ac864a945cb7e1be93717f209bf7eff2c4b6b2b5reed@google.com        {
375ac864a945cb7e1be93717f209bf7eff2c4b6b2b5reed@google.com            if (CalculateHasNewLiteralsAndIndexing())
376ac864a945cb7e1be93717f209bf7eff2c4b6b2b5reed@google.com                m_has_new_literals_and_indexing = eLazyBoolYes;
377ac864a945cb7e1be93717f209bf7eff2c4b6b2b5reed@google.com            else
378ac864a945cb7e1be93717f209bf7eff2c4b6b2b5reed@google.com                m_has_new_literals_and_indexing = eLazyBoolNo;
3799875dd14af6d768da8d1a4be58b98fc91ceca0ddtomhudson@google.com        }
3808e728d7467ae29dc1a53e4d8b436f91e112a5ee9tomhudson@google.com
3819875dd14af6d768da8d1a4be58b98fc91ceca0ddtomhudson@google.com        return (m_has_new_literals_and_indexing == eLazyBoolYes);
3829875dd14af6d768da8d1a4be58b98fc91ceca0ddtomhudson@google.com    }
3838e728d7467ae29dc1a53e4d8b436f91e112a5ee9tomhudson@google.com
3849875dd14af6d768da8d1a4be58b98fc91ceca0ddtomhudson@google.comprotected:
3859875dd14af6d768da8d1a4be58b98fc91ceca0ddtomhudson@google.com    //------------------------------------------------------------------
3869875dd14af6d768da8d1a4be58b98fc91ceca0ddtomhudson@google.com    // Classes that inherit from ObjCLanguageRuntime can see and modify these
3879875dd14af6d768da8d1a4be58b98fc91ceca0ddtomhudson@google.com    //------------------------------------------------------------------
388ea325437bd5a9996422b640087b64742363e5b55tomhudson@google.com    ObjCLanguageRuntime(Process *process);
3899875dd14af6d768da8d1a4be58b98fc91ceca0ddtomhudson@google.com
390cae6b3f1e85239f95fcdad2b341ccbe83a8a2a40tomhudson@google.com    virtual bool CalculateHasNewLiteralsAndIndexing()
391cae6b3f1e85239f95fcdad2b341ccbe83a8a2a40tomhudson@google.com    {
3929875dd14af6d768da8d1a4be58b98fc91ceca0ddtomhudson@google.com        return false;
3939875dd14af6d768da8d1a4be58b98fc91ceca0ddtomhudson@google.com    }
3949875dd14af6d768da8d1a4be58b98fc91ceca0ddtomhudson@google.comprivate:
395ea325437bd5a9996422b640087b64742363e5b55tomhudson@google.com    // We keep a map of <Class,Selector>->Implementation so we don't have to call the resolver
3969875dd14af6d768da8d1a4be58b98fc91ceca0ddtomhudson@google.com    // function over and over.
397b29c883fb46ac6099440d82ac57b86d25386daedbungeman@google.com
398b29c883fb46ac6099440d82ac57b86d25386daedbungeman@google.com    // FIXME: We need to watch for the loading of Protocols, and flush the cache for any
399b29c883fb46ac6099440d82ac57b86d25386daedbungeman@google.com    // class that we see so changed.
400b29c883fb46ac6099440d82ac57b86d25386daedbungeman@google.com
4018e728d7467ae29dc1a53e4d8b436f91e112a5ee9tomhudson@google.com    struct ClassAndSel
402ea325437bd5a9996422b640087b64742363e5b55tomhudson@google.com    {
403cae6b3f1e85239f95fcdad2b341ccbe83a8a2a40tomhudson@google.com        ClassAndSel()
404cae6b3f1e85239f95fcdad2b341ccbe83a8a2a40tomhudson@google.com        {
405cae6b3f1e85239f95fcdad2b341ccbe83a8a2a40tomhudson@google.com            sel_addr = LLDB_INVALID_ADDRESS;
406cae6b3f1e85239f95fcdad2b341ccbe83a8a2a40tomhudson@google.com            class_addr = LLDB_INVALID_ADDRESS;
4079875dd14af6d768da8d1a4be58b98fc91ceca0ddtomhudson@google.com        }
4088e728d7467ae29dc1a53e4d8b436f91e112a5ee9tomhudson@google.com        ClassAndSel (lldb::addr_t in_sel_addr, lldb::addr_t in_class_addr) :
4099875dd14af6d768da8d1a4be58b98fc91ceca0ddtomhudson@google.com            class_addr (in_class_addr),
4109875dd14af6d768da8d1a4be58b98fc91ceca0ddtomhudson@google.com            sel_addr(in_sel_addr)
4119875dd14af6d768da8d1a4be58b98fc91ceca0ddtomhudson@google.com        {
4129875dd14af6d768da8d1a4be58b98fc91ceca0ddtomhudson@google.com        }
4139875dd14af6d768da8d1a4be58b98fc91ceca0ddtomhudson@google.com        bool operator== (const ClassAndSel &rhs)
4149875dd14af6d768da8d1a4be58b98fc91ceca0ddtomhudson@google.com        {
4159875dd14af6d768da8d1a4be58b98fc91ceca0ddtomhudson@google.com            if (class_addr == rhs.class_addr
4169875dd14af6d768da8d1a4be58b98fc91ceca0ddtomhudson@google.com                && sel_addr == rhs.sel_addr)
4179875dd14af6d768da8d1a4be58b98fc91ceca0ddtomhudson@google.com                return true;
4189875dd14af6d768da8d1a4be58b98fc91ceca0ddtomhudson@google.com            else
4199875dd14af6d768da8d1a4be58b98fc91ceca0ddtomhudson@google.com                return false;
4209875dd14af6d768da8d1a4be58b98fc91ceca0ddtomhudson@google.com        }
4219875dd14af6d768da8d1a4be58b98fc91ceca0ddtomhudson@google.com
4229875dd14af6d768da8d1a4be58b98fc91ceca0ddtomhudson@google.com        bool operator< (const ClassAndSel &rhs) const
4239875dd14af6d768da8d1a4be58b98fc91ceca0ddtomhudson@google.com        {
4249875dd14af6d768da8d1a4be58b98fc91ceca0ddtomhudson@google.com            if (class_addr < rhs.class_addr)
4259875dd14af6d768da8d1a4be58b98fc91ceca0ddtomhudson@google.com                return true;
4269875dd14af6d768da8d1a4be58b98fc91ceca0ddtomhudson@google.com            else if (class_addr > rhs.class_addr)
4279875dd14af6d768da8d1a4be58b98fc91ceca0ddtomhudson@google.com                return false;
4289875dd14af6d768da8d1a4be58b98fc91ceca0ddtomhudson@google.com            else
4299875dd14af6d768da8d1a4be58b98fc91ceca0ddtomhudson@google.com            {
4309875dd14af6d768da8d1a4be58b98fc91ceca0ddtomhudson@google.com                if (sel_addr < rhs.sel_addr)
4319875dd14af6d768da8d1a4be58b98fc91ceca0ddtomhudson@google.com                    return true;
4329875dd14af6d768da8d1a4be58b98fc91ceca0ddtomhudson@google.com                else
4339875dd14af6d768da8d1a4be58b98fc91ceca0ddtomhudson@google.com                    return false;
4349875dd14af6d768da8d1a4be58b98fc91ceca0ddtomhudson@google.com            }
4359875dd14af6d768da8d1a4be58b98fc91ceca0ddtomhudson@google.com        }
4369875dd14af6d768da8d1a4be58b98fc91ceca0ddtomhudson@google.com
4379875dd14af6d768da8d1a4be58b98fc91ceca0ddtomhudson@google.com        lldb::addr_t class_addr;
4389875dd14af6d768da8d1a4be58b98fc91ceca0ddtomhudson@google.com        lldb::addr_t sel_addr;
4399875dd14af6d768da8d1a4be58b98fc91ceca0ddtomhudson@google.com    };
4409875dd14af6d768da8d1a4be58b98fc91ceca0ddtomhudson@google.com
4419875dd14af6d768da8d1a4be58b98fc91ceca0ddtomhudson@google.com    typedef std::map<ClassAndSel,lldb::addr_t> MsgImplMap;
4429875dd14af6d768da8d1a4be58b98fc91ceca0ddtomhudson@google.com    MsgImplMap m_impl_cache;
4439875dd14af6d768da8d1a4be58b98fc91ceca0ddtomhudson@google.com
4449875dd14af6d768da8d1a4be58b98fc91ceca0ddtomhudson@google.com    LazyBool m_has_new_literals_and_indexing;
4459875dd14af6d768da8d1a4be58b98fc91ceca0ddtomhudson@google.comprotected:
4468e728d7467ae29dc1a53e4d8b436f91e112a5ee9tomhudson@google.com    typedef std::map<ObjCISA, ClassDescriptorSP> ISAToDescriptorMap;
4479875dd14af6d768da8d1a4be58b98fc91ceca0ddtomhudson@google.com    typedef ISAToDescriptorMap::iterator ISAToDescriptorIterator;
4489875dd14af6d768da8d1a4be58b98fc91ceca0ddtomhudson@google.com    ISAToDescriptorMap                  m_isa_to_descriptor_cache;
4499875dd14af6d768da8d1a4be58b98fc91ceca0ddtomhudson@google.com    bool                                m_isa_to_descriptor_cache_is_up_to_date;
4509875dd14af6d768da8d1a4be58b98fc91ceca0ddtomhudson@google.com
451cae6b3f1e85239f95fcdad2b341ccbe83a8a2a40tomhudson@google.com    typedef std::map<lldb::addr_t,TypeAndOrName> ClassNameMap;
452971d0c8049c6bfc7a58f0b41f8f59f9ec9ca077bbsalomon@google.com    typedef ClassNameMap::iterator ClassNameIterator;
453cae6b3f1e85239f95fcdad2b341ccbe83a8a2a40tomhudson@google.com    ClassNameMap m_class_name_cache;
454b29c883fb46ac6099440d82ac57b86d25386daedbungeman@google.com
4559875dd14af6d768da8d1a4be58b98fc91ceca0ddtomhudson@google.com    typedef std::map<ConstString, lldb::TypeWP> CompleteClassMap;
4569875dd14af6d768da8d1a4be58b98fc91ceca0ddtomhudson@google.com    CompleteClassMap m_complete_class_cache;
457971d0c8049c6bfc7a58f0b41f8f59f9ec9ca077bbsalomon@google.com
4588e728d7467ae29dc1a53e4d8b436f91e112a5ee9tomhudson@google.com    DISALLOW_COPY_AND_ASSIGN (ObjCLanguageRuntime);
4598e728d7467ae29dc1a53e4d8b436f91e112a5ee9tomhudson@google.com};
460971d0c8049c6bfc7a58f0b41f8f59f9ec9ca077bbsalomon@google.com
4618e728d7467ae29dc1a53e4d8b436f91e112a5ee9tomhudson@google.com} // namespace lldb_private
4629875dd14af6d768da8d1a4be58b98fc91ceca0ddtomhudson@google.com
46346cce91f4859b9c229938d4d649870c0a43b1806reed@google.com#endif  // liblldb_ObjCLanguageRuntime_h_
464b29c883fb46ac6099440d82ac57b86d25386daedbungeman@google.com