Skip to content

Commit 3168a91

Browse files
authored
Merge pull request #69527 from artemcm/FixupDepScanExtraClangArgs
[Dependency Scanning] Restore propagation of `-Xcc` flags to scanner's Swift Textual interface-reading sub-invocation
2 parents 103f716 + 9eee1ec commit 3168a91

File tree

2 files changed

+37
-1
lines changed

2 files changed

+37
-1
lines changed

lib/Frontend/ModuleInterfaceLoader.cpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1756,7 +1756,8 @@ InterfaceSubContextDelegateImpl::InterfaceSubContextDelegateImpl(
17561756
// If the compiler has been asked to be strict with ensuring downstream dependencies
17571757
// get the parent invocation's context, or this is an Explicit build, inherit the
17581758
// extra Clang arguments also.
1759-
if (LoaderOpts.strictImplicitModuleContext || LoaderOpts.disableImplicitSwiftModule) {
1759+
if (LoaderOpts.strictImplicitModuleContext || LoaderOpts.disableImplicitSwiftModule ||
1760+
LoaderOpts.requestedAction == FrontendOptions::ActionType::ScanDependencies) {
17601761
// Inherit any clang-specific state of the compilation (macros, clang flags, etc.)
17611762
subClangImporterOpts.ExtraArgs = clangImporterOpts.ExtraArgs;
17621763
for (auto arg : subClangImporterOpts.ExtraArgs) {
Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
// RUN: %empty-directory(%t)
2+
// RUN: %empty-directory(%t/clang-module-cache)
3+
4+
// RUN: %target-swift-frontend -scan-dependencies -module-cache-path %t/clang-module-cache %s -o %t/deps.json -I %S/Inputs/CHeaders -I %S/Inputs/Swift -Xcc -fobjc-disable-direct-methods-for-testing
5+
// Check the contents of the JSON output
6+
// RUN: %validate-json %t/deps.json | %FileCheck %s
7+
8+
// REQUIRES: executable_test
9+
// REQUIRES: objc_interop
10+
11+
import C
12+
13+
// CHECK: "mainModuleName": "deps"
14+
/// --------Main module
15+
// CHECK-LABEL: "modulePath": "deps.swiftmodule",
16+
// CHECK-NEXT: sourceFiles
17+
// CHECK-NEXT: ObjCStrict.swift
18+
// CHECK-NEXT: ],
19+
// CHECK-NEXT: "directDependencies": [
20+
// CHECK-DAG: "clang": "C"
21+
// CHECK-DAG: "swift": "Swift"
22+
// CHECK-DAG: "swift": "SwiftOnoneSupport"
23+
// CHECK-DAG: "swift": "_Concurrency"
24+
// CHECK: ],
25+
26+
// CHECK: "swift": "A"
27+
// CHECK: "swift": {
28+
// CHECK-NEXT: "moduleInterfacePath": "{{.*}}{{/|\\}}Inputs{{/|\\}}Swift{{/|\\}}A.swiftinterface",
29+
// CHECK: "commandLine": [
30+
// CHECK: "-fobjc-disable-direct-methods-for-testing"
31+
// CHECK: "-o",
32+
// CHECK-NEXT: "{{.*}}{{/|\\}}A-{{.*}}.swiftmodule",
33+
34+
35+

0 commit comments

Comments
 (0)