[PATCH] D138709: Reland "[Lex] Fix suggested spelling of /usr/bin/../include/foo"

Kadir Cetinkaya via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Fri Nov 25 06:23:29 PST 2022


kadircet accepted this revision.
kadircet added a comment.
This revision is now accepted and ready to land.

thanks!



================
Comment at: clang/lib/Lex/HeaderSearch.cpp:1936
+  path::remove_dots(FilePath, /*remove_dot_dot=*/true);
+  path::native(FilePath, path::Style::posix);
+  File = FilePath;
----------------
might be worth adding a comment like `we can't pass posix as style to remove_dots, because it won't canonicalize "a\.\b.h"`


================
Comment at: clang/unittests/Lex/HeaderSearchTest.cpp:155
+  addSearchDir("/x/../y/");
+  EXPECT_EQ(Search.suggestPathToFileForDiagnostics("/x/../y/z",
+                                                   /*WorkingDir=*/"",
----------------
can you also add a new test that looks like:
```
addSearchDir("x/");
EXPECT(suggestForDiag("x\y\z.h"), "y/z.h");
```

as in theory that's the new behaviour we're adding.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D138709/new/

https://reviews.llvm.org/D138709



More information about the cfe-commits mailing list