Skip to content

Commit e17556a

Browse files
Merge pull request #79179 from cachemeifyoucan/eng/PR-144267483
[Dependency Scan] Do not pass clang's `-dwarf-debug-flags` to swift
2 parents 57450f5 + c3550e8 commit e17556a

File tree

2 files changed

+41
-0
lines changed

2 files changed

+41
-0
lines changed

lib/ClangImporter/ClangImporter.cpp

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1266,6 +1266,9 @@ std::optional<std::vector<std::string>> ClangImporter::getClangCC1Arguments(
12661266
}
12671267
CI->getFrontendOpts().ModuleMapFiles = FilteredModuleMapFiles;
12681268

1269+
// Clear clang debug flags.
1270+
CI->getCodeGenOpts().DwarfDebugFlags.clear();
1271+
12691272
return CI->getCC1CommandLine();
12701273
}
12711274

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
// REQUIRES: OS=macosx
2+
// RUN: %empty-directory(%t)
3+
// RUN: split-file %s %t
4+
5+
// RUN: RC_DEBUG_OPTIONS=1 %target-swift-frontend -scan-dependencies -o %t/deps.json -I %t \
6+
// RUN: -disable-implicit-string-processing-module-import -disable-implicit-concurrency-module-import -parse-stdlib \
7+
// RUN: -g -file-compilation-dir %t -Xcc -ferror-limit=1 \
8+
// RUN: %t/test.swift -module-name Test -swift-version 5 -experimental-clang-importer-direct-cc1-scan
9+
// RUN: %FileCheck %s --check-prefix CHECK-DIRECT-CC1-SCAN --input-file=%t/deps.json
10+
11+
// CHECK-DIRECT-CC1-SCAN-NOT: -dwarf-debug-flags
12+
13+
// RUN: %{python} %S/../CAS/Inputs/BuildCommandExtractor.py %t/deps.json A > %t/A.cmd
14+
// RUN: %swift_frontend_plain @%t/A.cmd
15+
16+
// RUN: %{python} %S/../CAS/Inputs/GenerateExplicitModuleMap.py %t/deps.json > %t/map.json
17+
// RUN: %{python} %S/../CAS/Inputs/BuildCommandExtractor.py %t/deps.json Test > %t/MyApp.cmd
18+
// RUN: echo "\"-disable-implicit-string-processing-module-import\"" >> %t/MyApp.cmd
19+
// RUN: echo "\"-disable-implicit-concurrency-module-import\"" >> %t/MyApp.cmd
20+
// RUN: echo "\"-disable-implicit-swift-modules\"" >> %t/MyApp.cmd
21+
// RUN: echo "\"-explicit-swift-module-map-file\"" >> %t/MyApp.cmd
22+
// RUN: echo "\"%t/map.json\"" >> %t/MyApp.cmd
23+
24+
// RUN: %target-swift-frontend -module-name Test -O @%t/MyApp.cmd %t/test.swift -parse-stdlib \
25+
// RUN: -g -c -o %t/test.o -debug-info-store-invocation
26+
27+
// RUN: %llvm-dwarfdump %t/test.o --recurse-depth=0 | %FileCheck %s --check-prefix=FLAGS
28+
// FLAGS: DW_AT_APPLE_flags
29+
// FLAGS-SAME: -target
30+
31+
//--- A.swiftinterface
32+
// swift-interface-format-version: 1.0
33+
// 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
34+
public func a() { }
35+
36+
//--- test.swift
37+
import A
38+
func test() {}

0 commit comments

Comments
 (0)