Skip to content

Commit 8253cdb

Browse files
committed
Frontend: add a flag to disable fine-grained module tracing
1 parent 8d1fddf commit 8253cdb

File tree

5 files changed

+15
-1
lines changed

5 files changed

+15
-1
lines changed

include/swift/Frontend/FrontendOptions.h

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -565,6 +565,10 @@ class FrontendOptions {
565565

566566
/// All block list configuration files to be honored in this compilation.
567567
std::vector<std::string> BlocklistConfigFilePaths;
568+
569+
/// Whether explicitly disble fine-grained module tracing in this compiler
570+
/// invocation.
571+
bool DisableFineModuleTracing = false;
568572
private:
569573
static bool canActionEmitDependencies(ActionType);
570574
static bool canActionEmitReferenceDependencies(ActionType);

include/swift/Option/FrontendOptions.td

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1241,6 +1241,10 @@ def skip_import_in_public_interface:
12411241
HelpText<"Skip the import statement corresponding to a module name "
12421242
"when printing the public interface.">;
12431243

1244+
def disable_fine_module_tracing:
1245+
Flag<["-"], "disable-fine-module-tracing">,
1246+
HelpText<"Skip the emission of fine grained module tracing file.">;
1247+
12441248
def clang_header_expose_decls:
12451249
Joined<["-"], "clang-header-expose-decls=">,
12461250
HelpText<"Which declarations should be exposed in the generated clang header.">,

lib/Frontend/ArgsToFrontendOptionsConverter.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -386,7 +386,7 @@ bool ArgsToFrontendOptionsConverter::convert(
386386
}
387387

388388
Opts.DisableSandbox = Args.hasArg(OPT_disable_sandbox);
389-
389+
Opts.DisableFineModuleTracing = Args.hasArg(OPT_disable_fine_module_tracing);
390390
return false;
391391
}
392392

lib/FrontendTool/LoadedModuleTrace.cpp

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -946,6 +946,9 @@ static bool shouldActionTypeEmitFineModuleTrace(FrontendOptions::ActionType acti
946946

947947
bool swift::emitFineModuleTraceIfNeeded(CompilerInstance &Instance,
948948
const FrontendOptions &opts) {
949+
if (opts.DisableFineModuleTracing) {
950+
return false;
951+
}
949952
if (!shouldActionTypeEmitFineModuleTrace(opts.RequestedAction)) {
950953
return false;
951954
}

test/IDE/objc_send_collector_1.swift

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,9 @@
1919
// RUN: SWIFT_COMPILER_FINE_GRAINED_TRACE_PATH=%t/given_trace_3.json %target-swift-frontend -I %t/lib/swift -typecheck %s %S/Inputs/objc_send_collector_2.swift -module-name FooBar -swift-version 5 -F %S/Inputs/mock-sdk -emit-loaded-module-trace-path %t/.MODULE_TRACE -blocklist-file %t/blocklist.yml
2020
// RUN: not ls %t/given_trace_3.json
2121

22+
// RUN: SWIFT_COMPILER_FINE_GRAINED_TRACE_PATH=%t/given_trace_4.json %target-swift-frontend -I %t/lib/swift -typecheck %s %S/Inputs/objc_send_collector_2.swift -module-name FooBar -swift-version 5 -F %S/Inputs/mock-sdk -emit-loaded-module-trace-path %t/.MODULE_TRACE -disable-fine-module-tracing
23+
// RUN: not ls %t/given_trace_4.json
24+
2225
// REQUIRES: objc_interop
2326

2427
import Foo

0 commit comments

Comments
 (0)