aboutsummaryrefslogtreecommitdiff
path: root/clang-tools-extra
diff options
context:
space:
mode:
authorKadir Cetinkaya <kadircet@google.com>2019-01-03 13:46:10 +0000
committerKadir Cetinkaya <kadircet@google.com>2019-01-03 13:46:10 +0000
commit41f98c834bc62a605ec51032482369cfa128d711 (patch)
tree6da6925e538e764d17be942f37d6267fc679c609 /clang-tools-extra
parentb39a97c8f6c02f5ce9d048849dfae4c3ee26d5ee (diff)
[clangd] Always try to build absolute path
Summary: This only changes behavior in cases when the file itself is a symlink. 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 symlinks on the path and leave it as it is if the file itself is a symlink. Reviewers: ilya-biryukov Reviewed By: ilya-biryukov Subscribers: ioeric, MaskRay, jkorous, arphaman, cfe-commits Differential Revision: https://reviews.llvm.org/D56263 llvm-svn: 350306
Diffstat (limited to 'clang-tools-extra')
-rw-r--r--clang-tools-extra/clangd/SourceCode.cpp9
1 files changed, 1 insertions, 8 deletions
diff --git a/clang-tools-extra/clangd/SourceCode.cpp b/clang-tools-extra/clangd/SourceCode.cpp
index 26664c8c095e..ce22676dc230 100644
--- a/clang-tools-extra/clangd/SourceCode.cpp
+++ b/clang-tools-extra/clangd/SourceCode.cpp
@@ -187,15 +187,8 @@ Optional<std::string> getCanonicalPath(const FileEntry *F,
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(