summaryrefslogtreecommitdiffstats
path: root/clang/unittests/Lex
diff options
context:
space:
mode:
authorKadir Cetinkaya <kadircet@google.com>2019-04-24 09:23:31 +0000
committerKadir Cetinkaya <kadircet@google.com>2019-04-24 09:23:31 +0000
commit936c67d3efa32d88d0e9eb0bd6c227a5a92a5db0 (patch)
treedec41e23bd2e6dd61db91e4dc198d7c6aa57b512 /clang/unittests/Lex
parentdcfa59c7d4773a08c3643193c3076ee3199807ef (diff)
downloadbcm5719-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/unittests/Lex')
-rw-r--r--clang/unittests/Lex/HeaderSearchTest.cpp7
1 files changed, 7 insertions, 0 deletions
diff --git a/clang/unittests/Lex/HeaderSearchTest.cpp b/clang/unittests/Lex/HeaderSearchTest.cpp
index b5b0f9a833c..5bcdd9efd17 100644
--- a/clang/unittests/Lex/HeaderSearchTest.cpp
+++ b/clang/unittests/Lex/HeaderSearchTest.cpp
@@ -100,5 +100,12 @@ TEST_F(HeaderSearchTest, BackSlash) {
}
#endif
+TEST_F(HeaderSearchTest, DotDotsWithAbsPath) {
+ addSearchDir("/x/../y/");
+ EXPECT_EQ(Search.suggestPathToFileForDiagnostics("/y/z",
+ /*WorkingDir=*/""),
+ "z");
+}
+
} // namespace
} // namespace clang
OpenPOWER on IntegriCloud