This is an archive of the discontinued LLVM Phabricator instance.

Fix a buglet in remove_dots().
DraftPublic

Authored by ppluzhnikov on May 28 2022, 6:00 PM.
This is a draft revision that has not yet been submitted for review.

Details

Reviewers
None
Summary

The function promises to canonicalize the path, but neglected to do so
for the root component.

For example, calling remove_dots("/tmp/foo.c", Style::windows_backslash)
resulted in "/tmp\foo.c". Now it produces "\tmp\foo.c".

Also fix FIXME in the corresponding test.

Also fix PCHPreambleTest -- it canonicalized Path on insertion, but not
on lookup.

Also fix InMemoryFileSystemTest -- creating "same" filesystem should
match path normalization.

Also fix ProxyFileSystemTest on Win/x64 -- "/" is no longer expected.

Clean "./" from FILE expansion.

This is alternative to https://reviews.llvm.org/D121733
and helps with Clang header modules in which FILE
may expand to "./foo.h" or "foo.h" depending on whether the file was
included directly or not.

Only do this when UseTargetPathSeparator is true, as we are already
changing the path in that case.

Diff Detail

Event Timeline

ppluzhnikov created this revision.May 28 2022, 6:00 PM
Herald added a project: Restricted Project. · View Herald TranscriptMay 28 2022, 6:00 PM
Herald added a subscriber: hiraditya. · View Herald Transcript