This revision was automatically updated to reflect the committed changes. Closed by commit rL362731: [clang][HeaderSearch] Consider all path separators equal (authored by kadircet, committed by ). Herald added a project: LLVM. Herald added a subscriber: llvm-commits.
Changed prior to commit: https://reviews.llvm.org/D62965?vs=203399&id=203409#toc Repository: rL LLVM CHANGES SINCE LAST ACTION https://reviews.llvm.org/D62965/new/ https://reviews.llvm.org/D62965 Files: cfe/trunk/lib/Lex/HeaderSearch.cpp cfe/trunk/unittests/Lex/HeaderSearchTest.cpp Index: cfe/trunk/lib/Lex/HeaderSearch.cpp =================================================================== --- cfe/trunk/lib/Lex/HeaderSearch.cpp +++ cfe/trunk/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: cfe/trunk/unittests/Lex/HeaderSearchTest.cpp =================================================================== --- cfe/trunk/unittests/Lex/HeaderSearchTest.cpp +++ cfe/trunk/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: cfe/trunk/lib/Lex/HeaderSearch.cpp =================================================================== --- cfe/trunk/lib/Lex/HeaderSearch.cpp +++ cfe/trunk/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: cfe/trunk/unittests/Lex/HeaderSearchTest.cpp =================================================================== --- cfe/trunk/unittests/Lex/HeaderSearchTest.cpp +++ cfe/trunk/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) {
_______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits