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)); }
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)); }
_______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits