Skip to content

Commit 26bb450

Browse files
DougGregorAnthonyLatsis
authored andcommitted
[API notes] Add a test for the use of SwiftConformsTo on a typedef
(cherry picked from commit 5cb0db1)
1 parent f31ba45 commit 26bb450

File tree

3 files changed

+12
-0
lines changed

3 files changed

+12
-0
lines changed

clang/test/APINotes/Inputs/Headers/SwiftImportAs.apinotes

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,3 +39,7 @@ Functions:
3939
SwiftReturnOwnership: unretained
4040
- Name: functionReturningFrt_returns_retained
4141
SwiftReturnOwnership: retained
42+
Typedefs:
43+
- Name: WrappedOptions
44+
SwiftWrapper: struct
45+
SwiftConformsTo: Swift.OptionSet

clang/test/APINotes/Inputs/Headers/SwiftImportAs.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,3 +29,5 @@ struct OpaqueRefCountedType; // redeclaration
2929

3030
inline void ORCRetain(struct OpaqueRefCountedType *x);
3131
inline void ORCRelease(struct OpaqueRefCountedType *x);
32+
33+
typedef unsigned WrappedOptions;

clang/test/APINotes/swift-import-as.cpp

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@
1414
// RUN: %clang_cc1 -fmodules -fblocks -fimplicit-module-maps -fmodules-cache-path=%t/ModulesCache -fdisable-module-hash -fapinotes-modules -I %S/Inputs/Headers %s -x c++ -ast-dump -ast-dump-filter methodReturningFrt__ | FileCheck -check-prefix=CHECK-METHOD-RETURNING-FRT %s
1515
// RUN: %clang_cc1 -fmodules -fblocks -fimplicit-module-maps -fmodules-cache-path=%t/ModulesCache -fdisable-module-hash -fapinotes-modules -I %S/Inputs/Headers %s -x c++ -ast-dump -ast-dump-filter methodReturningFrt_returns_unretained | FileCheck -check-prefix=CHECK-METHOD-RETURNING-FRT-UNRETAINED %s
1616
// RUN: %clang_cc1 -fmodules -fblocks -fimplicit-module-maps -fmodules-cache-path=%t/ModulesCache -fdisable-module-hash -fapinotes-modules -I %S/Inputs/Headers %s -x c++ -ast-dump -ast-dump-filter methodReturningFrt_returns_retained | FileCheck -check-prefix=CHECK-METHOD-RETURNING-FRT-RETAINED %s
17+
// RUN: %clang_cc1 -fmodules -fblocks -fimplicit-module-maps -fmodules-cache-path=%t/ModulesCache -fdisable-module-hash -fapinotes-modules -I %S/Inputs/Headers %s -x c++ -ast-dump -ast-dump-filter WrappedOptions | FileCheck -check-prefix=CHECK-WRAPPED-OPTIONS %s
1718

1819
#include <SwiftImportAs.h>
1920

@@ -91,3 +92,8 @@
9192
// CHECK-METHOD-RETURNING-FRT-RETAINED: Dumping ImmortalRefType::methodReturningFrt_returns_retained:
9293
// CHECK-METHOD-RETURNING-FRT-RETAINED: CXXMethodDecl {{.+}} imported in SwiftImportAs methodReturningFrt_returns_retained 'ImmortalRefType *()'
9394
// CHECK-METHOD-RETURNING-FRT-RETAINED: `-SwiftAttrAttr {{.+}} "returns_retained"
95+
96+
// CHECK-WRAPPED-OPTIONS: Dumping WrappedOptions
97+
// CHECK-WRAPPED-OPTIONS: TypedefDecl{{.*}}WrappedOptions 'unsigned int'
98+
// CHECK-WRAPPED-OPTIONS: SwiftNewTypeAttr {{.*}} swift_wrapper NK_Struct
99+
// CHECK-WRAPPED-OPTIONS: SwiftAttrAttr {{.*}} "conforms_to:Swift.OptionSet"

0 commit comments

Comments
 (0)