Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions include/swift/Basic/BlockListAction.def
Original file line number Diff line number Diff line change
Expand Up @@ -24,5 +24,6 @@ BLOCKLIST_ACTION(ShouldUseTextualModule)
BLOCKLIST_ACTION(DowngradeInterfaceVerificationFailure)
BLOCKLIST_ACTION(ShouldUseLayoutStringValueWitnesses)
BLOCKLIST_ACTION(ShouldDisableOwnershipVerification)
BLOCKLIST_ACTION(SkipEmittingFineModuleTrace)

#undef BLOCKLIST_ACTION
4 changes: 4 additions & 0 deletions include/swift/Frontend/FrontendOptions.h
Original file line number Diff line number Diff line change
Expand Up @@ -565,6 +565,10 @@ class FrontendOptions {

/// All block list configuration files to be honored in this compilation.
std::vector<std::string> BlocklistConfigFilePaths;

/// Whether explicitly disble fine-grained module tracing in this compiler
/// invocation.
bool DisableFineModuleTracing = false;
private:
static bool canActionEmitDependencies(ActionType);
static bool canActionEmitReferenceDependencies(ActionType);
Expand Down
4 changes: 4 additions & 0 deletions include/swift/Option/FrontendOptions.td
Original file line number Diff line number Diff line change
Expand Up @@ -1245,6 +1245,10 @@ def skip_import_in_public_interface:
HelpText<"Skip the import statement corresponding to a module name "
"when printing the public interface.">;

def disable_fine_module_tracing:
Flag<["-"], "disable-fine-module-tracing">,
HelpText<"Skip the emission of fine grained module tracing file.">;

def clang_header_expose_decls:
Joined<["-"], "clang-header-expose-decls=">,
HelpText<"Which declarations should be exposed in the generated clang header.">,
Expand Down
2 changes: 1 addition & 1 deletion lib/Frontend/ArgsToFrontendOptionsConverter.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -392,7 +392,7 @@ bool ArgsToFrontendOptionsConverter::convert(
}

Opts.DisableSandbox = Args.hasArg(OPT_disable_sandbox);

Opts.DisableFineModuleTracing = Args.hasArg(OPT_disable_fine_module_tracing);
return false;
}

Expand Down
6 changes: 6 additions & 0 deletions lib/FrontendTool/LoadedModuleTrace.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -946,11 +946,17 @@ static bool shouldActionTypeEmitFineModuleTrace(FrontendOptions::ActionType acti

bool swift::emitFineModuleTraceIfNeeded(CompilerInstance &Instance,
const FrontendOptions &opts) {
if (opts.DisableFineModuleTracing) {
return false;
}
if (!shouldActionTypeEmitFineModuleTrace(opts.RequestedAction)) {
return false;
}
ModuleDecl *mainModule = Instance.getMainModule();
ASTContext &ctxt = mainModule->getASTContext();
if (ctxt.blockListConfig.hasBlockListAction(mainModule->getNameStr(),
BlockListKeyKind::ModuleName, BlockListAction::SkipEmittingFineModuleTrace))
return false;
assert(!ctxt.hadError() &&
"We should've already exited earlier if there was an error.");

Expand Down
12 changes: 12 additions & 0 deletions test/IDE/objc_send_collector_1.swift
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,18 @@
// RUN: SWIFT_COMPILER_FINE_GRAINED_TRACE_PATH=%t/given_trace_2.json %target-swift-frontend -I %t/lib/swift -emit-module %s %S/Inputs/objc_send_collector_2.swift -module-name main -swift-version 5 -F %S/Inputs/mock-sdk -emit-loaded-module-trace-path %t/.MODULE_TRACE -enable-library-evolution
// RUN: not ls %t/given_trace_2.json


// RUN: echo "---" > %t/blocklist.yml
// RUN: echo "SkipEmittingFineModuleTrace:" >> %t/blocklist.yml
// RUN: echo " ModuleName:" >> %t/blocklist.yml
// RUN: echo " - FooBar" >> %t/blocklist.yml

// 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
// RUN: not ls %t/given_trace_3.json

// 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
// RUN: not ls %t/given_trace_4.json

// REQUIRES: objc_interop

import Foo
Expand Down