This is an archive of the discontinued LLVM Phabricator instance.

Reland "[Lex] Fix suggested spelling of /usr/bin/../include/foo"
ClosedPublic

Authored by sammccall on Nov 25 2022, 6:12 AM.

Details

Summary

This reverts commit 1dc0a1e5d220b83c1074204bd3afd54f3bac4270.

Failures were caused by unintentional conversion to native slashes by
remove_dots, so undo that: we always suggest posix slashes for includes.

This could potentially be a change in behavior on windows if people were
spelling headers with backslashes and headermaps contained backslashes,
but that's all underspecified and I don't think anyone uses headermaps
on windows.

Diff Detail

Event Timeline

sammccall created this revision.Nov 25 2022, 6:12 AM
Herald added a project: Restricted Project. · View Herald TranscriptNov 25 2022, 6:12 AM
sammccall requested review of this revision.Nov 25 2022, 6:12 AM
Herald added a project: Restricted Project. · View Herald TranscriptNov 25 2022, 6:12 AM
Herald added a subscriber: cfe-commits. · View Herald Transcript
kadircet accepted this revision.Nov 25 2022, 6:23 AM

thanks!

clang/lib/Lex/HeaderSearch.cpp
1936

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"

clang/unittests/Lex/HeaderSearchTest.cpp
155

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.

This revision is now accepted and ready to land.Nov 25 2022, 6:23 AM
sammccall marked an inline comment as done.Nov 28 2022, 1:08 AM
sammccall added inline comments.
clang/unittests/Lex/HeaderSearchTest.cpp
155

That looks a lot like TEST_F(HeaderSearchTest, BackSlash) to me (relative vs absolute, but not relevant at least to this change)

This revision was landed with ongoing or failed builds.Nov 28 2022, 1:09 AM
This revision was automatically updated to reflect the committed changes.