This is an archive of the discontinued LLVM Phabricator instance.

[split-file] Respect input file's line endings
ClosedPublic

Authored by beanz on Jan 21 2022, 8:50 AM.

Details

Summary

This change adds support for split-file to respect the line ending style
of the input file. This enables split-file to work as expected on
Windows with input files containing CRLF line endings.

The test files added along with this change mirror the existing basic
tests, but are forced to contain CRLF line endings via git attributes.
This will result in the tests always containing CRLF line endings when
checked out regardless of the user's OS.

Diff Detail

Event Timeline

beanz created this revision.Jan 21 2022, 8:50 AM
beanz requested review of this revision.Jan 21 2022, 8:50 AM
Herald added a project: Restricted Project. · View Herald TranscriptJan 21 2022, 8:50 AM

I think llvm-project tests normally should all use '\n', but this change may make the utility more useful outside llvm-project, so looks good.

llvm/test/tools/split-file/basic.crlf.test
2

We do not these many tests. One crlf file is sufficient.

I think llvm-project tests normally should all use '\n', but this change may make the utility more useful outside llvm-project, so looks good.

The fact that they are required to be LF ended was intended to be temporary while the issues with CRLF got worked out (see the note: https://llvm.org/docs/GettingStarted.html#checkout-llvm-from-git).

This is me trying to work out the issues :)

beanz updated this revision to Diff 402109.Jan 21 2022, 2:19 PM

Updates based on PR feedback from @MaskRay

MaskRay accepted this revision.Jan 21 2022, 2:32 PM

Looks great!

This revision is now accepted and ready to land.Jan 21 2022, 2:32 PM
This revision was landed with ongoing or failed builds.Jan 21 2022, 4:45 PM
This revision was automatically updated to reflect the committed changes.