[clang] [clang][DependencyScanning] Track modules that resolve from sysroot. (PR #130634)
Ben Langmuir via cfe-commits
cfe-commits at lists.llvm.org
Fri Mar 14 11:48:51 PDT 2025
================
@@ -739,6 +748,12 @@ ModuleDepCollectorPP::handleTopLevelModule(const Module *M) {
MDC.ScanInstance.getASTReader()->visitInputFileInfos(
*MF, /*IncludeSystem=*/true,
[&](const serialization::InputFileInfo &IFI, bool IsSystem) {
+ if (MD.IsInSysroot) {
+ auto FullFilePath = ASTReader::ResolveImportedPath(
+ PathBuf, IFI.UnresolvedImportedFilename, MF->BaseDirectory);
+ MD.IsInSysroot = FullFilePath->starts_with(CurrSysroot);
----------------
benlangmuir wrote:
Minor nit: string prefix is not correct for paths, it also needs to check that the next character in `FullFilePath` is a separator. I'm surprised I can't find an existing utility for this in Path.h, but maybe we should add one.
https://github.com/llvm/llvm-project/pull/130634
More information about the cfe-commits
mailing list