Skip to content

Commit fea5ac2

Browse files
committed
Disable loading scalars as addresses when materializing an entity variable
1 parent f9c5e0c commit fea5ac2

File tree

5 files changed

+34
-5
lines changed

5 files changed

+34
-5
lines changed

lldb/source/Expression/Materializer.cpp

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -497,10 +497,7 @@ class EntityVariable : public Materializer::Entity {
497497
const bool is_dynamic_class_type =
498498
m_is_generic &&
499499
(valobj_type.GetTypeClass() == lldb::eTypeClassClass);
500-
const bool scalar_is_load_address = m_is_generic; // this is the only
501-
// time we're dealing
502-
// with dynamic values
503-
500+
const bool scalar_is_load_address = false;
504501
// if the dynamic type is a class, bypass the GetAddressOf() optimization
505502
// as it doesn't do the right thing
506503
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: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
# TestSelfFromRegister.py
2+
#
3+
# This source file is part of the Swift.org open source project
4+
#
5+
# Copyright (c) 2014 - 2020 Apple Inc. and the Swift project authors
6+
# Licensed under Apache License v2.0 with Runtime Library Exception
7+
#
8+
# See https://swift.org/LICENSE.txt for license information
9+
# See https://swift.org/CONTRIBUTORS.txt for the list of Swift project authors
10+
#
11+
# ------------------------------------------------------------------------------
12+
13+
import lldbsuite.test.lldbinline as lldbinline
14+
from lldbsuite.test.decorators import *
15+
16+
# Test that loading self from a register works as expected
17+
lldbinline.MakeInlineTest(__file__, globals(), decorators=[swiftTest])
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) //% self.expect('e f', substrs=[' = 12345'])
10+
}
11+
}
12+
13+
C().foo()

0 commit comments

Comments
 (0)