summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--lldb/include/lldb/Symbol/Type.h38
-rw-r--r--lldb/source/Plugins/SymbolFile/DWARF/DWARFASTParserClang.cpp28
-rw-r--r--lldb/source/Plugins/SymbolFile/NativePDB/SymbolFileNativePDB.cpp22
-rw-r--r--lldb/source/Plugins/SymbolFile/PDB/PDBASTParser.cpp24
-rw-r--r--lldb/source/Symbol/Type.cpp51
5 files changed, 74 insertions, 89 deletions
diff --git a/lldb/include/lldb/Symbol/Type.h b/lldb/include/lldb/Symbol/Type.h
index 446e043a95e..ae61f99b4a4 100644
--- a/lldb/include/lldb/Symbol/Type.h
+++ b/lldb/include/lldb/Symbol/Type.h
@@ -84,18 +84,12 @@ public:
eEncodingIsSyntheticUID
};
- // We must force the underlying type of the enum to be unsigned here. Not
- // all compilers behave the same with regards to the default underlying type
- // of an enum, but because this enum is used in an enum bitfield and integer
- // comparisons are done with the value we need to guarantee that it's always
- // unsigned so that, for example, eResolveStateFull doesn't compare less than
- // eResolveStateUnresolved when used in a 2-bit bitfield.
- typedef enum ResolveStateTag : unsigned {
- eResolveStateUnresolved = 0,
- eResolveStateForward = 1,
- eResolveStateLayout = 2,
- eResolveStateFull = 3
- } ResolveState;
+ enum class ResolveState : unsigned char {
+ Unresolved = 0,
+ Forward = 1,
+ Layout = 2,
+ Full = 3
+ };
Type(lldb::user_id_t uid, SymbolFile *symbol_file, ConstString name,
llvm::Optional<uint64_t> byte_size, SymbolContextScope *context,
@@ -200,17 +194,17 @@ public:
uint32_t GetEncodingMask();
- bool IsCompleteObjCClass() { return m_flags.is_complete_objc_class; }
+ bool IsCompleteObjCClass() { return m_is_complete_objc_class; }
void SetIsCompleteObjCClass(bool is_complete_objc_class) {
- m_flags.is_complete_objc_class = is_complete_objc_class;
+ m_is_complete_objc_class = is_complete_objc_class;
}
protected:
ConstString m_name;
SymbolFile *m_symbol_file;
- SymbolContextScope
- *m_context; // The symbol context in which this type is defined
+ /// The symbol context in which this type is defined.
+ SymbolContextScope *m_context;
Type *m_encoding_type;
lldb::user_id_t m_encoding_uid;
EncodingDataType m_encoding_uid_type;
@@ -218,16 +212,8 @@ protected:
uint64_t m_byte_size_has_value : 1;
Declaration m_decl;
CompilerType m_compiler_type;
-
- struct Flags {
-#ifdef __GNUC__
- // using unsigned type here to work around a very noisy gcc warning
- unsigned compiler_type_resolve_state : 2;
-#else
- ResolveState compiler_type_resolve_state : 2;
-#endif
- bool is_complete_objc_class : 1;
- } m_flags;
+ ResolveState m_compiler_type_resolve_state;
+ bool m_is_complete_objc_class;
Type *GetEncodingType();
diff --git a/lldb/source/Plugins/SymbolFile/DWARF/DWARFASTParserClang.cpp b/lldb/source/Plugins/SymbolFile/DWARF/DWARFASTParserClang.cpp
index 30572974fe9..24b9e75d03e 100644
--- a/lldb/source/Plugins/SymbolFile/DWARF/DWARFASTParserClang.cpp
+++ b/lldb/source/Plugins/SymbolFile/DWARF/DWARFASTParserClang.cpp
@@ -226,7 +226,7 @@ TypeSP DWARFASTParserClang::ParseTypeFromClangModule(const SymbolContext &sc,
TypeSP type_sp(new Type(
die.GetID(), dwarf, pcm_type_sp->GetName(), pcm_type_sp->GetByteSize(),
nullptr, LLDB_INVALID_UID, Type::eEncodingInvalid,
- &pcm_type_sp->GetDeclaration(), type, Type::eResolveStateForward));
+ &pcm_type_sp->GetDeclaration(), type, Type::ResolveState::Forward));
dwarf->GetTypeList().Insert(type_sp);
dwarf->GetDIEToType()[die.GetDIE()] = type_sp.get();
@@ -450,7 +450,7 @@ TypeSP DWARFASTParserClang::ParseTypeFromDWARF(const SymbolContext &sc,
const dw_tag_t tag = die.Tag();
- Type::ResolveState resolve_state = Type::eResolveStateUnresolved;
+ Type::ResolveState resolve_state = Type::ResolveState::Unresolved;
Type::EncodingDataType encoding_data_type = Type::eEncodingIsUID;
CompilerType clang_type;
@@ -516,7 +516,7 @@ TypeSP DWARFASTParserClang::ParseTypeFromDWARF(const SymbolContext &sc,
case DW_TAG_unspecified_type:
if (attrs.name == "nullptr_t" || attrs.name == "decltype(nullptr)") {
- resolve_state = Type::eResolveStateFull;
+ resolve_state = Type::ResolveState::Full;
clang_type = m_ast.GetBasicType(eBasicTypeNullPtr);
break;
}
@@ -525,7 +525,7 @@ TypeSP DWARFASTParserClang::ParseTypeFromDWARF(const SymbolContext &sc,
LLVM_FALLTHROUGH;
case DW_TAG_base_type:
- resolve_state = Type::eResolveStateFull;
+ resolve_state = Type::ResolveState::Full;
clang_type = m_ast.GetBuiltinTypeForDWARFEncodingAndBitSize(
attrs.name.GetCString(), attrs.encoding,
attrs.byte_size.getValueOr(0) * 8);
@@ -583,7 +583,7 @@ TypeSP DWARFASTParserClang::ParseTypeFromDWARF(const SymbolContext &sc,
lldb_function_type_sp->GetForwardCompilerType());
encoding_data_type = Type::eEncodingIsUID;
attrs.type.Clear();
- resolve_state = Type::eResolveStateFull;
+ resolve_state = Type::ResolveState::Full;
}
}
@@ -610,7 +610,7 @@ TypeSP DWARFASTParserClang::ParseTypeFromDWARF(const SymbolContext &sc,
clang_type = m_ast.GetBasicType(eBasicTypeObjCID);
encoding_data_type = Type::eEncodingIsUID;
attrs.type.Clear();
- resolve_state = Type::eResolveStateFull;
+ resolve_state = Type::ResolveState::Full;
} else if (attrs.name == g_objc_type_name_Class) {
if (log)
@@ -622,7 +622,7 @@ TypeSP DWARFASTParserClang::ParseTypeFromDWARF(const SymbolContext &sc,
clang_type = m_ast.GetBasicType(eBasicTypeObjCClass);
encoding_data_type = Type::eEncodingIsUID;
attrs.type.Clear();
- resolve_state = Type::eResolveStateFull;
+ resolve_state = Type::ResolveState::Full;
} else if (attrs.name == g_objc_type_name_selector) {
if (log)
dwarf->GetObjectFile()->GetModule()->LogMessage(
@@ -633,7 +633,7 @@ TypeSP DWARFASTParserClang::ParseTypeFromDWARF(const SymbolContext &sc,
clang_type = m_ast.GetBasicType(eBasicTypeObjCSel);
encoding_data_type = Type::eEncodingIsUID;
attrs.type.Clear();
- resolve_state = Type::eResolveStateFull;
+ resolve_state = Type::ResolveState::Full;
}
} else if (encoding_data_type == Type::eEncodingIsPointerUID &&
attrs.type.IsValid()) {
@@ -655,7 +655,7 @@ TypeSP DWARFASTParserClang::ParseTypeFromDWARF(const SymbolContext &sc,
clang_type = m_ast.GetBasicType(eBasicTypeObjCID);
encoding_data_type = Type::eEncodingIsUID;
attrs.type.Clear();
- resolve_state = Type::eResolveStateFull;
+ resolve_state = Type::ResolveState::Full;
}
}
}
@@ -763,7 +763,7 @@ TypeSP DWARFASTParserClang::ParseTypeFromDWARF(const SymbolContext &sc,
type_sp = std::make_shared<Type>(
die.GetID(), dwarf, attrs.name, attrs.byte_size, nullptr,
dwarf->GetUID(attrs.type.Reference()), Type::eEncodingIsUID,
- &attrs.decl, clang_type, Type::eResolveStateForward);
+ &attrs.decl, clang_type, Type::ResolveState::Forward);
if (ClangASTContext::StartTagDeclarationDefinition(clang_type)) {
if (die.HasChildren()) {
@@ -1189,7 +1189,7 @@ TypeSP DWARFASTParserClang::ParseTypeFromDWARF(const SymbolContext &sc,
}
type_sp = std::make_shared<Type>(
die.GetID(), dwarf, attrs.name, llvm::None, nullptr, LLDB_INVALID_UID,
- Type::eEncodingIsUID, &attrs.decl, clang_type, Type::eResolveStateFull);
+ Type::eEncodingIsUID, &attrs.decl, clang_type, Type::ResolveState::Full);
assert(type_sp.get());
} break;
@@ -1272,7 +1272,7 @@ TypeSP DWARFASTParserClang::ParseTypeFromDWARF(const SymbolContext &sc,
type_sp = std::make_shared<Type>(
die.GetID(), dwarf, empty_name, array_element_bit_stride / 8, nullptr,
dwarf->GetUID(type_die), Type::eEncodingIsUID, &attrs.decl,
- clang_type, Type::eResolveStateFull);
+ clang_type, Type::ResolveState::Full);
type_sp->SetEncodingType(element_type);
m_ast.SetMetadataAsUserID(clang_type.GetOpaqueQualType(), die.GetID());
}
@@ -1294,7 +1294,7 @@ TypeSP DWARFASTParserClang::ParseTypeFromDWARF(const SymbolContext &sc,
type_sp = std::make_shared<Type>(
die.GetID(), dwarf, attrs.name, *clang_type_size, nullptr,
LLDB_INVALID_UID, Type::eEncodingIsUID, nullptr, clang_type,
- Type::eResolveStateForward);
+ Type::ResolveState::Forward);
}
break;
@@ -1600,7 +1600,7 @@ DWARFASTParserClang::ParseStructureLikeDIE(const SymbolContext &sc,
type_sp = std::make_shared<Type>(die.GetID(), dwarf, attrs.name,
attrs.byte_size, nullptr, LLDB_INVALID_UID,
Type::eEncodingIsUID, &attrs.decl,
- clang_type, Type::eResolveStateForward);
+ clang_type, Type::ResolveState::Forward);
type_sp->SetIsCompleteObjCClass(attrs.is_complete_objc_class);
diff --git a/lldb/source/Plugins/SymbolFile/NativePDB/SymbolFileNativePDB.cpp b/lldb/source/Plugins/SymbolFile/NativePDB/SymbolFileNativePDB.cpp
index 36317afea78..f0308e23c9d 100644
--- a/lldb/source/Plugins/SymbolFile/NativePDB/SymbolFileNativePDB.cpp
+++ b/lldb/source/Plugins/SymbolFile/NativePDB/SymbolFileNativePDB.cpp
@@ -462,7 +462,7 @@ lldb::TypeSP SymbolFileNativePDB::CreateModifierType(PdbTypeSymId type_id,
return std::make_shared<Type>(toOpaqueUid(type_id), this, ConstString(name),
modified_type->GetByteSize(), nullptr,
LLDB_INVALID_UID, Type::eEncodingIsUID, decl,
- ct, Type::eResolveStateFull);
+ ct, Type::ResolveState::Full);
}
lldb::TypeSP
@@ -482,7 +482,7 @@ SymbolFileNativePDB::CreatePointerType(PdbTypeSymId type_id,
return std::make_shared<Type>(toOpaqueUid(type_id), this, ConstString(),
pr.getSize(), nullptr, LLDB_INVALID_UID,
Type::eEncodingIsUID, decl, ct,
- Type::eResolveStateFull);
+ Type::ResolveState::Full);
}
lldb::TypeSP SymbolFileNativePDB::CreateSimpleType(TypeIndex ti,
@@ -492,7 +492,7 @@ lldb::TypeSP SymbolFileNativePDB::CreateSimpleType(TypeIndex ti,
Declaration decl;
return std::make_shared<Type>(
uid, this, ConstString("std::nullptr_t"), 0, nullptr, LLDB_INVALID_UID,
- Type::eEncodingIsUID, decl, ct, Type::eResolveStateFull);
+ Type::eEncodingIsUID, decl, ct, Type::ResolveState::Full);
}
if (ti.getSimpleMode() != SimpleTypeMode::Direct) {
@@ -513,7 +513,7 @@ lldb::TypeSP SymbolFileNativePDB::CreateSimpleType(TypeIndex ti,
Declaration decl;
return std::make_shared<Type>(
uid, this, ConstString(), pointer_size, nullptr, LLDB_INVALID_UID,
- Type::eEncodingIsUID, decl, ct, Type::eResolveStateFull);
+ Type::eEncodingIsUID, decl, ct, Type::ResolveState::Full);
}
if (ti.getSimpleKind() == SimpleTypeKind::NotTranslated)
@@ -525,7 +525,7 @@ lldb::TypeSP SymbolFileNativePDB::CreateSimpleType(TypeIndex ti,
Declaration decl;
return std::make_shared<Type>(uid, this, ConstString(type_name), size,
nullptr, LLDB_INVALID_UID, Type::eEncodingIsUID,
- decl, ct, Type::eResolveStateFull);
+ decl, ct, Type::ResolveState::Full);
}
static std::string GetUnqualifiedTypeName(const TagRecord &record) {
@@ -559,7 +559,7 @@ SymbolFileNativePDB::CreateClassStructUnion(PdbTypeSymId type_id,
return std::make_shared<Type>(toOpaqueUid(type_id), this, ConstString(uname),
size, nullptr, LLDB_INVALID_UID,
Type::eEncodingIsUID, decl, ct,
- Type::eResolveStateForward);
+ Type::ResolveState::Forward);
}
lldb::TypeSP SymbolFileNativePDB::CreateTagType(PdbTypeSymId type_id,
@@ -586,7 +586,7 @@ lldb::TypeSP SymbolFileNativePDB::CreateTagType(PdbTypeSymId type_id,
toOpaqueUid(type_id), this, ConstString(uname),
underlying_type->GetByteSize(), nullptr, LLDB_INVALID_UID,
lldb_private::Type::eEncodingIsUID, decl, ct,
- lldb_private::Type::eResolveStateForward);
+ lldb_private::Type::ResolveState::Forward);
}
TypeSP SymbolFileNativePDB::CreateArrayType(PdbTypeSymId type_id,
@@ -598,7 +598,7 @@ TypeSP SymbolFileNativePDB::CreateArrayType(PdbTypeSymId type_id,
TypeSP array_sp = std::make_shared<lldb_private::Type>(
toOpaqueUid(type_id), this, ConstString(), ar.Size, nullptr,
LLDB_INVALID_UID, lldb_private::Type::eEncodingIsUID, decl, ct,
- lldb_private::Type::eResolveStateFull);
+ lldb_private::Type::ResolveState::Full);
array_sp->SetEncodingType(element_type.get());
return array_sp;
}
@@ -611,7 +611,7 @@ TypeSP SymbolFileNativePDB::CreateFunctionType(PdbTypeSymId type_id,
return std::make_shared<lldb_private::Type>(
toOpaqueUid(type_id), this, ConstString(), 0, nullptr, LLDB_INVALID_UID,
lldb_private::Type::eEncodingIsUID, decl, ct,
- lldb_private::Type::eResolveStateFull);
+ lldb_private::Type::ResolveState::Full);
}
TypeSP SymbolFileNativePDB::CreateProcedureType(PdbTypeSymId type_id,
@@ -621,7 +621,7 @@ TypeSP SymbolFileNativePDB::CreateProcedureType(PdbTypeSymId type_id,
return std::make_shared<lldb_private::Type>(
toOpaqueUid(type_id), this, ConstString(), 0, nullptr, LLDB_INVALID_UID,
lldb_private::Type::eEncodingIsUID, decl, ct,
- lldb_private::Type::eResolveStateFull);
+ lldb_private::Type::ResolveState::Full);
}
TypeSP SymbolFileNativePDB::CreateType(PdbTypeSymId type_id, CompilerType ct) {
@@ -1389,7 +1389,7 @@ TypeSP SymbolFileNativePDB::CreateTypedef(PdbGlobalSymId id) {
toOpaqueUid(id), this, ConstString(udt.Name), target_type->GetByteSize(),
nullptr, target_type->GetID(), lldb_private::Type::eEncodingIsTypedefUID,
decl, target_type->GetForwardCompilerType(),
- lldb_private::Type::eResolveStateForward);
+ lldb_private::Type::ResolveState::Forward);
}
TypeSP SymbolFileNativePDB::GetOrCreateTypedef(PdbGlobalSymId id) {
diff --git a/lldb/source/Plugins/SymbolFile/PDB/PDBASTParser.cpp b/lldb/source/Plugins/SymbolFile/PDB/PDBASTParser.cpp
index 47c4ad08849..ccb5b6373ee 100644
--- a/lldb/source/Plugins/SymbolFile/PDB/PDBASTParser.cpp
+++ b/lldb/source/Plugins/SymbolFile/PDB/PDBASTParser.cpp
@@ -405,7 +405,7 @@ lldb::TypeSP PDBASTParser::CreateLLDBTypeFromPDBType(const PDBSymbol &type) {
// This may occur with const or volatile types. There are separate type
// symbols in PDB for types with const or volatile modifiers, but we need
// to create only one declaration for them all.
- Type::ResolveStateTag type_resolve_state_tag;
+ Type::ResolveState type_resolve_state;
CompilerType clang_type = m_ast.GetTypeForIdentifier<clang::CXXRecordDecl>(
ConstString(name), decl_context);
if (!clang_type.IsValid()) {
@@ -442,7 +442,7 @@ lldb::TypeSP PDBASTParser::CreateLLDBTypeFromPDBType(const PDBSymbol &type) {
ClangASTContext::SetHasExternalStorage(clang_type.GetOpaqueQualType(),
false);
- type_resolve_state_tag = Type::eResolveStateFull;
+ type_resolve_state = Type::ResolveState::Full;
} else {
// Add the type to the forward declarations. It will help us to avoid
// an endless recursion in CompleteTypeFromUdt function.
@@ -451,10 +451,10 @@ lldb::TypeSP PDBASTParser::CreateLLDBTypeFromPDBType(const PDBSymbol &type) {
ClangASTContext::SetHasExternalStorage(clang_type.GetOpaqueQualType(),
true);
- type_resolve_state_tag = Type::eResolveStateForward;
+ type_resolve_state = Type::ResolveState::Forward;
}
} else
- type_resolve_state_tag = Type::eResolveStateForward;
+ type_resolve_state = Type::ResolveState::Forward;
if (udt->isConstType())
clang_type = clang_type.AddConstModifier();
@@ -467,7 +467,7 @@ lldb::TypeSP PDBASTParser::CreateLLDBTypeFromPDBType(const PDBSymbol &type) {
type.getSymIndexId(), m_ast.GetSymbolFile(), ConstString(name),
udt->getLength(), nullptr, LLDB_INVALID_UID,
lldb_private::Type::eEncodingIsUID, decl, clang_type,
- type_resolve_state_tag);
+ type_resolve_state);
} break;
case PDB_SymType::Enum: {
auto enum_type = llvm::dyn_cast<PDBSymbolTypeEnum>(&type);
@@ -535,7 +535,7 @@ lldb::TypeSP PDBASTParser::CreateLLDBTypeFromPDBType(const PDBSymbol &type) {
return std::make_shared<lldb_private::Type>(
type.getSymIndexId(), m_ast.GetSymbolFile(), ConstString(name), bytes,
nullptr, LLDB_INVALID_UID, lldb_private::Type::eEncodingIsUID, decl,
- ast_enum, lldb_private::Type::eResolveStateFull);
+ ast_enum, lldb_private::Type::ResolveState::Full);
} break;
case PDB_SymType::Typedef: {
auto type_def = llvm::dyn_cast<PDBSymbolTypeTypedef>(&type);
@@ -581,7 +581,7 @@ lldb::TypeSP PDBASTParser::CreateLLDBTypeFromPDBType(const PDBSymbol &type) {
type_def->getSymIndexId(), m_ast.GetSymbolFile(), ConstString(name),
size, nullptr, target_type->GetID(),
lldb_private::Type::eEncodingIsTypedefUID, decl, ast_typedef,
- lldb_private::Type::eResolveStateFull);
+ lldb_private::Type::ResolveState::Full);
} break;
case PDB_SymType::Function:
case PDB_SymType::FunctionSig: {
@@ -649,7 +649,7 @@ lldb::TypeSP PDBASTParser::CreateLLDBTypeFromPDBType(const PDBSymbol &type) {
type.getSymIndexId(), m_ast.GetSymbolFile(), ConstString(name),
llvm::None, nullptr, LLDB_INVALID_UID,
lldb_private::Type::eEncodingIsUID, decl, func_sig_ast_type,
- lldb_private::Type::eResolveStateFull);
+ lldb_private::Type::ResolveState::Full);
} break;
case PDB_SymType::ArrayType: {
auto array_type = llvm::dyn_cast<PDBSymbolTypeArray>(&type);
@@ -683,7 +683,7 @@ lldb::TypeSP PDBASTParser::CreateLLDBTypeFromPDBType(const PDBSymbol &type) {
TypeSP type_sp = std::make_shared<lldb_private::Type>(
array_type->getSymIndexId(), m_ast.GetSymbolFile(), ConstString(),
bytes, nullptr, LLDB_INVALID_UID, lldb_private::Type::eEncodingIsUID,
- decl, array_ast_type, lldb_private::Type::eResolveStateFull);
+ decl, array_ast_type, lldb_private::Type::ResolveState::Full);
type_sp->SetEncodingType(element_type);
return type_sp;
} break;
@@ -712,7 +712,7 @@ lldb::TypeSP PDBASTParser::CreateLLDBTypeFromPDBType(const PDBSymbol &type) {
return std::make_shared<lldb_private::Type>(
builtin_type->getSymIndexId(), m_ast.GetSymbolFile(), type_name, bytes,
nullptr, LLDB_INVALID_UID, lldb_private::Type::eEncodingIsUID, decl,
- builtin_ast_type, lldb_private::Type::eResolveStateFull);
+ builtin_ast_type, lldb_private::Type::ResolveState::Full);
} break;
case PDB_SymType::PointerType: {
auto *pointer_type = llvm::dyn_cast<PDBSymbolTypePointer>(&type);
@@ -739,7 +739,7 @@ lldb::TypeSP PDBASTParser::CreateLLDBTypeFromPDBType(const PDBSymbol &type) {
pointer_type->getSymIndexId(), m_ast.GetSymbolFile(), ConstString(),
pointer_type->getLength(), nullptr, LLDB_INVALID_UID,
lldb_private::Type::eEncodingIsUID, decl, pointer_ast_type,
- lldb_private::Type::eResolveStateForward);
+ lldb_private::Type::ResolveState::Forward);
}
CompilerType pointer_ast_type;
@@ -764,7 +764,7 @@ lldb::TypeSP PDBASTParser::CreateLLDBTypeFromPDBType(const PDBSymbol &type) {
pointer_type->getSymIndexId(), m_ast.GetSymbolFile(), ConstString(),
pointer_type->getLength(), nullptr, LLDB_INVALID_UID,
lldb_private::Type::eEncodingIsUID, decl, pointer_ast_type,
- lldb_private::Type::eResolveStateFull);
+ lldb_private::Type::ResolveState::Full);
} break;
default:
break;
diff --git a/lldb/source/Symbol/Type.cpp b/lldb/source/Symbol/Type.cpp
index 5666590c224..c3e5c037095 100644
--- a/lldb/source/Symbol/Type.cpp
+++ b/lldb/source/Symbol/Type.cpp
@@ -139,16 +139,19 @@ Type *SymbolFileType::GetType() {
return m_type_sp.get();
}
-Type::Type(lldb::user_id_t uid, SymbolFile *symbol_file,
- ConstString name, llvm::Optional<uint64_t> byte_size,
- SymbolContextScope *context, user_id_t encoding_uid,
- EncodingDataType encoding_uid_type, const Declaration &decl,
- const CompilerType &compiler_type,
+Type::Type(lldb::user_id_t uid, SymbolFile *symbol_file, ConstString name,
+ llvm::Optional<uint64_t> byte_size, SymbolContextScope *context,
+ user_id_t encoding_uid, EncodingDataType encoding_uid_type,
+ const Declaration &decl, const CompilerType &compiler_type,
ResolveState compiler_type_resolve_state)
: std::enable_shared_from_this<Type>(), UserID(uid), m_name(name),
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_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) {
if (byte_size) {
m_byte_size = *byte_size;
m_byte_size_has_value = true;
@@ -156,19 +159,15 @@ Type::Type(lldb::user_id_t uid, SymbolFile *symbol_file,
m_byte_size = 0;
m_byte_size_has_value = false;
}
- m_flags.compiler_type_resolve_state =
- (compiler_type ? compiler_type_resolve_state : eResolveStateUnresolved);
- m_flags.is_complete_objc_class = false;
}
Type::Type()
: std::enable_shared_from_this<Type>(), UserID(0), m_name("<INVALID TYPE>"),
m_symbol_file(nullptr), m_context(nullptr), m_encoding_type(nullptr),
m_encoding_uid(LLDB_INVALID_UID), m_encoding_uid_type(eEncodingInvalid),
- m_byte_size(0), m_byte_size_has_value(false), m_decl(),
- m_compiler_type() {
- m_flags.compiler_type_resolve_state = eResolveStateUnresolved;
- m_flags.is_complete_objc_class = false;
+ m_compiler_type_resolve_state(ResolveState::Unresolved) {
+ m_byte_size = 0;
+ m_byte_size_has_value = false;
}
void Type::GetDescription(Stream *s, lldb::DescriptionLevel level,
@@ -308,7 +307,7 @@ void Type::DumpValue(ExecutionContext *exe_ctx, Stream *s,
const DataExtractor &data, uint32_t data_byte_offset,
bool show_types, bool show_summary, bool verbose,
lldb::Format format) {
- if (ResolveClangType(eResolveStateForward)) {
+ if (ResolveClangType(ResolveState::Forward)) {
if (show_types) {
s->PutChar('(');
if (verbose)
@@ -472,8 +471,8 @@ bool Type::ResolveClangType(ResolveState compiler_type_resolve_state) {
encoding_type->GetForwardCompilerType();
if (encoding_compiler_type.IsValid()) {
m_compiler_type = encoding_compiler_type;
- m_flags.compiler_type_resolve_state =
- encoding_type->m_flags.compiler_type_resolve_state;
+ m_compiler_type_resolve_state =
+ encoding_type->m_compiler_type_resolve_state;
}
} break;
@@ -574,16 +573,16 @@ bool Type::ResolveClangType(ResolveState compiler_type_resolve_state) {
// set to eResolveStateUnresolved so we need to update it to say that we
// now have a forward declaration since that is what we created above.
if (m_compiler_type.IsValid())
- m_flags.compiler_type_resolve_state = eResolveStateForward;
+ m_compiler_type_resolve_state = ResolveState::Forward;
}
// Check if we have a forward reference to a class/struct/union/enum?
- if (compiler_type_resolve_state == eResolveStateLayout ||
- compiler_type_resolve_state == eResolveStateFull) {
+ if (compiler_type_resolve_state == ResolveState::Layout ||
+ compiler_type_resolve_state == ResolveState::Full) {
// Check if we have a forward reference to a class/struct/union/enum?
if (m_compiler_type.IsValid() &&
- m_flags.compiler_type_resolve_state < compiler_type_resolve_state) {
- m_flags.compiler_type_resolve_state = eResolveStateFull;
+ m_compiler_type_resolve_state < compiler_type_resolve_state) {
+ m_compiler_type_resolve_state = ResolveState::Full;
if (!m_compiler_type.IsDefined()) {
// We have a forward declaration, we need to resolve it to a complete
// definition.
@@ -601,12 +600,12 @@ bool Type::ResolveClangType(ResolveState compiler_type_resolve_state) {
ResolveState encoding_compiler_type_resolve_state =
compiler_type_resolve_state;
- if (compiler_type_resolve_state == eResolveStateLayout) {
+ if (compiler_type_resolve_state == ResolveState::Layout) {
switch (m_encoding_uid_type) {
case eEncodingIsPointerUID:
case eEncodingIsLValueReferenceUID:
case eEncodingIsRValueReferenceUID:
- encoding_compiler_type_resolve_state = eResolveStateForward;
+ encoding_compiler_type_resolve_state = ResolveState::Forward;
break;
default:
break;
@@ -627,17 +626,17 @@ uint32_t Type::GetEncodingMask() {
}
CompilerType Type::GetFullCompilerType() {
- ResolveClangType(eResolveStateFull);
+ ResolveClangType(ResolveState::Full);
return m_compiler_type;
}
CompilerType Type::GetLayoutCompilerType() {
- ResolveClangType(eResolveStateLayout);
+ ResolveClangType(ResolveState::Layout);
return m_compiler_type;
}
CompilerType Type::GetForwardCompilerType() {
- ResolveClangType(eResolveStateForward);
+ ResolveClangType(ResolveState::Forward);
return m_compiler_type;
}
OpenPOWER on IntegriCloud