This is an archive of the discontinued LLVM Phabricator instance.

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

Authored by sammccall on Nov 24 2022, 8:51 AM.

Details

Summary

Since D60873 we remove dotdots from the search path entries, but not the
filenames we're matching against, so do the latter too.

Since this also removes (single) dots, drop the logic to skip over them.
(Some of this was already dead, some is newly dead).

See D138676 for motivation.

Diff Detail

Event Timeline

sammccall created this revision.Nov 24 2022, 8:51 AM
Herald added a project: Restricted Project. · View Herald TranscriptNov 24 2022, 8:51 AM
sammccall requested review of this revision.Nov 24 2022, 8:51 AM
Herald added a project: Restricted Project. · View Herald TranscriptNov 24 2022, 8:51 AM
Herald added a subscriber: cfe-commits. · View Herald Transcript
kadircet added inline comments.Nov 24 2022, 9:51 AM
clang/lib/Lex/HeaderSearch.cpp
1932

nit: you can change the method signature to take in a SmallString directly. there's an implicit constructor and any caller that already has a copy that they're throwing away can pass it here instead.

1932

this is same as llvm::SmallString<32> FilePath(File);

1948

looks like reflow went wrong here, drop //?

kadircet accepted this revision.Nov 24 2022, 9:57 AM
This revision is now accepted and ready to land.Nov 24 2022, 9:57 AM
sammccall marked 2 inline comments as done.Nov 25 2022, 2:01 AM
sammccall added inline comments.
clang/lib/Lex/HeaderSearch.cpp
1932

I don't think this is a good reason to change the signature unless it's actually a hot path.
(In fact, no caller has a SmallString<32>).

I changed CheckDir though because it's internal.

This revision was landed with ongoing or failed builds.Nov 25 2022, 2:01 AM
This revision was automatically updated to reflect the committed changes.
thakis added a subscriber: thakis.Nov 25 2022, 4:30 AM

This breaks tests on windows: http://45.33.8.238/win/70650/step_7.txt

Please take a look and revert for now if it takes a while to fix.