File tree Expand file tree Collapse file tree 1 file changed +60
-0
lines changed
validation-test/Reflection Expand file tree Collapse file tree 1 file changed +60
-0
lines changed Original file line number Diff line number Diff line change 1+ // RUN: %empty-directory(%t)
2+ // RUN: split-file %s %t
3+ // %target-clangxx -c %S/Inputs/Cxx/pimpl.cpp -I %S/Inputs/Cxx -o %t/pimpl.o
4+ // RUN: %target-build-swift -lswiftSwiftReflectionTest %t/reflect_Cxx.swift -I %t -cxx-interoperability-mode=default -o %t/reflect_Cxx
5+ // RUN: %target-codesign %t/reflect_Cxx
6+
7+ // RUN: %target-run %target-swift-reflection-test %t/reflect_Cxx | tee /dev/stderr | %FileCheck %s
8+
9+ // REQUIRES: reflection_test_support
10+ // REQUIRES: executable_test
11+ // UNSUPPORTED: back_deployment_runtime
12+ // UNSUPPORTED: use_os_stdlib
13+ // UNSUPPORTED: asan
14+
15+ //--- module.modulemap
16+
17+ module CxxStruct {
18+ header " CxxStruct.h "
19+ requires cplusplus
20+ export *
21+ }
22+
23+ //--- CxxStruct.h
24+
25+ struct CxxStructA {
26+ private:
27+ int i;
28+ } ;
29+
30+ inline CxxStructA createCxxStructA( ) {
31+ return CxxStructA ( ) ;
32+ }
33+
34+ //--- reflect_Cxx.swift
35+
36+ import SwiftReflectionTest
37+ import CxxStruct
38+
39+ // Trigger type metadata to be emitted by conforming C++ types to a Swift protocol.
40+ protocol MyProto { }
41+ extension CxxStructA : MyProto { }
42+
43+ let a = createCxxStructA ( )
44+ reflect ( any: a)
45+
46+ // CHECK: Reflecting an existential.
47+ // CHECK-NEXT: Instance pointer in child address space: 0x{{[0-9a-fA-F]+}}
48+ // CHECK-NEXT: Type reference:
49+ // CHECK-NEXT: (struct __C.CxxStructA)
50+
51+ // CHECK: Type info:
52+ // CHECK-NEXT: (builtin size=4 alignment=4 stride=4 num_extra_inhabitants=0 bitwise_takable=1)
53+ // CHECK-NEXT: Mangled name: $sSo10CxxStructAV
54+ // CHECK-NEXT: Demangled name: __C.CxxStructA
55+
56+ // CHECK: Start of instance data: 0x{{[0-9a-fA-F]+}}
57+
58+ doneReflecting ( )
59+
60+ // CHECK: Done.
You can’t perform that action at this time.
0 commit comments