Skip to content

Commit e431716

Browse files
authored
Merge pull request #70678 from xymus/write-no-verify
ModuleInterface: write down the -no-verify-emitted-module-interface flag in swiftinterfaces
2 parents a0f8914 + 1533894 commit e431716

File tree

3 files changed

+32
-1
lines changed

3 files changed

+32
-1
lines changed

include/swift/Option/Options.td

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -606,7 +606,8 @@ def verify_emitted_module_interface :
606606
HelpText<"Check that module interfaces emitted during compilation typecheck">;
607607
def no_verify_emitted_module_interface :
608608
Flag<["-"], "no-verify-emitted-module-interface">,
609-
Flags<[NoInteractiveOption, DoesNotAffectIncrementalBuild]>,
609+
Flags<[NoInteractiveOption, DoesNotAffectIncrementalBuild,
610+
FrontendOption, ModuleInterfaceOptionIgnorable]>,
610611
HelpText<"Don't check that module interfaces emitted during compilation typecheck">;
611612

612613
def avoid_emit_module_source_info :

lib/Driver/ToolChains.cpp

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -397,6 +397,14 @@ void ToolChain::addCommonFrontendArgs(const OutputInfo &OI,
397397

398398
addPluginArguments(inputArgs, arguments);
399399

400+
// Pass along -no-verify-emitted-module-interface only if it's effective.
401+
// Assume verification by default as we want to know only when the user skips
402+
// the verification.
403+
if (!inputArgs.hasFlag(options::OPT_verify_emitted_module_interface,
404+
options::OPT_no_verify_emitted_module_interface,
405+
true))
406+
arguments.push_back("-no-verify-emitted-module-interface");
407+
400408
// Pass through any subsystem flags.
401409
inputArgs.AddAllArgs(arguments, options::OPT_Xllvm);
402410
inputArgs.AddAllArgs(arguments, options::OPT_Xcc);
Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
// RUN: %empty-directory(%t)
2+
// REQUIRES: swift-driver-change
3+
4+
/// Check that the flag -no-verify-emitted-module-interface is written down in the swiftinterface.
5+
// RUN: %target-build-swift -emit-library -enable-library-evolution -emit-module-interface -emit-module -swift-version 5 -o %t/NoVerified.o -no-verify-emitted-module-interface -module-name NoVerified %s
6+
// RUN: cat %t/NoVerified.swiftinterface | %FileCheck --check-prefix FLAG %s
7+
// FLAG: swift-module-flags-ignorable:
8+
// FLAG-SAME: -no-verify-emitted-module-interface
9+
10+
/// Check that there's no skip flag in the swiftinterface.
11+
// RUN: %target-build-swift -emit-library -enable-library-evolution -emit-module-interface -emit-module -swift-version 5 -o %t/Verified.o -verify-emitted-module-interface -module-name Verified %s
12+
// RUN: cat %t/Verified.swiftinterface | %FileCheck --check-prefix NO-FLAG %s
13+
// NO-FLAG-NOT: verify-emitted-module-interface
14+
15+
/// Check last flag priority.
16+
// RUN: %target-build-swift -emit-library -enable-library-evolution -emit-module-interface -emit-module -swift-version 5 -o %t/VerifiedManyFlags.o -no-verify-emitted-module-interface -module-name VerifiedManyFlags %s -verify-emitted-module-interface
17+
// RUN: cat %t/VerifiedManyFlags.swiftinterface | %FileCheck --check-prefix NO-FLAG %s
18+
19+
// RUN: %target-build-swift -emit-library -enable-library-evolution -emit-module-interface -emit-module -swift-version 5 -o %t/NoVerifiedManyFlags.o -verify-emitted-module-interface -module-name NoVerifiedManyFlags %s -no-verify-emitted-module-interface
20+
// RUN: cat %t/NoVerifiedManyFlags.swiftinterface | %FileCheck --check-prefix FLAG %s
21+
22+
public struct MyStruct {}

0 commit comments

Comments
 (0)