[PATCH] D62965: [clang][HeaderSearch] Consider all path separators equal
Kadir Cetinkaya via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Thu Jun 6 10:16:12 PDT 2019
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;
}
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D62965.203399.patch
Type: text/x-patch
Size: 1096 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20190606/a1b82c8e/attachment-0001.bin>
More information about the cfe-commits
mailing list