[all-commits] [llvm/llvm-project] 54acda: [clang module] Current Working Directory Pruning (...
Qiongsi Wu via All-commits
all-commits at lists.llvm.org
Tue Feb 4 20:05:01 PST 2025
Branch: refs/heads/main
Home: https://github.com/llvm/llvm-project
Commit: 54acda2e0ebdf240deeef4d51fc3240c5548dbb7
https://github.com/llvm/llvm-project/commit/54acda2e0ebdf240deeef4d51fc3240c5548dbb7
Author: Qiongsi Wu <qiongsiwu at gmail.com>
Date: 2025-02-04 (Tue, 04 Feb 2025)
Changed paths:
M clang/include/clang/Tooling/DependencyScanning/DependencyScanningService.h
M clang/lib/Tooling/DependencyScanning/ModuleDepCollector.cpp
A clang/test/ClangScanDeps/modules-context-hash-cwd.c
M clang/test/ClangScanDeps/working-dir.m
M clang/tools/clang-scan-deps/ClangScanDeps.cpp
Log Message:
-----------
[clang module] Current Working Directory Pruning (#124786)
When computing the context hash, `clang` always includes the compiler's
working directory. This can lead to situations when the only difference
between two compilations is the working directory, different module
variants are generated. These variants are redundant. This PR implements
an optimization that ignores the working directory when computing the
context hash when safe.
Specifically, `clang` checks if it is safe to ignore the working
directory in `isSafeToIgnoreCWD`. The check involves going through
compile command options to see if any paths specified are relative. The
definition of relative path used here is that the input path is not
empty, and `llvm::sys::path::is_absolute` is false. If all the paths
examined are not relative, `clang` considers it safe to ignore the
current working directory and does not consider the working directory
when computing the context hash.
To unsubscribe from these emails, change your notification settings at https://github.com/llvm/llvm-project/settings/notifications
More information about the All-commits
mailing list