Skip to content

Commit b19c45f

Browse files
committed
ModuleInterface: pass down block list file paths to module interface building context and command lines
1 parent 5dd92d6 commit b19c45f

File tree

3 files changed

+32
-1
lines changed

3 files changed

+32
-1
lines changed

lib/Frontend/CompilerInvocation.cpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1236,7 +1236,8 @@ static bool ParseLangArgs(LangOptions &Opts, ArgList &Args,
12361236

12371237
Opts.DumpTypeWitnessSystems = Args.hasArg(OPT_dump_type_witness_systems);
12381238

1239-
Opts.BlocklistConfigFilePaths = FrontendOpts.BlocklistConfigFilePaths;
1239+
for (auto &block: FrontendOpts.BlocklistConfigFilePaths)
1240+
Opts.BlocklistConfigFilePaths.push_back(block);
12401241
if (const Arg *A = Args.getLastArg(options::OPT_concurrency_model)) {
12411242
Opts.ActiveConcurrencyModel =
12421243
llvm::StringSwitch<ConcurrencyModel>(A->getValue())

lib/Frontend/ModuleInterfaceLoader.cpp

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1723,6 +1723,13 @@ InterfaceSubContextDelegateImpl::InterfaceSubContextDelegateImpl(
17231723
// module cache path at this point.
17241724
if (buildModuleCacheDirIfAbsent && !moduleCachePath.empty())
17251725
(void)llvm::sys::fs::create_directories(moduleCachePath);
1726+
1727+
// Inherit all block list configuration files
1728+
frontendOpts.BlocklistConfigFilePaths = langOpts.BlocklistConfigFilePaths;
1729+
for (auto &blocklist: langOpts.BlocklistConfigFilePaths) {
1730+
GenericArgs.push_back("-blocklist-file");
1731+
GenericArgs.push_back(blocklist);
1732+
}
17261733
}
17271734

17281735
/// Calculate an output filename in \p genericSubInvocation's cache path that
Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
// REQUIRES: objc_interop
2+
// RUN: %empty-directory(%t)
3+
// RUN: mkdir -p %t/clang-module-cache
4+
// RUN: mkdir -p %t/Frameworks
5+
// RUN: mkdir -p %t/Frameworks/E.framework/
6+
// RUN: mkdir -p %t/Frameworks/E.framework/Modules
7+
// RUN: mkdir -p %t/Frameworks/E.framework/Modules/E.swiftmodule
8+
9+
// RUN: echo "---" > %t/blocklist.yml
10+
// RUN: echo "action:" >> %t/blocklist.yml
11+
12+
// Copy over the interface
13+
// RUN: cp %S/Inputs/Swift/E.swiftinterface %t/Frameworks/E.framework/Modules/E.swiftmodule/%module-target-triple.swiftinterface
14+
15+
16+
// Run the scan
17+
// RUN: %target-swift-frontend -scan-dependencies %s -o %t/deps.json -F %t/Frameworks/ -sdk %t -blocklist-file %t/blocklist.yml
18+
// RUN: %FileCheck %s < %t/deps.json
19+
20+
import E
21+
22+
// CHECK: "-blocklist-file"
23+
// CHECK-NEXT: {{.*}}blocklist.yml"

0 commit comments

Comments
 (0)