Skip to content

Commit 5e90d32

Browse files
authored
Merge pull request #65031 from nkcsgexi/interface-building-inherit-block
ModuleInterface: pass down block list file paths to module interface building context and command lines
2 parents 8c20494 + 68e6b22 commit 5e90d32

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
@@ -1177,7 +1177,8 @@ static bool ParseLangArgs(LangOptions &Opts, ArgList &Args,
11771177

11781178
Opts.DumpTypeWitnessSystems = Args.hasArg(OPT_dump_type_witness_systems);
11791179

1180-
Opts.BlocklistConfigFilePaths = FrontendOpts.BlocklistConfigFilePaths;
1180+
for (auto &block: FrontendOpts.BlocklistConfigFilePaths)
1181+
Opts.BlocklistConfigFilePaths.push_back(block);
11811182
if (const Arg *A = Args.getLastArg(options::OPT_concurrency_model)) {
11821183
Opts.ActiveConcurrencyModel =
11831184
llvm::StringSwitch<ConcurrencyModel>(A->getValue())

lib/Frontend/ModuleInterfaceLoader.cpp

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1697,6 +1697,13 @@ InterfaceSubContextDelegateImpl::InterfaceSubContextDelegateImpl(
16971697
// module cache path at this point.
16981698
if (buildModuleCacheDirIfAbsent && !moduleCachePath.empty())
16991699
(void)llvm::sys::fs::create_directories(moduleCachePath);
1700+
1701+
// Inherit all block list configuration files
1702+
frontendOpts.BlocklistConfigFilePaths = langOpts.BlocklistConfigFilePaths;
1703+
for (auto &blocklist: langOpts.BlocklistConfigFilePaths) {
1704+
GenericArgs.push_back("-blocklist-file");
1705+
GenericArgs.push_back(blocklist);
1706+
}
17001707
}
17011708

17021709
/// 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)