Skip to content

Commit 082f2b0

Browse files
[SymbolGraphGen] Import ObjC forward declarations by default. (#71947)
rdar://123279176
1 parent 4348515 commit 082f2b0

File tree

5 files changed

+22
-0
lines changed

5 files changed

+22
-0
lines changed

lib/DriverTool/swift_symbolgraph_extract_main.cpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -142,6 +142,7 @@ int swift_symbolgraph_extract_main(ArrayRef<const char *> Args,
142142
}
143143
Invocation.setClangModuleCachePath(ModuleCachePath);
144144
Invocation.getClangImporterOptions().ModuleCachePath = ModuleCachePath;
145+
Invocation.getClangImporterOptions().ImportForwardDeclarations = true;
145146
Invocation.setDefaultPrebuiltCacheIfNecessary();
146147

147148
if (auto *A = ParsedArgs.getLastArg(OPT_swift_version)) {
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
// RUN: %empty-directory(%t)
2+
// RUN: cp -r %S/Inputs/ForwardDeclarations/ForwardDeclarations.framework %t
3+
// RUN: %target-swift-frontend(mock-sdk: %clang-importer-sdk) -enable-objc-interop -emit-module-path %t/ForwardDeclarations.framework/Modules/ForwardDeclarations.swiftmodule/%target-swiftmodule-name -import-underlying-module -F %t -module-name ForwardDeclarations -disable-objc-attr-requires-foundation-module %s
4+
// RUN: %target-swift-symbolgraph-extract -sdk %clang-importer-sdk -module-name ForwardDeclarations -F %t -output-dir %t -pretty-print -v
5+
// RUN: %FileCheck %s --input-file %t/ForwardDeclarations.symbols.json
6+
7+
// REQUIRES: objc_interop
8+
9+
// CHECK: "preciseIdentifier": "c:objc(cs)ForwardDeclaration"
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
@import Foundation;
2+
3+
@class ForwardDeclaration;
4+
5+
@interface Foo : NSObject
6+
7+
@property ForwardDeclaration *foo;
8+
9+
@end

test/SymbolGraph/ClangImporter/Inputs/ForwardDeclarations/ForwardDeclarations.framework/Modules/ForwardDeclarations.swiftmodule/.keep

Whitespace-only changes.
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
framework module ForwardDeclarations {
2+
header "ForwardDeclaredInterfaceFoo.h"
3+
}

0 commit comments

Comments
 (0)