Skip to content

Commit a0ebf36

Browse files
committed
Rebase & remove the separate type validity argument
1 parent 69c0ddc commit a0ebf36

File tree

7 files changed

+23
-29
lines changed

7 files changed

+23
-29
lines changed

lldb/include/lldb/Symbol/CompilerType.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -439,7 +439,7 @@ class CompilerType {
439439
uint32_t &child_bitfield_bit_size,
440440
uint32_t &child_bitfield_bit_offset,
441441
bool &child_is_base_class, ValueObject *valobj,
442-
uint64_t &language_flags, bool &type_valid) const;
442+
uint64_t &language_flags) const;
443443

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

lldb/include/lldb/Symbol/TypeSystem.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -369,7 +369,7 @@ class TypeSystem : public PluginInterface,
369369
std::string &child_name, uint32_t &child_byte_size,
370370
int32_t &child_byte_offset, uint32_t &child_bitfield_bit_size,
371371
uint32_t &child_bitfield_bit_offset, bool &child_is_base_class,
372-
ValueObject *valobj, uint64_t &language_flags, bool &type_valid) = 0;
372+
ValueObject *valobj, uint64_t &language_flags) = 0;
373373

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

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

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6185,9 +6185,9 @@ llvm::Expected<CompilerType> TypeSystemClang::GetDereferencedType(
61856185
std::string &child_name, uint32_t &child_byte_size,
61866186
int32_t &child_byte_offset, uint32_t &child_bitfield_bit_size,
61876187
uint32_t &child_bitfield_bit_offset, bool &child_is_base_class,
6188-
ValueObject *valobj, uint64_t &language_flags, bool &type_valid) {
6189-
type_valid = IsPointerOrReferenceType(type, nullptr) ||
6190-
IsArrayType(type, nullptr, nullptr, nullptr);
6188+
ValueObject *valobj, uint64_t &language_flags) {
6189+
bool type_valid = IsPointerOrReferenceType(type, nullptr) ||
6190+
IsArrayType(type, nullptr, nullptr, nullptr);
61916191
if (!type_valid)
61926192
return llvm::createStringError("not a pointer, reference or array type");
61936193
bool child_is_deref_of_parent;

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -894,7 +894,7 @@ class TypeSystemClang : public TypeSystem {
894894
std::string &child_name, uint32_t &child_byte_size,
895895
int32_t &child_byte_offset, uint32_t &child_bitfield_bit_size,
896896
uint32_t &child_bitfield_bit_offset, bool &child_is_base_class,
897-
ValueObject *valobj, uint64_t &language_flags, bool &type_valid) override;
897+
ValueObject *valobj, uint64_t &language_flags) override;
898898

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

lldb/source/Symbol/CompilerType.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -897,14 +897,14 @@ llvm::Expected<CompilerType> CompilerType::GetDereferencedType(
897897
ExecutionContext *exe_ctx, std::string &child_name,
898898
uint32_t &child_byte_size, int32_t &child_byte_offset,
899899
uint32_t &child_bitfield_bit_size, uint32_t &child_bitfield_bit_offset,
900-
bool &child_is_base_class, ValueObject *valobj, uint64_t &language_flags,
901-
bool &type_valid) const {
900+
bool &child_is_base_class, ValueObject *valobj,
901+
uint64_t &language_flags) const {
902902
if (IsValid())
903903
if (auto type_system_sp = GetTypeSystem())
904904
return type_system_sp->GetDereferencedType(
905905
m_type, exe_ctx, child_name, child_byte_size, child_byte_offset,
906906
child_bitfield_bit_size, child_bitfield_bit_offset,
907-
child_is_base_class, valobj, language_flags, type_valid);
907+
child_is_base_class, valobj, language_flags);
908908
return CompilerType();
909909
}
910910

lldb/source/ValueObject/ValueObject.cpp

Lines changed: 13 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -2802,29 +2802,18 @@ ValueObjectSP ValueObject::Dereference(Status &error) {
28022802
bool child_is_base_class = false;
28032803
CompilerType compiler_type = GetCompilerType();
28042804
uint64_t language_flags = 0;
2805-
bool is_valid_dereference_type = false;
28062805

28072806
ExecutionContext exe_ctx(GetExecutionContextRef());
28082807

28092808
CompilerType child_compiler_type;
28102809
auto child_compiler_type_or_err = compiler_type.GetDereferencedType(
28112810
&exe_ctx, child_name_str, child_byte_size, child_byte_offset,
28122811
child_bitfield_bit_size, child_bitfield_bit_offset, child_is_base_class,
2813-
this, language_flags, is_valid_dereference_type);
2812+
this, language_flags);
28142813

28152814
std::string deref_error;
2816-
if (!child_compiler_type_or_err) {
2817-
auto err = child_compiler_type_or_err.takeError();
2818-
if (err.isA<llvm::StringError>()) {
2819-
deref_error = llvm::toString(std::move(err));
2820-
LLDB_LOG_ERROR(GetLog(LLDBLog::Types),
2821-
llvm::createStringError(deref_error),
2822-
"could not find child: {0}");
2823-
}
2824-
} else
2815+
if (child_compiler_type_or_err) {
28252816
child_compiler_type = *child_compiler_type_or_err;
2826-
2827-
if (is_valid_dereference_type) {
28282817
if (child_compiler_type && child_byte_size) {
28292818
ConstString child_name;
28302819
if (!child_name_str.empty())
@@ -2858,8 +2847,17 @@ ValueObjectSP ValueObject::Dereference(Status &error) {
28582847
}
28592848
}
28602849
}
2861-
} else if (IsSynthetic()) {
2862-
m_deref_valobj = GetChildMemberWithName("$$dereference$$").get();
2850+
} 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+
}
2858+
if (IsSynthetic()) {
2859+
m_deref_valobj = GetChildMemberWithName("$$dereference$$").get();
2860+
}
28632861
}
28642862

28652863
if (m_deref_valobj) {

lldb/test/API/commands/frame/var-dil/basics/PointerArithmetic/TestFrameVarDILPointerArithmetic.py

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -33,11 +33,7 @@ def test_dereference(self):
3333
self.expect_var_path("*offset_pref", True, type="int *")
3434
self.expect_var_path("**pp_int0", value="0")
3535
self.expect_var_path("&**pp_int0", type="int *")
36-
self.expect(
37-
"frame var '*array'",
38-
error=True,
39-
substrs=["not a pointer or reference type"],
40-
)
36+
self.expect_var_path("*array", value="0")
4137
self.expect(
4238
"frame var '&*p_null'",
4339
error=True,

0 commit comments

Comments
 (0)