Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit b8ed493

Browse files
augusto2112bnbarham
authored andcommitted
[lldb] Pass descriptor finder to computeUnalignedFieldStartOffset
rdar://128141491
1 parent c0ae354 commit b8ed493

File tree

6 files changed

+64
-1
lines changed

6 files changed

+64
-1
lines changed

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

+1-1
Original file line numberDiff line numberDiff line change
@@ -169,7 +169,7 @@ class TargetReflectionContext : public ReflectionContextInterface {
169169
return nullptr;
170170

171171
auto start =
172-
m_reflection_ctx.computeUnalignedFieldStartOffset(type_ref);
172+
m_reflection_ctx.computeUnalignedFieldStartOffset(type_ref, provider);
173173
if (!start) {
174174
if (auto *log = GetLog(LLDBLog::Types)) {
175175
std::stringstream ss;
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
// Simulates the CoreFoundation CF_BRIDGED_TYPE(id) macro.
2+
typedef struct __attribute__((objc_bridge(id))) {} *BridgedPtr;
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
module Foo {
2+
header "Foo.h"
3+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
SWIFT_OBJC_INTEROP := 1
2+
SWIFT_SOURCES := main.swift
3+
SWIFTFLAGS_EXTRAS = -Xcc -I$(SRCDIR)/Foo
4+
include Makefile.rules
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
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 TestSwiftCTypeIvar(TestBase):
9+
@swiftTest
10+
@skipIf(setting=("symbols.use-swift-clangimporter", "false"))
11+
def test(self):
12+
"""Test that the extra inhabitants are correctly computed for various
13+
kinds of Objective-C pointers, by using them in enums."""
14+
self.build()
15+
# Disable SwiftASTContext because we want to test we resolve the type
16+
# by looking up the clang type in debug info.
17+
self.runCmd("settings set symbols.swift-enable-ast-context false")
18+
lldbutil.run_to_source_breakpoint(
19+
self, "break here", lldb.SBFileSpec("main.swift")
20+
)
21+
# self.expect('v a', substrs=['asdf'])
22+
a = self.frame().FindVariable("a")
23+
lldbutil.check_variable(
24+
self,
25+
a.GetChildAtIndex(0),
26+
typename="Swift.Optional<Foo.BridgedPtr>",
27+
value="none",
28+
)
29+
30+
b = self.frame().FindVariable("b")
31+
lldbutil.check_variable(
32+
self,
33+
a.GetChildAtIndex(0),
34+
typename="Swift.Optional<Foo.BridgedPtr>",
35+
value="none",
36+
)
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
import Foo
2+
3+
class A {
4+
let bridged : BridgedPtr? = nil
5+
}
6+
7+
class B : A {}
8+
9+
func use<T>(_ t: T) {}
10+
11+
func main() {
12+
let a = A()
13+
let b = B()
14+
use(a)
15+
use(b) // break here
16+
}
17+
18+
main()

0 commit comments

Comments
 (0)