[PATCH] D56263: [clangd] Always try to build absolute path
Kadir Cetinkaya via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Thu Jan 3 03:42:26 PST 2019
kadircet created this revision.
kadircet added a reviewer: ilya-biryukov.
Herald added subscribers: cfe-commits, arphaman, jkorous, MaskRay, ioeric.
When canonicalizing paths do not look at tryGetRealPathName, which
contains the resolved path for files that are symlinks. Instead first build the
absolute path even if it contains some symlinks on the path. Then resolve only
the smylinks on the path and leave it as it is if the file itself is a symlink.
Repository:
rCTE Clang Tools Extra
https://reviews.llvm.org/D56263
Files:
clangd/SourceCode.cpp
Index: clangd/SourceCode.cpp
===================================================================
--- clangd/SourceCode.cpp
+++ clangd/SourceCode.cpp
@@ -187,15 +187,8 @@
const SourceManager &SourceMgr) {
if (!F)
return None;
- // Ideally, we get the real path from the FileEntry object.
- SmallString<128> FilePath = F->tryGetRealPathName();
- if (!FilePath.empty() && sys::path::is_absolute(FilePath))
- return FilePath.str().str();
-
- // Otherwise, we try to compute ourselves.
- FilePath = F->getName();
- vlog("FileEntry for {0} did not contain the real path.", FilePath);
+ SmallString<128> FilePath = F->getName();
if (!sys::path::is_absolute(FilePath)) {
if (auto EC =
SourceMgr.getFileManager().getVirtualFileSystem()->makeAbsolute(
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D56263.180030.patch
Type: text/x-patch
Size: 823 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20190103/205587dd/attachment.bin>
More information about the cfe-commits
mailing list