File tree Expand file tree Collapse file tree 2 files changed +28
-0
lines changed
test/Interop/CxxToSwiftToCxx Expand file tree Collapse file tree 2 files changed +28
-0
lines changed Original file line number Diff line number Diff line change @@ -96,6 +96,14 @@ bool ClangSyntaxPrinter::printNominalTypeOutsideMemberDeclInnerStaticAssert(
96
96
}
97
97
98
98
void ClangSyntaxPrinter::printClangTypeReference (const clang::Decl *typeDecl) {
99
+ if (cast<clang::NamedDecl>(typeDecl)->getDeclName ().isEmpty () &&
100
+ isa<clang::TagDecl>(typeDecl)) {
101
+ if (auto *tnd =
102
+ cast<clang::TagDecl>(typeDecl)->getTypedefNameForAnonDecl ()) {
103
+ printClangTypeReference (tnd);
104
+ return ;
105
+ }
106
+ }
99
107
auto &clangCtx = typeDecl->getASTContext ();
100
108
clang::PrintingPolicy pp (clangCtx.getLangOpts ());
101
109
const auto *NS = clang::NestedNameSpecifier::getRequiredQualification (
Original file line number Diff line number Diff line change @@ -80,6 +80,14 @@ namespace ns {
80
80
81
81
using SimpleTypedef = int;
82
82
83
+ typedef struct { float column; } anonymousStruct;
84
+
85
+ namespace ns {
86
+
87
+ using anonStructInNS = struct { float row; } ;
88
+
89
+ }
90
+
83
91
//--- module.modulemap
84
92
module CxxTest {
85
93
header " header.h "
@@ -149,6 +157,12 @@ public func takeTrivial(_ x: Trivial) {
149
157
public func takeTrivialInout( _ x: inout Trivial ) {
150
158
}
151
159
160
+ @_expose ( Cxx)
161
+ public struct Strct {
162
+ public let transform : anonymousStruct
163
+ public let transform2 : ns . anonStructInNS
164
+ }
165
+
152
166
// CHECK: #if __has_feature(objc_modules)
153
167
// CHECK: #if __has_feature(objc_modules)
154
168
// CHECK-NEXT: #if __has_warning("-Watimport-in-framework-header")
@@ -284,3 +298,9 @@ public func takeTrivialInout(_ x: inout Trivial) {
284
298
// CHECK: SWIFT_INLINE_THUNK void takeTrivialInout(Trivial& x) noexcept SWIFT_SYMBOL({{.*}}) {
285
299
// CHECK-NEXT: return _impl::$s8UseCxxTy16takeTrivialInoutyySo0E0VzF(swift::_impl::getOpaquePointer(x));
286
300
// CHECK-NEXT: }
301
+
302
+ // CHECK: SWIFT_INLINE_THUNK anonymousStruct Strct::getTransform() const {
303
+ // CHECK-NEXT: alignas(alignof(anonymousStruct)) char storage[sizeof(anonymousStruct)];
304
+
305
+ // CHECK: SWIFT_INLINE_THUNK ns::anonStructInNS Strct::getTransform2() const {
306
+ // CHECK-NEXT: alignas(alignof(ns::anonStructInNS)) char storage[sizeof(ns::anonStructInNS)];
You can’t perform that action at this time.
0 commit comments