Skip to content

[Cherry-pick into swift/release/5.10] Fix DWARF parsing for (some) opaque Swift types. #7823

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

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -164,7 +164,7 @@ lldb::TypeSP DWARFASTParserSwift::ParseTypeFromDWARF(const SymbolContext &sc,
m_swift_typesystem.GetTypeFromMangledTypename(mangled_name);
}

if (!compiler_type && name) {
if (!compiler_type && die.Tag() == DW_TAG_typedef) {
// Handle Archetypes, which are typedefs to RawPointerType.
llvm::StringRef typedef_name = GetTypedefName(die);
if (typedef_name.startswith("$sBp")) {
Expand Down
2 changes: 2 additions & 0 deletions lldb/test/API/lang/swift/opaque_type/Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
SWIFT_SOURCES := main.swift
include Makefile.rules
17 changes: 17 additions & 0 deletions lldb/test/API/lang/swift/opaque_type/TestSwiftOpaqueType.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
import lldb
from lldbsuite.test.lldbtest import *
from lldbsuite.test.decorators import *
import lldbsuite.test.lldbutil as lldbutil
import unittest2


class TestSwiftOpaque(TestBase):

@swiftTest
def test(self):
"""Test opaque types in parameter positions"""
self.build()
lldbutil.run_to_source_breakpoint(self, "break here",
lldb.SBFileSpec("main.swift"))
self.expect("v p", substrs=["C", "23"])

11 changes: 11 additions & 0 deletions lldb/test/API/lang/swift/opaque_type/main.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
protocol P {}

class C: P {
let i = 23
}

func f(_ p : some P) {
print("break here")
}

f(C())