Skip to content

Commit 322a135

Browse files
committed
Remove more arguments, simplify error logging, adjust test.
1 parent a0ebf36 commit 322a135

File tree

7 files changed

+28
-45
lines changed

7 files changed

+28
-45
lines changed

lldb/include/lldb/Symbol/CompilerType.h

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -436,10 +436,7 @@ class CompilerType {
436436
llvm::Expected<CompilerType>
437437
GetDereferencedType(ExecutionContext *exe_ctx, std::string &child_name,
438438
uint32_t &child_byte_size, int32_t &child_byte_offset,
439-
uint32_t &child_bitfield_bit_size,
440-
uint32_t &child_bitfield_bit_offset,
441-
bool &child_is_base_class, ValueObject *valobj,
442-
uint64_t &language_flags) const;
439+
ValueObject *valobj, uint64_t &language_flags) const;
443440

444441
llvm::Expected<CompilerType> GetChildCompilerTypeAtIndex(
445442
ExecutionContext *exe_ctx, size_t idx, bool transparent_pointers,

lldb/include/lldb/Symbol/TypeSystem.h

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -364,12 +364,11 @@ class TypeSystem : public PluginInterface,
364364
return CompilerDecl();
365365
}
366366

367-
virtual llvm::Expected<CompilerType> GetDereferencedType(
368-
lldb::opaque_compiler_type_t type, ExecutionContext *exe_ctx,
369-
std::string &child_name, uint32_t &child_byte_size,
370-
int32_t &child_byte_offset, uint32_t &child_bitfield_bit_size,
371-
uint32_t &child_bitfield_bit_offset, bool &child_is_base_class,
372-
ValueObject *valobj, uint64_t &language_flags) = 0;
367+
virtual llvm::Expected<CompilerType>
368+
GetDereferencedType(lldb::opaque_compiler_type_t type,
369+
ExecutionContext *exe_ctx, std::string &child_name,
370+
uint32_t &child_byte_size, int32_t &child_byte_offset,
371+
ValueObject *valobj, uint64_t &language_flags) = 0;
373372

374373
virtual llvm::Expected<CompilerType> GetChildCompilerTypeAtIndex(
375374
lldb::opaque_compiler_type_t type, ExecutionContext *exe_ctx, size_t idx,

lldb/source/Plugins/TypeSystem/Clang/TypeSystemClang.cpp

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6183,13 +6183,14 @@ uint32_t TypeSystemClang::GetNumPointeeChildren(clang::QualType type) {
61836183
llvm::Expected<CompilerType> TypeSystemClang::GetDereferencedType(
61846184
lldb::opaque_compiler_type_t type, ExecutionContext *exe_ctx,
61856185
std::string &child_name, uint32_t &child_byte_size,
6186-
int32_t &child_byte_offset, uint32_t &child_bitfield_bit_size,
6187-
uint32_t &child_bitfield_bit_offset, bool &child_is_base_class,
6188-
ValueObject *valobj, uint64_t &language_flags) {
6186+
int32_t &child_byte_offset, ValueObject *valobj, uint64_t &language_flags) {
61896187
bool type_valid = IsPointerOrReferenceType(type, nullptr) ||
61906188
IsArrayType(type, nullptr, nullptr, nullptr);
61916189
if (!type_valid)
61926190
return llvm::createStringError("not a pointer, reference or array type");
6191+
uint32_t child_bitfield_bit_size = 0;
6192+
uint32_t child_bitfield_bit_offset = 0;
6193+
bool child_is_base_class;
61936194
bool child_is_deref_of_parent;
61946195
return GetChildCompilerTypeAtIndex(
61956196
type, exe_ctx, 0, false, true, false, child_name, child_byte_size,

lldb/source/Plugins/TypeSystem/Clang/TypeSystemClang.h

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -889,12 +889,11 @@ class TypeSystemClang : public TypeSystem {
889889

890890
static uint32_t GetNumPointeeChildren(clang::QualType type);
891891

892-
llvm::Expected<CompilerType> GetDereferencedType(
893-
lldb::opaque_compiler_type_t type, ExecutionContext *exe_ctx,
894-
std::string &child_name, uint32_t &child_byte_size,
895-
int32_t &child_byte_offset, uint32_t &child_bitfield_bit_size,
896-
uint32_t &child_bitfield_bit_offset, bool &child_is_base_class,
897-
ValueObject *valobj, uint64_t &language_flags) override;
892+
llvm::Expected<CompilerType>
893+
GetDereferencedType(lldb::opaque_compiler_type_t type,
894+
ExecutionContext *exe_ctx, std::string &child_name,
895+
uint32_t &child_byte_size, int32_t &child_byte_offset,
896+
ValueObject *valobj, uint64_t &language_flags) override;
898897

899898
llvm::Expected<CompilerType> GetChildCompilerTypeAtIndex(
900899
lldb::opaque_compiler_type_t type, ExecutionContext *exe_ctx, size_t idx,

lldb/source/Symbol/CompilerType.cpp

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -895,16 +895,13 @@ CompilerDecl CompilerType::GetStaticFieldWithName(llvm::StringRef name) const {
895895

896896
llvm::Expected<CompilerType> CompilerType::GetDereferencedType(
897897
ExecutionContext *exe_ctx, std::string &child_name,
898-
uint32_t &child_byte_size, int32_t &child_byte_offset,
899-
uint32_t &child_bitfield_bit_size, uint32_t &child_bitfield_bit_offset,
900-
bool &child_is_base_class, ValueObject *valobj,
898+
uint32_t &child_byte_size, int32_t &child_byte_offset, ValueObject *valobj,
901899
uint64_t &language_flags) const {
902900
if (IsValid())
903901
if (auto type_system_sp = GetTypeSystem())
904902
return type_system_sp->GetDereferencedType(
905903
m_type, exe_ctx, child_name, child_byte_size, child_byte_offset,
906-
child_bitfield_bit_size, child_bitfield_bit_offset,
907-
child_is_base_class, valobj, language_flags);
904+
valobj, language_flags);
908905
return CompilerType();
909906
}
910907

lldb/source/ValueObject/ValueObject.cpp

Lines changed: 10 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -2797,19 +2797,15 @@ ValueObjectSP ValueObject::Dereference(Status &error) {
27972797
std::string child_name_str;
27982798
uint32_t child_byte_size = 0;
27992799
int32_t child_byte_offset = 0;
2800-
uint32_t child_bitfield_bit_size = 0;
2801-
uint32_t child_bitfield_bit_offset = 0;
2802-
bool child_is_base_class = false;
28032800
CompilerType compiler_type = GetCompilerType();
28042801
uint64_t language_flags = 0;
28052802

28062803
ExecutionContext exe_ctx(GetExecutionContextRef());
28072804

28082805
CompilerType child_compiler_type;
28092806
auto child_compiler_type_or_err = compiler_type.GetDereferencedType(
2810-
&exe_ctx, child_name_str, child_byte_size, child_byte_offset,
2811-
child_bitfield_bit_size, child_bitfield_bit_offset, child_is_base_class,
2812-
this, language_flags);
2807+
&exe_ctx, child_name_str, child_byte_size, child_byte_offset, this,
2808+
language_flags);
28132809

28142810
std::string deref_error;
28152811
if (child_compiler_type_or_err) {
@@ -2819,10 +2815,10 @@ ValueObjectSP ValueObject::Dereference(Status &error) {
28192815
if (!child_name_str.empty())
28202816
child_name.SetCString(child_name_str.c_str());
28212817

2822-
m_deref_valobj = new ValueObjectChild(
2823-
*this, child_compiler_type, child_name, child_byte_size,
2824-
child_byte_offset, child_bitfield_bit_size, child_bitfield_bit_offset,
2825-
child_is_base_class, true, eAddressTypeInvalid, language_flags);
2818+
m_deref_valobj =
2819+
new ValueObjectChild(*this, child_compiler_type, child_name,
2820+
child_byte_size, child_byte_offset, 0, 0, false,
2821+
true, eAddressTypeInvalid, language_flags);
28262822
}
28272823

28282824
// In case of incomplete child compiler type, use the pointee type and try
@@ -2841,20 +2837,14 @@ ValueObjectSP ValueObject::Dereference(Status &error) {
28412837

28422838
m_deref_valobj = new ValueObjectChild(
28432839
*this, child_compiler_type, child_name, child_byte_size,
2844-
child_byte_offset, child_bitfield_bit_size,
2845-
child_bitfield_bit_offset, child_is_base_class, true,
2846-
eAddressTypeInvalid, language_flags);
2840+
child_byte_offset, 0, 0, false, true, eAddressTypeInvalid,
2841+
language_flags);
28472842
}
28482843
}
28492844
}
28502845
} else {
2851-
auto err = child_compiler_type_or_err.takeError();
2852-
if (err.isA<llvm::StringError>()) {
2853-
deref_error = llvm::toString(std::move(err));
2854-
LLDB_LOG_ERROR(GetLog(LLDBLog::Types),
2855-
llvm::createStringError(deref_error),
2856-
"could not find child: {0}");
2857-
}
2846+
deref_error = llvm::toString(child_compiler_type_or_err.takeError());
2847+
LLDB_LOG(GetLog(LLDBLog::Types), "could not find child: {0}", deref_error);
28582848
if (IsSynthetic()) {
28592849
m_deref_valobj = GetChildMemberWithName("$$dereference$$").get();
28602850
}

lldb/test/API/functionalities/data-formatter/data-formatter-stl/generic/optional/TestDataFormatterGenericOptional.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -88,7 +88,7 @@ def cleanup():
8888
self.expect(
8989
"frame variable *number_not_engaged",
9090
error=True,
91-
substrs=["dereference failed: not a"],
91+
substrs=["dereference failed: not a pointer, reference or array type"],
9292
)
9393

9494
@add_test_categories(["libc++"])

0 commit comments

Comments
 (0)