Index: lldb/include/lldb/Symbol/Type.h =================================================================== --- lldb/include/lldb/Symbol/Type.h +++ lldb/include/lldb/Symbol/Type.h @@ -195,12 +195,7 @@ void SetEncodingType(Type *encoding_type) { m_encoding_type = encoding_type; } uint32_t GetEncodingMask(); - - bool IsCompleteObjCClass() { return m_is_complete_objc_class; } - - void SetIsCompleteObjCClass(bool is_complete_objc_class) { - m_is_complete_objc_class = is_complete_objc_class; - } + uint32_t &GetPayload() { return m_payload; } protected: ConstString m_name; @@ -215,7 +210,8 @@ Declaration m_decl; CompilerType m_compiler_type; ResolveState m_compiler_type_resolve_state; - bool m_is_complete_objc_class; + /// Language-specific flags. + uint32_t m_payload = 0; Type *GetEncodingType(); Index: lldb/source/Plugins/LanguageRuntime/ObjC/ObjCLanguageRuntime.cpp =================================================================== --- lldb/source/Plugins/LanguageRuntime/ObjC/ObjCLanguageRuntime.cpp +++ lldb/source/Plugins/LanguageRuntime/ObjC/ObjCLanguageRuntime.cpp @@ -129,7 +129,7 @@ if (TypeSystemClang::IsObjCObjectOrInterfaceType( type_sp->GetForwardCompilerType())) { - if (type_sp->IsCompleteObjCClass()) { + if (TypePayloadClang(type_sp->GetPayload()).IsCompleteObjCClass()) { m_complete_class_cache[name] = type_sp; return type_sp; } Index: lldb/source/Plugins/SymbolFile/DWARF/DWARFASTParserClang.cpp =================================================================== --- lldb/source/Plugins/SymbolFile/DWARF/DWARFASTParserClang.cpp +++ lldb/source/Plugins/SymbolFile/DWARF/DWARFASTParserClang.cpp @@ -1627,7 +1627,8 @@ Type::eEncodingIsUID, &attrs.decl, clang_type, Type::ResolveState::Forward); - type_sp->SetIsCompleteObjCClass(attrs.is_complete_objc_class); + TypePayloadClang(type_sp->GetPayload()) + .SetIsCompleteObjCClass(attrs.is_complete_objc_class); // Add our type to the unique type map so we don't end up creating many // copies of the same type over and over in the ASTContext for our Index: lldb/source/Plugins/TypeSystem/Clang/TypeSystemClang.h =================================================================== --- lldb/source/Plugins/TypeSystem/Clang/TypeSystemClang.h +++ lldb/source/Plugins/TypeSystem/Clang/TypeSystemClang.h @@ -33,6 +33,7 @@ #include "lldb/Symbol/TypeSystem.h" #include "lldb/Target/Target.h" #include "lldb/Utility/ConstString.h" +#include "lldb/Utility/Flags.h" #include "lldb/Utility/Log.h" #include "lldb/Utility/Logging.h" #include "lldb/lldb-enumerations.h" @@ -40,12 +41,41 @@ class DWARFASTParserClang; class PDBASTParser; +namespace clang { + class HeaderSearch; + class ModuleMap; +} + namespace lldb_private { class ClangASTMetadata; class ClangASTSource; class Declaration; +/// The implementation of lldb::Type's m_payload field for TypeSystemClang. +class TypePayloadClang { + uint32_t &m_payload; +public: + TypePayloadClang(uint32_t &opaque_payload) : m_payload(opaque_payload) {} + /// Clang-specific functions. As more of these get added we may want + /// to factor this into typesystem-specific subclasses. + /// \{ + static constexpr unsigned ObjCClassBit = 1 << 31; + bool IsCompleteObjCClass() { return Flags(m_payload).Test(ObjCClassBit); } + void SetIsCompleteObjCClass(bool is_complete_objc_class) { + m_payload = is_complete_objc_class ? Flags(m_payload).Set(ObjCClassBit) + : Flags(m_payload).Clear(ObjCClassBit); + } + unsigned GetOwningModuleID() { return Flags(m_payload).Clear(ObjCClassBit); } + void SetOwningModuleID(unsigned id) { + assert(id < ObjCClassBit); + bool is_complete = IsCompleteObjCClass(); + m_payload = id; + SetIsCompleteObjCClass(is_complete); + } + /// \} +}; + /// A TypeSystem implementation based on Clang. /// /// This class uses a single clang::ASTContext as the backend for storing Index: lldb/source/Symbol/Type.cpp =================================================================== --- lldb/source/Symbol/Type.cpp +++ lldb/source/Symbol/Type.cpp @@ -148,10 +148,8 @@ m_symbol_file(symbol_file), m_context(context), m_encoding_type(nullptr), m_encoding_uid(encoding_uid), m_encoding_uid_type(encoding_uid_type), m_decl(decl), m_compiler_type(compiler_type), - m_compiler_type_resolve_state( - compiler_type ? compiler_type_resolve_state - : ResolveState::Unresolved), - m_is_complete_objc_class(false) { + m_compiler_type_resolve_state(compiler_type ? compiler_type_resolve_state + : ResolveState::Unresolved) { if (byte_size) { m_byte_size = *byte_size; m_byte_size_has_value = true;