File tree Expand file tree Collapse file tree 2 files changed +50
-1
lines changed Expand file tree Collapse file tree 2 files changed +50
-1
lines changed Original file line number Diff line number Diff line change @@ -197,7 +197,8 @@ SerializationOptions CompilerInvocation::computeSerializationOptions(
197197 serializationOpts.DocOutputPath = outs.ModuleDocOutputPath ;
198198 serializationOpts.SourceInfoOutputPath = outs.ModuleSourceInfoOutputPath ;
199199 serializationOpts.GroupInfoPath = opts.GroupInfoPath .c_str ();
200- if (opts.ModuleHasBridgingHeader && !outs.ModuleOutputPath .empty ())
200+ if (opts.ModuleHasBridgingHeader && !outs.ModuleOutputPath .empty () &&
201+ !opts.ImportHeaderAsInternal )
201202 serializationOpts.SerializeBridgingHeader = true ;
202203 // For batch mode, emit empty header path as placeholder.
203204 if (serializationOpts.SerializeBridgingHeader &&
Original file line number Diff line number Diff line change 1+ // RUN: %empty-directory(%t)
2+
3+ // Stage in the headers we need
4+ // RUN: mkdir %t/headers
5+ // RUN: cp %S/../Inputs/c-bridging-header.h %t/headers
6+
7+ // RUN: mkdir %t/src
8+ // RUN: split-file %s %t/src
9+
10+ // Build a module
11+ // RUN: mkdir %t/modules
12+ // RUN: %target-swift-frontend -internal-import-bridging-header %t/headers/c-bridging-header.h -sdk %clang-importer-sdk -emit-module -o %t/modules/MyModule.swiftmodule %t/src/MyModule.swift
13+
14+ // Check that there's no serialized bridging header in the module file.
15+ // RUN: llvm-bcanalyzer -dump %t/modules/MyModule.swiftmodule | %FileCheck -check-prefix MODULE-FILE %s
16+
17+ // Use the module.
18+ // RUN: %target-swift-frontend -typecheck -sdk %clang-importer-sdk -I %t/modules %t/src/MyClient.swift
19+
20+ // Delete the bridging header, and again use the module.
21+ // RUN: rm %t/headers/c-bridging-header.h
22+ // RUN: %target-swift-frontend -typecheck -sdk %clang-importer-sdk -I %t/modules %t/src/MyClient.swift
23+
24+ //--- MyModule.swift
25+ func getRed( ) -> Color { red }
26+
27+ func getX( point: MyPoint ) -> Double { point. x }
28+
29+ public func f( ) {
30+ _ = getRed ( )
31+ }
32+
33+ //--- MyClient.swift
34+
35+ import MyModule
36+
37+ func g( ) {
38+ f ( )
39+ }
40+
41+
42+ // MODULE-FILE-NOT: IMPORTED_HEADER
43+ // MODULE-FILE-NOT: IMPORTED_HEADER_CONTENTS
44+
45+ // MODULE-FILE: SEARCH_PATH
46+
47+ // MODULE-FILE-NOT: IMPORTED_HEADER
48+ // MODULE-FILE-NOT: IMPORTED_HEADER_CONTENTS
You can’t perform that action at this time.
0 commit comments