Skip to content

[lldb] Delete unreachable(ish) code (NFCish) #9923

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

Closed
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
11 changes: 0 additions & 11 deletions lldb/source/Plugins/TypeSystem/Swift/TypeSystemSwiftTypeRef.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3768,17 +3768,6 @@ TypeSystemSwiftTypeRef::GetChildCompilerTypeAtIndex(
if (llvm::StringRef(AsMangledName(type))
.ends_with("sSo18NSNotificationNameaD"))
return GetTypeFromMangledTypename(ConstString("$sSo8NSStringCD"));
if (result->GetMangledTypeName().GetStringRef().count('$') > 1 &&
get_ast_num_children() ==
llvm::expectedToStdOptional(runtime->GetNumChildren(
{weak_from_this(), type}, exe_scope)))
// If available, prefer the AST for private types. Private
// identifiers are not ABI; the runtime returns anonymous private
// identifiers (using a '$' prefix) which cannot match identifiers
// in the AST. Because these private types can't be used in an AST
// context, prefer the AST type if available.
if (auto ast_type = fallback())
return ast_type;
return result;
}
if (!result)
Expand Down
2 changes: 2 additions & 0 deletions lldb/test/API/lang/swift/private_member/Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
SWIFT_SOURCES := main.swift
include Makefile.rules
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
import lldb
from lldbsuite.test.lldbtest import *
from lldbsuite.test.decorators import *
import lldbsuite.test.lldbutil as lldbutil

class TestSwiftPrivateMember(TestBase):

@skipUnlessDarwin
@swiftTest
def test(self):
self.build()

target, process, thread, _ = lldbutil.run_to_source_breakpoint(
self, "break here", lldb.SBFileSpec('main.swift'))
frame = thread.frames[0]
x = frame.FindVariable("x")
member = x.GetChildAtIndex(0)
self.assertIn("23", str(member))
14 changes: 14 additions & 0 deletions lldb/test/API/lang/swift/private_member/main.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
fileprivate struct U {
let i = 23
}

fileprivate struct V {
let member = U()
}

func main() {
let x = V()
print(x) // break here
}

main()