[clang] 8ab388e - [clang][deps] Convert file dependency paths to the native style
Jan Svoboda via cfe-commits
cfe-commits at lists.llvm.org
Thu Dec 1 21:08:23 PST 2022
Author: Jan Svoboda
Date: 2022-12-01T21:07:56-08:00
New Revision: 8ab388e158528d9af5eb0376ef698b243d946f19
URL: https://github.com/llvm/llvm-project/commit/8ab388e158528d9af5eb0376ef698b243d946f19
DIFF: https://github.com/llvm/llvm-project/commit/8ab388e158528d9af5eb0376ef698b243d946f19.diff
LOG: [clang][deps] Convert file dependency paths to the native style
This is an attempt to fix a Windows bot failure. In the test introduced in 83973cf1, file dependencies were printed out-of-order (after replacing backslashes with slashes). This might've been caused by styles of some paths being different.
Added:
Modified:
clang/lib/Tooling/DependencyScanning/ModuleDepCollector.cpp
Removed:
################################################################################
diff --git a/clang/lib/Tooling/DependencyScanning/ModuleDepCollector.cpp b/clang/lib/Tooling/DependencyScanning/ModuleDepCollector.cpp
index 93720f73ce9b0..9e84d9547db16 100644
--- a/clang/lib/Tooling/DependencyScanning/ModuleDepCollector.cpp
+++ b/clang/lib/Tooling/DependencyScanning/ModuleDepCollector.cpp
@@ -580,23 +580,24 @@ bool ModuleDepCollector::isPrebuiltModule(const Module *M) {
return true;
}
-static StringRef makeAbsolute(CompilerInstance &CI, StringRef Path,
- SmallVectorImpl<char> &Storage) {
+static StringRef makeAbsoluteAndPreferred(CompilerInstance &CI, StringRef Path,
+ SmallVectorImpl<char> &Storage) {
if (llvm::sys::path::is_absolute(Path))
return Path;
Storage.assign(Path.begin(), Path.end());
CI.getFileManager().makeAbsolutePath(Storage);
+ llvm::sys::path::make_preferred(Storage);
return StringRef(Storage.data(), Storage.size());
}
void ModuleDepCollector::addFileDep(StringRef Path) {
llvm::SmallString<256> Storage;
- Path = makeAbsolute(ScanInstance, Path, Storage);
+ Path = makeAbsoluteAndPreferred(ScanInstance, Path, Storage);
FileDeps.push_back(std::string(Path));
}
void ModuleDepCollector::addFileDep(ModuleDeps &MD, StringRef Path) {
llvm::SmallString<256> Storage;
- Path = makeAbsolute(ScanInstance, Path, Storage);
+ Path = makeAbsoluteAndPreferred(ScanInstance, Path, Storage);
MD.FileDeps.insert(Path);
}
More information about the cfe-commits
mailing list