diff options
author | Kadir Cetinkaya <kadircet@google.com> | 2019-04-24 09:23:31 +0000 |
---|---|---|
committer | Kadir Cetinkaya <kadircet@google.com> | 2019-04-24 09:23:31 +0000 |
commit | 936c67d3efa32d88d0e9eb0bd6c227a5a92a5db0 (patch) | |
tree | dec41e23bd2e6dd61db91e4dc198d7c6aa57b512 /clang/lib/Lex/HeaderSearch.cpp | |
parent | dcfa59c7d4773a08c3643193c3076ee3199807ef (diff) | |
download | bcm5719-llvm-936c67d3efa32d88d0e9eb0bd6c227a5a92a5db0.tar.gz bcm5719-llvm-936c67d3efa32d88d0e9eb0bd6c227a5a92a5db0.zip |
[clang][HeaderSuggestion] Handle the case of dotdot with an absolute path
Summary:
Include insertion in clangd was inserting absolute paths when the
include directory was an absolute path with a double dot. This patch makes sure
double dots are handled both with absolute and relative paths.
Reviewers: sammccall
Subscribers: ilya-biryukov, ioeric, jkorous, arphaman, cfe-commits
Tags: #clang
Differential Revision: https://reviews.llvm.org/D60873
llvm-svn: 359078
Diffstat (limited to 'clang/lib/Lex/HeaderSearch.cpp')
-rw-r--r-- | clang/lib/Lex/HeaderSearch.cpp | 7 |
1 files changed, 3 insertions, 4 deletions
diff --git a/clang/lib/Lex/HeaderSearch.cpp b/clang/lib/Lex/HeaderSearch.cpp index a26df9a7f60..af763059ea9 100644 --- a/clang/lib/Lex/HeaderSearch.cpp +++ b/clang/lib/Lex/HeaderSearch.cpp @@ -1685,11 +1685,10 @@ std::string HeaderSearch::suggestPathToFileForDiagnostics( StringRef Dir = SearchDirs[I].getDir()->getName(); llvm::SmallString<32> DirPath(Dir.begin(), Dir.end()); - if (!WorkingDir.empty() && !path::is_absolute(Dir)) { + if (!WorkingDir.empty() && !path::is_absolute(Dir)) fs::make_absolute(WorkingDir, DirPath); - path::remove_dots(DirPath, /*remove_dot_dot=*/true); - Dir = DirPath; - } + path::remove_dots(DirPath, /*remove_dot_dot=*/true); + Dir = DirPath; for (auto NI = path::begin(File), NE = path::end(File), DI = path::begin(Dir), DE = path::end(Dir); /*termination condition in loop*/; ++NI, ++DI) { |