Skip to content

Commit ce8facb

Browse files
committed
Fix DWARF parsing for (some) opaque Swift types.
The only thing that prevented this test from working was the fact that DWARFASTParserSwift expected an Archetype name in the typedef. rdar://115997836 (cherry picked from commit 9f94c54)
1 parent 3b3ee58 commit ce8facb

File tree

4 files changed

+31
-1
lines changed

4 files changed

+31
-1
lines changed

lldb/source/Plugins/SymbolFile/DWARF/DWARFASTParserSwift.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -166,7 +166,7 @@ lldb::TypeSP DWARFASTParserSwift::ParseTypeFromDWARF(const SymbolContext &sc,
166166
m_swift_typesystem.GetTypeFromMangledTypename(mangled_name);
167167
}
168168

169-
if (!compiler_type && name) {
169+
if (!compiler_type && die.Tag() == DW_TAG_typedef) {
170170
// Handle Archetypes, which are typedefs to RawPointerType.
171171
llvm::StringRef typedef_name = GetTypedefName(die);
172172
if (typedef_name.startswith("$sBp")) {
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
SWIFT_SOURCES := main.swift
2+
include Makefile.rules
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
import lldb
2+
from lldbsuite.test.lldbtest import *
3+
from lldbsuite.test.decorators import *
4+
import lldbsuite.test.lldbutil as lldbutil
5+
import unittest2
6+
7+
8+
class TestSwiftOpaque(TestBase):
9+
10+
@swiftTest
11+
def test(self):
12+
"""Test opaque types in parameter positions"""
13+
self.build()
14+
lldbutil.run_to_source_breakpoint(self, "break here",
15+
lldb.SBFileSpec("main.swift"))
16+
self.expect("v p", substrs=["C", "23"])
17+
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
protocol P {}
2+
3+
class C: P {
4+
let i = 23
5+
}
6+
7+
func f(_ p : some P) {
8+
print("break here")
9+
}
10+
11+
f(C())

0 commit comments

Comments
 (0)