File tree 6 files changed +64
-1
lines changed
source/Plugins/LanguageRuntime/Swift
test/API/lang/swift/c_type_ivar
6 files changed +64
-1
lines changed Original file line number Diff line number Diff line change @@ -169,7 +169,7 @@ class TargetReflectionContext : public ReflectionContextInterface {
169
169
return nullptr ;
170
170
171
171
auto start =
172
- m_reflection_ctx.computeUnalignedFieldStartOffset (type_ref);
172
+ m_reflection_ctx.computeUnalignedFieldStartOffset (type_ref, provider );
173
173
if (!start) {
174
174
if (auto *log = GetLog (LLDBLog::Types)) {
175
175
std::stringstream ss;
Original file line number Diff line number Diff line change
1
+ // Simulates the CoreFoundation CF_BRIDGED_TYPE(id) macro.
2
+ typedef struct __attribute__((objc_bridge (id ))) {} * BridgedPtr ;
Original file line number Diff line number Diff line change
1
+ module Foo {
2
+ header "Foo.h"
3
+ }
Original file line number Diff line number Diff line change
1
+ SWIFT_OBJC_INTEROP := 1
2
+ SWIFT_SOURCES := main.swift
3
+ SWIFTFLAGS_EXTRAS = -Xcc -I$(SRCDIR ) /Foo
4
+ include Makefile.rules
Original file line number Diff line number Diff line change
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 number Diff line number Diff line change
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 ( )
You can’t perform that action at this time.
0 commit comments