[PATCH] D57411: [ModuleDependencyCollector] Use llvm::sys::fs::real_path
Jonas Devlieghere via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Tue Jan 29 22:26:26 PST 2019
This revision was automatically updated to reflect the committed changes.
Closed by commit rC352605: [ModuleDependencyCollector] Use llvm::sys::fs::real_path (NFC) (authored by JDevlieghere, committed by ).
Changed prior to commit:
https://reviews.llvm.org/D57411?vs=184155&id=184250#toc
Repository:
rC Clang
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D57411/new/
https://reviews.llvm.org/D57411
Files:
lib/Frontend/ModuleDependencyCollector.cpp
Index: lib/Frontend/ModuleDependencyCollector.cpp
===================================================================
--- lib/Frontend/ModuleDependencyCollector.cpp
+++ lib/Frontend/ModuleDependencyCollector.cpp
@@ -98,24 +98,6 @@
}
-// TODO: move this to Support/Path.h and check for HAVE_REALPATH?
-static bool real_path(StringRef SrcPath, SmallVectorImpl<char> &RealPath) {
-#ifdef LLVM_ON_UNIX
- char CanonicalPath[PATH_MAX];
-
- // TODO: emit a warning in case this fails...?
- if (!realpath(SrcPath.str().c_str(), CanonicalPath))
- return false;
-
- SmallString<256> RPath(CanonicalPath);
- RealPath.swap(RPath);
- return true;
-#else
- // FIXME: Add support for systems without realpath.
- return false;
-#endif
-}
-
void ModuleDependencyCollector::attachToASTReader(ASTReader &R) {
R.addListener(llvm::make_unique<ModuleDependencyListener>(*this));
}
@@ -130,7 +112,7 @@
static bool isCaseSensitivePath(StringRef Path) {
SmallString<256> TmpDest = Path, UpperDest, RealDest;
// Remove component traversals, links, etc.
- if (!real_path(Path, TmpDest))
+ if (llvm::sys::fs::real_path(Path, TmpDest))
return true; // Current default value in vfs.yaml
Path = TmpDest;
@@ -140,7 +122,7 @@
// already expects when sensitivity isn't setup.
for (auto &C : Path)
UpperDest.push_back(toUppercase(C));
- if (real_path(UpperDest, RealDest) && Path.equals(RealDest))
+ if (!llvm::sys::fs::real_path(UpperDest, RealDest) && Path.equals(RealDest))
return false;
return true;
}
@@ -186,7 +168,7 @@
// Computing the real path is expensive, cache the search through the
// parent path directory.
if (DirWithSymLink == SymLinkMap.end()) {
- if (!real_path(Dir, RealPath))
+ if (llvm::sys::fs::real_path(Dir, RealPath))
return false;
SymLinkMap[Dir] = RealPath.str();
} else {
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D57411.184250.patch
Type: text/x-patch
Size: 1858 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20190130/a212234c/attachment.bin>
More information about the cfe-commits
mailing list