Skip to content

Commit d6c39cd

Browse files
[CAS] Don't leak -iapinotes-modules clang flag in caching build
The search paths for apinotes are leaked when using compilation caching but they are not needed like other search path because the apinotes are found and stored inside include-tree. rdar://164205657
1 parent 4e04842 commit d6c39cd

File tree

2 files changed

+32
-0
lines changed

2 files changed

+32
-0
lines changed

lib/ClangImporter/ClangImporter.cpp

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4363,6 +4363,9 @@ ClangImporter::getSwiftExplicitModuleDirectCC1Args() const {
43634363
FEOpts.IncludeTimestamps = false;
43644364
FEOpts.ModuleMapFiles.clear();
43654365

4366+
// APINotesOptions.
4367+
instance.getAPINotesOpts().ModuleSearchPaths.clear();
4368+
43664369
// IndexStorePath is forwarded from swift.
43674370
FEOpts.IndexStorePath.clear();
43684371

test/CAS/apinotes.swift

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
// REQUIRES: objc_interop
2+
3+
// RUN: %empty-directory(%t)
4+
// RUN: split-file %s %t
5+
6+
// RUN: %target-swift-frontend -scan-dependencies -module-name Test -module-cache-path %t/clang-module-cache -O \
7+
// RUN: -disable-implicit-string-processing-module-import -disable-implicit-concurrency-module-import \
8+
// RUN: %t/main.swift -o %t/deps.json -swift-version 5 -cache-compile-job -cas-path %t/cas -I %t
9+
10+
// RUN: %FileCheck --input-file=%t/deps.json %s
11+
12+
// CHECK-NOT: -iapinotes-modules
13+
14+
//--- main.swift
15+
import A
16+
17+
//--- module.modulemap
18+
module A { header "A.h" export *}
19+
20+
//--- A.h
21+
#pragma once
22+
void a(void);
23+
24+
//--- A.apinotes
25+
Name: A
26+
Functions:
27+
- Name: a
28+
Availability: none
29+
AvailabilityMsg: "don't use this"

0 commit comments

Comments
 (0)