[clang-tools-extra] r359078 - [clang][HeaderSuggestion] Handle the case of dotdot with an absolute path
Kadir Cetinkaya via cfe-commits
cfe-commits at lists.llvm.org
Wed Apr 24 02:23:31 PDT 2019
Author: kadircet
Date: Wed Apr 24 02:23:31 2019
New Revision: 359078
URL: http://llvm.org/viewvc/llvm-project?rev=359078&view=rev
Log:
[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
Modified:
clang-tools-extra/trunk/unittests/clangd/HeadersTests.cpp
Modified: clang-tools-extra/trunk/unittests/clangd/HeadersTests.cpp
URL: http://llvm.org/viewvc/llvm-project/clang-tools-extra/trunk/unittests/clangd/HeadersTests.cpp?rev=359078&r1=359077&r2=359078&view=diff
==============================================================================
--- clang-tools-extra/trunk/unittests/clangd/HeadersTests.cpp (original)
+++ clang-tools-extra/trunk/unittests/clangd/HeadersTests.cpp Wed Apr 24 02:23:31 2019
@@ -213,6 +213,11 @@ TEST_F(HeadersTest, DoNotInsertIfInSameF
TEST_F(HeadersTest, ShortenedInclude) {
std::string BarHeader = testPath("sub/bar.h");
EXPECT_EQ(calculate(BarHeader), "\"bar.h\"");
+
+ SearchDirArg = (llvm::Twine("-I") + Subdir + "/..").str();
+ CDB.ExtraClangFlags = {SearchDirArg.c_str()};
+ BarHeader = testPath("sub/bar.h");
+ EXPECT_EQ(calculate(BarHeader), "\"sub/bar.h\"");
}
TEST_F(HeadersTest, NotShortenedInclude) {
More information about the cfe-commits
mailing list