Skip to content

Commit 77924d6

Browse files
committed
[clang][deps] Modules don't contribute to search path usage
To reduce the number of modules we build in explicit builds (which use strict context hash), we prune unused header search paths. This essentially merges parts of the dependency graph. Determining whether a search path was used to discover a module (through implicit module maps) proved to be somewhat complicated. Initial support landed in D102923, while D113676 attempts to fix some bugs. However, now that we don't use implicit module maps in explicit builds (since D120465), we don't need to consider such search paths as used anymore. Modules are no longer discovered through the header search mechanism, so we can drop such search paths (provided they are not needed for other reasons). This patch removes whatever support for detecting such usage we had, since it's buggy and not required anymore. Depends on D120465. Reviewed By: dexonsmith Differential Revision: https://reviews.llvm.org/D121295
1 parent e3deb7d commit 77924d6

File tree

3 files changed

+3
-5
lines changed

3 files changed

+3
-5
lines changed

clang/include/clang/Lex/HeaderSearch.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -561,6 +561,7 @@ class HeaderSearch {
561561

562562
/// Determine which HeaderSearchOptions::UserEntries have been successfully
563563
/// used so far and mark their index with 'true' in the resulting bit vector.
564+
/// Note: implicit module maps don't contribute to entry usage.
564565
std::vector<bool> computeUserEntryUsage() const;
565566

566567
/// This method returns a HeaderMap for the specified

clang/lib/Lex/HeaderSearch.cpp

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -365,9 +365,6 @@ Module *HeaderSearch::lookupModule(StringRef ModuleName, StringRef SearchName,
365365
break;
366366
}
367367

368-
if (Module)
369-
noteLookupUsage(It.Idx, ImportLoc);
370-
371368
return Module;
372369
}
373370

clang/test/Preprocessor/search-path-usage.m

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -129,7 +129,7 @@
129129
#endif
130130
#endif
131131

132-
// Check that search paths with module maps are reported.
132+
// Check that search paths with module maps are NOT reported.
133133
//
134134
// RUN: mkdir %t/modulemap_abs
135135
// RUN: sed "s|DIR|%/S/Inputs/search-path-usage|g" \
@@ -142,5 +142,5 @@
142142
// RUN: -DMODMAP_ABS -verify
143143
#ifdef MODMAP_ABS
144144
@import b; // \
145-
// expected-remark-re {{search path used: '{{.*}}/modulemap_abs'}}
145+
// expected-no-diagnostics
146146
#endif

0 commit comments

Comments
 (0)