Skip to content

Commit 0369141

Browse files
[Frontend] Allow -typecheck-module-from-interface to emit no outputs
-typecheck-module-from-interface doesn't emit textual output as configured in frontend option. The real output is diagnostics but that is not tracked by output computer which is using the option. Teach `swift-frontend` that it doesn't actually emit any real output and tell serialization not to emit swiftmodule.
1 parent f45095e commit 0369141

File tree

4 files changed

+8
-6
lines changed

4 files changed

+8
-6
lines changed

lib/Frontend/FrontendOptions.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -769,14 +769,14 @@ bool FrontendOptions::doesActionProduceOutput(ActionType action) {
769769
case ActionType::EmitImportedModules:
770770
case ActionType::MergeModules:
771771
case ActionType::CompileModuleFromInterface:
772-
case ActionType::TypecheckModuleFromInterface:
773772
case ActionType::DumpTypeInfo:
774773
case ActionType::EmitPCM:
775774
case ActionType::DumpPCM:
776775
case ActionType::ScanDependencies:
777776
case ActionType::PrintFeature:
778777
return true;
779778

779+
case ActionType::TypecheckModuleFromInterface:
780780
case ActionType::NoneAction:
781781
case ActionType::Immediate:
782782
case ActionType::REPL:
@@ -800,12 +800,12 @@ bool FrontendOptions::doesActionProduceTextualOutput(ActionType action) {
800800
case ActionType::Immediate:
801801
case ActionType::REPL:
802802
case ActionType::EmitPCM:
803+
case ActionType::TypecheckModuleFromInterface:
803804
return false;
804805

805806
case ActionType::Parse:
806807
case ActionType::ResolveImports:
807808
case ActionType::Typecheck:
808-
case ActionType::TypecheckModuleFromInterface:
809809
case ActionType::DumpParse:
810810
case ActionType::DumpInterfaceHash:
811811
case ActionType::DumpAST:

lib/Frontend/Serialization.cpp

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -65,8 +65,10 @@ void swift::serializeToBuffers(
6565
std::unique_ptr<llvm::MemoryBuffer> *moduleDocBuffer,
6666
std::unique_ptr<llvm::MemoryBuffer> *moduleSourceInfoBuffer,
6767
const SILModule *M) {
68+
// Serialization output is disabled.
69+
if (options.OutputPath.empty())
70+
return;
6871

69-
assert(!options.OutputPath.empty());
7072
{
7173
FrontendStatsTracer tracer(getContext(DC).Stats,
7274
"Serialization, swiftmodule, to buffer");

test/CAS/cas-explicit-module-map.swift

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -120,11 +120,11 @@
120120
// RUN: %target-swift-frontend -typecheck-module-from-interface %t/Foo.swiftinterface -disable-implicit-swift-modules \
121121
// RUN: -module-cache-path %t.module-cache -explicit-swift-module-map-file @%t/map.casid \
122122
// RUN: -cache-compile-job -cas-path %t/cas -allow-unstable-cache-key-for-testing -swift-version 5 -enable-library-evolution \
123-
// RUN: -explicit-interface-module-build -o /dev/null -Rcache-compile-job 2>&1 | %FileCheck %s --check-prefix=VERIFY-OUTPUT --check-prefix=CACHE-MISS
123+
// RUN: -explicit-interface-module-build -Rcache-compile-job 2>&1 | %FileCheck %s --check-prefix=VERIFY-OUTPUT --check-prefix=CACHE-MISS
124124
// RUN: %target-swift-frontend -typecheck-module-from-interface %t/Foo.swiftinterface -disable-implicit-swift-modules \
125125
// RUN: -module-cache-path %t.module-cache -explicit-swift-module-map-file @%t/map.casid \
126126
// RUN: -cache-compile-job -cas-path %t/cas -allow-unstable-cache-key-for-testing -swift-version 5 -enable-library-evolution \
127-
// RUN: -explicit-interface-module-build -o %t/check.swiftmodule -Rcache-compile-job 2>&1 | %FileCheck %s --check-prefix=VERIFY-OUTPUT --check-prefix=CACHE-HIT
127+
// RUN: -explicit-interface-module-build -Rcache-compile-job 2>&1 | %FileCheck %s --check-prefix=VERIFY-OUTPUT --check-prefix=CACHE-HIT
128128

129129
// CHECK-DAG: loaded module 'A'
130130
// CHECK-DAG: loaded module 'B'

test/ScanDependencies/explicit-module-map-typecheck-module-from-interface.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@
3535
// RUN: echo "}]" >> %/t/inputs/map.json
3636

3737
// RUN: %target-swift-frontend -typecheck-module-from-interface %t/Foo.swiftinterface -module-cache-path %t.module-cache \
38-
// RUN: -o /dev/null -explicit-interface-module-build -explicit-swift-module-map-file %t/inputs/map.json -Rmodule-loading -Xcc -Rmodule-import 2>&1 | %FileCheck %s
38+
// RUN: -explicit-interface-module-build -explicit-swift-module-map-file %t/inputs/map.json -Rmodule-loading -Xcc -Rmodule-import 2>&1 | %FileCheck %s
3939

4040
// CHECK-DAG: loaded module 'Swift'
4141
// CHECK-DAG: loaded module '_StringProcessing'

0 commit comments

Comments
 (0)