-
Notifications
You must be signed in to change notification settings - Fork 13.6k
[lldb] Restore ObjC incomplete type dereferencing fix #139567
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
@llvm/pr-subscribers-lldb Author: Ilia Kuklin (kuilpd) ChangesAttempt an ObjC incomplete type fix even if Full diff: https://github.com/llvm/llvm-project/pull/139567.diff 1 Files Affected:
diff --git a/lldb/source/ValueObject/ValueObject.cpp b/lldb/source/ValueObject/ValueObject.cpp
index 6f0fe9a5b83f9..46426ae499be9 100644
--- a/lldb/source/ValueObject/ValueObject.cpp
+++ b/lldb/source/ValueObject/ValueObject.cpp
@@ -2810,46 +2810,47 @@ ValueObjectSP ValueObject::Dereference(Status &error) {
std::string deref_error;
if (deref_compiler_type_or_err) {
deref_compiler_type = *deref_compiler_type_or_err;
- if (deref_compiler_type && deref_byte_size) {
- ConstString deref_name;
- if (!deref_name_str.empty())
- deref_name.SetCString(deref_name_str.c_str());
-
- m_deref_valobj =
- new ValueObjectChild(*this, deref_compiler_type, deref_name,
- deref_byte_size, deref_byte_offset, 0, 0, false,
- true, eAddressTypeInvalid, language_flags);
- }
-
- // In case of incomplete deref compiler type, use the pointee type and try
- // to recreate a new ValueObjectChild using it.
- if (!m_deref_valobj) {
- // FIXME(#59012): C++ stdlib formatters break with incomplete types (e.g.
- // `std::vector<int> &`). Remove ObjC restriction once that's resolved.
- if (Language::LanguageIsObjC(GetPreferredDisplayLanguage()) &&
- HasSyntheticValue()) {
- deref_compiler_type = compiler_type.GetPointeeType();
-
- if (deref_compiler_type) {
- ConstString deref_name;
- if (!deref_name_str.empty())
- deref_name.SetCString(deref_name_str.c_str());
-
- m_deref_valobj = new ValueObjectChild(
- *this, deref_compiler_type, deref_name, deref_byte_size,
- deref_byte_offset, 0, 0, false, true, eAddressTypeInvalid,
- language_flags);
- }
- }
- }
} else {
deref_error = llvm::toString(deref_compiler_type_or_err.takeError());
LLDB_LOG(GetLog(LLDBLog::Types), "could not find child: {0}", deref_error);
- if (IsSynthetic()) {
- m_deref_valobj = GetChildMemberWithName("$$dereference$$").get();
+ }
+
+ if (deref_compiler_type && deref_byte_size) {
+ ConstString deref_name;
+ if (!deref_name_str.empty())
+ deref_name.SetCString(deref_name_str.c_str());
+
+ m_deref_valobj =
+ new ValueObjectChild(*this, deref_compiler_type, deref_name,
+ deref_byte_size, deref_byte_offset, 0, 0, false,
+ true, eAddressTypeInvalid, language_flags);
+ }
+
+ // In case of incomplete deref compiler type, use the pointee type and try
+ // to recreate a new ValueObjectChild using it.
+ if (!m_deref_valobj) {
+ // FIXME(#59012): C++ stdlib formatters break with incomplete types (e.g.
+ // `std::vector<int> &`). Remove ObjC restriction once that's resolved.
+ if (Language::LanguageIsObjC(GetPreferredDisplayLanguage()) &&
+ HasSyntheticValue()) {
+ deref_compiler_type = compiler_type.GetPointeeType();
+
+ if (deref_compiler_type) {
+ ConstString deref_name;
+ if (!deref_name_str.empty())
+ deref_name.SetCString(deref_name_str.c_str());
+
+ m_deref_valobj = new ValueObjectChild(
+ *this, deref_compiler_type, deref_name, deref_byte_size,
+ deref_byte_offset, 0, 0, false, true, eAddressTypeInvalid,
+ language_flags);
+ }
}
}
+ if (!m_deref_valobj && IsSynthetic())
+ m_deref_valobj = GetChildMemberWithName("$$dereference$$").get();
+
if (m_deref_valobj) {
error.Clear();
return m_deref_valobj->GetSP();
|
@felipepiovezan |
I'll try that for you. |
@kuilpd The test passes after applying this patch. Feel free to land this whenever :) |
Thank you! |
Attempt an ObjC incomplete type fix even if
GetDereferencedType
returns an error.