Skip to content

Commit c66f74a

Browse files
Merge pull request #10499 from adrian-prantl/149329166
[lldb] Avoid returning a false positive error when reaching an ObjC b…
2 parents edd19f7 + fb48ea1 commit c66f74a

File tree

4 files changed

+40
-0
lines changed

4 files changed

+40
-0
lines changed

lldb/source/Plugins/LanguageRuntime/Swift/SwiftLanguageRuntimeDynamicTypeResolution.cpp

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1059,6 +1059,8 @@ SwiftLanguageRuntime::GetIndexOfChildMemberWithName(
10591059
// superclass, and ends on null.
10601060
auto *current_tr = tr;
10611061
while (current_tr) {
1062+
if (llvm::isa<swift::reflection::ObjCClassTypeRef>(current_tr))
1063+
break;
10621064
auto cti_or_err = reflection_ctx->GetClassInstanceTypeInfo(
10631065
*current_tr, &tip, ts.GetDescriptorFinder());
10641066
const TypeInfo *cti = nullptr;
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+
import lldb
2+
from lldbsuite.test.lldbtest import *
3+
from lldbsuite.test.decorators import *
4+
import lldbsuite.test.lldbutil as lldbutil
5+
6+
class TestSwiftObjCBaseClassMemberLookup(TestBase):
7+
NO_DEBUG_INFO_TESTCASE = True
8+
@skipUnlessDarwin
9+
@swiftTest
10+
def test(self):
11+
"""Test accessing a static member from a member function"""
12+
self.build()
13+
lldbutil.run_to_source_breakpoint(
14+
self, 'break here', lldb.SBFileSpec('main.swift')
15+
)
16+
17+
# dwim-print start by checking whether a member 'A' exists in 'self'.
18+
self.expect("dwim-print A.shared", substrs=["42"])
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
import Foundation
2+
3+
class A {
4+
public static var shared = A()
5+
let a = 42
6+
}
7+
8+
class C : NSObject {
9+
var c = 0
10+
func foo() {
11+
print("break here")
12+
c = 1
13+
}
14+
}
15+
16+
C().foo()
17+

0 commit comments

Comments
 (0)