mirror of
https://github.com/apple/swift.git
synced 2025-12-21 12:14:44 +01:00
It is really involved to change how methods and classes are emitted into the header so this patch introduces the impression of nested structs through using statements and still emits the structs themselves as top level structs. It emits them in their own namespace to avoid name collisions. This patch also had to change some names to be fully qualified to avoid some name lookup errors in case of nested structs. Moreover, nesting level of 3 and above requires C++17 because it relies on nested namespaces. Only nested structs are supported, not nested classes. Since this patch is already started to grow quite big, I decided to put it out for reviews and plan to address some of the shortcomings in a follow-up PR. rdar://118793469
17 lines
644 B
Swift
17 lines
644 B
Swift
// RUN: %empty-directory(%t)
|
|
// RUN: %target-swift-frontend %s -typecheck -module-name Test -clang-header-expose-decls=all-public -emit-clang-header-path %t/empty.h
|
|
// RUN: %FileCheck %s < %t/empty.h
|
|
|
|
// RUN: %check-interop-cxx-header-in-clang(%t/empty.h)
|
|
|
|
// CHECK: #ifdef SWIFT_SYMBOL
|
|
// CHECK-NEXT: #undef SWIFT_SYMBOL
|
|
// CHECK-NEXT: #endif
|
|
// CHECK-NEXT: #define SWIFT_SYMBOL(usrValue) SWIFT_SYMBOL_MODULE_USR("Test", usrValue)
|
|
|
|
// CHECK-LABEL: namespace Test SWIFT_PRIVATE_ATTR SWIFT_SYMBOL_MODULE({{.*}}) {
|
|
// CHECK: } // namespace Test
|
|
// CHECK-EMPTY:
|
|
// CHECK-NEXT: #pragma clang diagnostic pop
|
|
// CHECK-NEXT: #undef SWIFT_SYMBOL
|