[PATCH] D60995: [clang][HeaderSearch] Make sure there are no backslashes in suggestedPath
Kadir Cetinkaya via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Tue Apr 23 00:43:47 PDT 2019
kadircet updated this revision to Diff 196192.
kadircet added a comment.
- Fix bug in HeaderSearch instead of clangd
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D60995/new/
https://reviews.llvm.org/D60995
Files:
clang/lib/Lex/HeaderSearch.cpp
clang/unittests/Lex/HeaderSearchTest.cpp
Index: clang/unittests/Lex/HeaderSearchTest.cpp
===================================================================
--- clang/unittests/Lex/HeaderSearchTest.cpp
+++ clang/unittests/Lex/HeaderSearchTest.cpp
@@ -91,5 +91,14 @@
"z");
}
+#ifdef _WIN32
+TEST_F(HeaderSearchTest, BackSlash) {
+ addSearchDir("C:\\x\\y\\");
+ EXPECT_EQ(Search.suggestPathToFileForDiagnostics("C:\\x\\y\\z\\t",
+ /*WorkingDir=*/""),
+ "z/t");
+}
+#endif
+
} // namespace
} // namespace clang
Index: clang/lib/Lex/HeaderSearch.cpp
===================================================================
--- clang/lib/Lex/HeaderSearch.cpp
+++ clang/lib/Lex/HeaderSearch.cpp
@@ -1720,5 +1720,5 @@
if (IsSystem)
*IsSystem = BestPrefixLength ? BestSearchDir >= SystemDirIdx : false;
- return File.drop_front(BestPrefixLength);
+ return path::convert_to_slash(File.drop_front(BestPrefixLength));
}
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D60995.196192.patch
Type: text/x-patch
Size: 957 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20190423/549c9953/attachment.bin>
More information about the cfe-commits
mailing list