Skip to content

Commit 5ca75b9

Browse files
committed
Disable loading scalars as addresses when materializing an entity variable
1 parent 6779a95 commit 5ca75b9

File tree

5 files changed

+35
-5
lines changed

5 files changed

+35
-5
lines changed

lldb/source/Expression/Materializer.cpp

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -492,10 +492,7 @@ class EntityVariable : public Materializer::Entity {
492492
const bool is_dynamic_class_type =
493493
m_is_generic &&
494494
(valobj_type.GetTypeClass() == lldb::eTypeClassClass);
495-
const bool scalar_is_load_address = m_is_generic; // this is the only
496-
// time we're dealing
497-
// with dynamic values
498-
495+
const bool scalar_is_load_address = false;
499496
// if the dynamic type is a class, bypass the GetAddressOf() optimization
500497
// as it doesn't do the right thing
501498
lldb::addr_t addr_of_valobj =

lldb/test/API/lang/swift/expression/class_constrained_protocol/TestClassConstrainedProtocol.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,6 @@ def test_extension_weak_self (self):
2424
self.do_self_test("Break here for weak self")
2525

2626
@swiftTest
27-
@expectedFailureAll(oslist=["linux"], bugnumber="rdar://31822722")
2827
def test_extension_self (self):
2928
"""Test that we can reconstruct self in method of a class constrained protocol."""
3029
self.build()
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
SWIFT_SOURCES := main.swift
2+
3+
include Makefile.rules
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
2+
from lldbsuite.test.lldbtest import *
3+
from lldbsuite.test.decorators import *
4+
5+
6+
class TestSwiftProtocolExtensionSelf(TestBase):
7+
8+
mydir = TestBase.compute_mydir(__file__)
9+
10+
@swiftTest
11+
def test(self):
12+
"""Test that the generic self in a protocol extension works in the expression evaluator.
13+
"""
14+
self.build()
15+
16+
lldbutil.run_to_source_breakpoint(self, "break here",
17+
lldb.SBFileSpec('main.swift'))
18+
self.expect("e f", substrs=[' = 12345'])
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
class C : CP {
2+
let f: Int = 12345
3+
}
4+
5+
protocol CP : class {}
6+
7+
extension CP {
8+
func foo() {
9+
print(self) // break here
10+
}
11+
}
12+
13+
C().foo()

0 commit comments

Comments
 (0)