kadircet updated this revision to Diff 203399. kadircet marked an inline comment as done. kadircet added a comment.
- Update comment Repository: rG LLVM Github Monorepo CHANGES SINCE LAST ACTION https://reviews.llvm.org/D62965/new/ https://reviews.llvm.org/D62965 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 @@ -98,6 +98,13 @@ /*WorkingDir=*/""), "z/t"); } + +TEST_F(HeaderSearchTest, BackSlashWithDotDot) { + addSearchDir("..\\y"); + EXPECT_EQ(Search.suggestPathToFileForDiagnostics("C:\\x\\y\\z\\t", + /*WorkingDir=*/"C:/x/y/"), + "z/t"); +} #endif TEST_F(HeaderSearchTest, DotDotsWithAbsPath) { Index: clang/lib/Lex/HeaderSearch.cpp =================================================================== --- clang/lib/Lex/HeaderSearch.cpp +++ clang/lib/Lex/HeaderSearch.cpp @@ -1715,6 +1715,11 @@ break; } + // Consider all path separators equal. + if (NI->size() == 1 && DI->size() == 1 && + path::is_separator(NI->front()) && path::is_separator(DI->front())) + continue; + if (*NI != *DI) break; }
Index: clang/unittests/Lex/HeaderSearchTest.cpp =================================================================== --- clang/unittests/Lex/HeaderSearchTest.cpp +++ clang/unittests/Lex/HeaderSearchTest.cpp @@ -98,6 +98,13 @@ /*WorkingDir=*/""), "z/t"); } + +TEST_F(HeaderSearchTest, BackSlashWithDotDot) { + addSearchDir("..\\y"); + EXPECT_EQ(Search.suggestPathToFileForDiagnostics("C:\\x\\y\\z\\t", + /*WorkingDir=*/"C:/x/y/"), + "z/t"); +} #endif TEST_F(HeaderSearchTest, DotDotsWithAbsPath) { Index: clang/lib/Lex/HeaderSearch.cpp =================================================================== --- clang/lib/Lex/HeaderSearch.cpp +++ clang/lib/Lex/HeaderSearch.cpp @@ -1715,6 +1715,11 @@ break; } + // Consider all path separators equal. + if (NI->size() == 1 && DI->size() == 1 && + path::is_separator(NI->front()) && path::is_separator(DI->front())) + continue; + if (*NI != *DI) break; }
_______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits