Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion lldb/include/lldb/Symbol/CompilerType.h
Original file line number Diff line number Diff line change
Expand Up @@ -400,7 +400,7 @@ class CompilerType {
/// Return the size of the type in bits.
llvm::Expected<uint64_t> GetBitSize(ExecutionContextScope *exe_scope) const;

lldb::Encoding GetEncoding(uint64_t &count) const;
lldb::Encoding GetEncoding() const;

lldb::Format GetFormat() const;

Expand Down
2 changes: 1 addition & 1 deletion lldb/include/lldb/Symbol/Type.h
Original file line number Diff line number Diff line change
Expand Up @@ -507,7 +507,7 @@ class Type : public std::enable_shared_from_this<Type>, public UserID {

lldb::Format GetFormat();

lldb::Encoding GetEncoding(uint64_t &count);
lldb::Encoding GetEncoding();

SymbolContextScope *GetSymbolContextScope() { return m_context; }
const SymbolContextScope *GetSymbolContextScope() const { return m_context; }
Expand Down
3 changes: 1 addition & 2 deletions lldb/include/lldb/Symbol/TypeSystem.h
Original file line number Diff line number Diff line change
Expand Up @@ -317,8 +317,7 @@ class TypeSystem : public PluginInterface,
GetBitSize(lldb::opaque_compiler_type_t type,
ExecutionContextScope *exe_scope) = 0;

virtual lldb::Encoding GetEncoding(lldb::opaque_compiler_type_t type,
uint64_t &count) = 0;
virtual lldb::Encoding GetEncoding(lldb::opaque_compiler_type_t type) = 0;

virtual lldb::Format GetFormat(lldb::opaque_compiler_type_t type) = 0;

Expand Down
10 changes: 3 additions & 7 deletions lldb/source/Plugins/TypeSystem/Clang/TypeSystemClang.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -4859,12 +4859,10 @@ TypeSystemClang::GetTypeBitAlign(lldb::opaque_compiler_type_t type,
return {};
}

lldb::Encoding TypeSystemClang::GetEncoding(lldb::opaque_compiler_type_t type,
uint64_t &count) {
lldb::Encoding TypeSystemClang::GetEncoding(lldb::opaque_compiler_type_t type) {
if (!type)
return lldb::eEncodingInvalid;

count = 1;
clang::QualType qual_type = RemoveWrappingTypes(GetCanonicalQualType(type));

switch (qual_type->getTypeClass()) {
Expand Down Expand Up @@ -4898,7 +4896,6 @@ lldb::Encoding TypeSystemClang::GetEncoding(lldb::opaque_compiler_type_t type,
case clang::Type::DependentVector:
case clang::Type::ExtVector:
case clang::Type::Vector:
// TODO: Set this to more than one???
break;

case clang::Type::BitInt:
Expand Down Expand Up @@ -5099,11 +5096,10 @@ lldb::Encoding TypeSystemClang::GetEncoding(lldb::opaque_compiler_type_t type,
const clang::ComplexType *complex_type =
qual_type->getAsComplexIntegerType();
if (complex_type)
encoding = GetType(complex_type->getElementType()).GetEncoding(count);
encoding = GetType(complex_type->getElementType()).GetEncoding();
else
encoding = lldb::eEncodingSint;
}
count = 2;
return encoding;
}

Expand Down Expand Up @@ -5160,7 +5156,7 @@ lldb::Encoding TypeSystemClang::GetEncoding(lldb::opaque_compiler_type_t type,
case clang::Type::SubstBuiltinTemplatePack:
break;
}
count = 0;

return lldb::eEncodingInvalid;
}

Expand Down
3 changes: 1 addition & 2 deletions lldb/source/Plugins/TypeSystem/Clang/TypeSystemClang.h
Original file line number Diff line number Diff line change
Expand Up @@ -837,8 +837,7 @@ class TypeSystemClang : public TypeSystem {
GetBitSize(lldb::opaque_compiler_type_t type,
ExecutionContextScope *exe_scope) override;

lldb::Encoding GetEncoding(lldb::opaque_compiler_type_t type,
uint64_t &count) override;
lldb::Encoding GetEncoding(lldb::opaque_compiler_type_t type) override;

lldb::Format GetFormat(lldb::opaque_compiler_type_t type) override;

Expand Down
10 changes: 5 additions & 5 deletions lldb/source/Symbol/CompilerType.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -793,10 +793,10 @@ CompilerType::GetTypeBitAlign(ExecutionContextScope *exe_scope) const {
return {};
}

lldb::Encoding CompilerType::GetEncoding(uint64_t &count) const {
lldb::Encoding CompilerType::GetEncoding() const {
if (IsValid())
if (auto type_system_sp = GetTypeSystem())
return type_system_sp->GetEncoding(m_type, count);
return type_system_sp->GetEncoding(m_type);
return lldb::eEncodingInvalid;
}

Expand Down Expand Up @@ -1093,10 +1093,10 @@ bool CompilerType::GetValueAsScalar(const lldb_private::DataExtractor &data,
if (IsAggregateType()) {
return false; // Aggregate types don't have scalar values
} else {
uint64_t count = 0;
lldb::Encoding encoding = GetEncoding(count);
// FIXME: check that type is scalar instead of checking encoding?
lldb::Encoding encoding = GetEncoding();

if (encoding == lldb::eEncodingInvalid || count != 1)
if (encoding == lldb::eEncodingInvalid || (GetTypeInfo() & eTypeIsComplex))
return false;

auto byte_size_or_err = GetByteSize(exe_scope);
Expand Down
4 changes: 2 additions & 2 deletions lldb/source/Symbol/Type.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -531,9 +531,9 @@ lldb::TypeSP Type::GetTypedefType() {

lldb::Format Type::GetFormat() { return GetForwardCompilerType().GetFormat(); }

lldb::Encoding Type::GetEncoding(uint64_t &count) {
lldb::Encoding Type::GetEncoding() {
// Make sure we resolve our type if it already hasn't been.
return GetForwardCompilerType().GetEncoding(count);
return GetForwardCompilerType().GetEncoding();
}

bool Type::ReadFromMemory(ExecutionContext *exe_ctx, lldb::addr_t addr,
Expand Down
6 changes: 2 additions & 4 deletions lldb/source/ValueObject/ValueObject.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -790,8 +790,7 @@ bool ValueObject::SetData(DataExtractor &data, Status &error) {
return false;
}

uint64_t count = 0;
const Encoding encoding = GetCompilerType().GetEncoding(count);
const Encoding encoding = GetCompilerType().GetEncoding();

const size_t byte_size = llvm::expectedToOptional(GetByteSize()).value_or(0);

Expand Down Expand Up @@ -1669,8 +1668,7 @@ bool ValueObject::SetValueFromCString(const char *value_str, Status &error) {
return false;
}

uint64_t count = 0;
const Encoding encoding = GetCompilerType().GetEncoding(count);
const Encoding encoding = GetCompilerType().GetEncoding();

const size_t byte_size = llvm::expectedToOptional(GetByteSize()).value_or(0);

Expand Down
Loading