Skip to content

Commit 7adaf50

Browse files
[PrefixMap] Make sure blocklists are remapped in interface compilation
Make sure blocklists are remapped for interface compilation. The main module blocklist remap is done by swift-driver and do not need to be handled in scanner.
1 parent 82c9fdf commit 7adaf50

File tree

2 files changed

+20
-5
lines changed

2 files changed

+20
-5
lines changed

include/swift/Option/FrontendOptions.td

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -86,6 +86,11 @@ def primary_file : Separate<["-"], "primary-file">,
8686
Flags<[FrontendOption, NoDriverOption, ArgumentIsPath]>,
8787
HelpText<"Produce output for this file, not the whole module">;
8888

89+
def block_list_file
90+
: Separate<["-"], "blocklist-file">, MetaVarName<"<path>">,
91+
Flags<[FrontendOption, NoDriverOption, ArgumentIsPath]>,
92+
HelpText<"The path to a blocklist configuration file">;
93+
8994
let Flags = [FrontendOption, NoDriverOption] in {
9095

9196
def triple : Separate<["-"], "triple">, Alias<target>;
@@ -287,10 +292,6 @@ def Raccess_note : Separate<["-"], "Raccess-note">,
287292
HelpText<"Control access note remarks (default: all)">;
288293
def Raccess_note_EQ : Joined<["-"], "Raccess-note=">,
289294
Alias<Raccess_note>;
290-
291-
def block_list_file
292-
: Separate<["-"], "blocklist-file">, MetaVarName<"<path>">,
293-
HelpText<"The path to a blocklist configuration file">;
294295
} // end let Flags = [FrontendOption, NoDriverOption]
295296

296297
def debug_crash_Group : OptionGroup<"<automatic crashing options>">;

test/CAS/block-list.swift

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,11 +4,19 @@
44
// RUN: %target-swift-frontend -scan-dependencies -module-name Test -O \
55
// RUN: -disable-implicit-string-processing-module-import -disable-implicit-concurrency-module-import \
66
// RUN: -blocklist-file %t/blocklist.yml -blocklist-file %t/empty.yml \
7-
// RUN: -scanner-prefix-map %t=/^tmp \
7+
// RUN: -scanner-prefix-map %t=/^tmp -I %t/include \
88
// RUN: %t/main.swift -o %t/deps.json -cache-compile-job -cas-path %t/cas
99

1010
// RUN: %{python} %S/Inputs/BuildCommandExtractor.py %t/deps.json clang:SwiftShims > %t/shim.cmd
1111
// RUN: %swift_frontend_plain @%t/shim.cmd
12+
// RUN: %{python} %S/Inputs/BuildCommandExtractor.py %t/deps.json A > %t/A.cmd
13+
// RUN: %swift_frontend_plain @%t/A.cmd
14+
15+
// RUN: %FileCheck %s -check-prefix CMD -input-file=%t/A.cmd
16+
// CMD: -blocklist-file
17+
// CMD-NEXT: /^tmp/blocklist.yml
18+
// CMD-NEXT: -blocklist-file
19+
// CMD-NEXT: /^tmp/empty.yml
1220

1321
// RUN: %{python} %S/Inputs/SwiftDepsExtractor.py %t/deps.json Test casFSRootID > %t/fs.casid
1422
// DISABLE: llvm-cas --cas %t/cas --ls-tree-recursive @%t/fs.casid | %FileCheck %s -check-prefix FS
@@ -36,6 +44,7 @@
3644
// CHECK-BLOCKED-NOT: type_layout_string
3745

3846
//--- main.swift
47+
import A
3948
public struct Bar {
4049
let x: Int
4150
let y: AnyObject
@@ -47,6 +56,11 @@ public enum Foo {
4756
case c
4857
}
4958

59+
//--- include/A.swiftinterface
60+
// swift-interface-format-version: 1.0
61+
// swift-module-flags: -module-name A -O -disable-implicit-string-processing-module-import -disable-implicit-concurrency-module-import -parse-stdlib -user-module-version 1.0
62+
public func a() { }
63+
5064
//--- blocklist.yml
5165
---
5266
ShouldUseLayoutStringValueWitnesses:

0 commit comments

Comments
 (0)