This is an archive of the discontinued LLVM Phabricator instance.

[ADT] [NFC] Add StringRef::detectEOL
ClosedPublic

Authored by beanz on Jan 18 2022, 4:37 PM.

Details

Summary

This change moves EOL detection out of the clang::InclusionRewriter into
llvm::StringRef so that it can be easily reused elsewhere. It also adds
additional explicit test cases to verify the correct and expected return
results.

Diff Detail

Event Timeline

beanz requested review of this revision.Jan 18 2022, 4:37 PM
beanz created this revision.
Herald added projects: Restricted Project, Restricted Project. · View Herald TranscriptJan 18 2022, 4:37 PM
beanz updated this revision to Diff 401071.Jan 18 2022, 6:27 PM

Minor fix to properly handle classic mac... because it is _very_ important.

beanz updated this revision to Diff 401074.Jan 18 2022, 6:44 PM

Fixing the CR test case

dblaikie accepted this revision.Jan 20 2022, 7:17 PM
dblaikie added a subscriber: dblaikie.

Sounds good to me

llvm/unittests/ADT/StringRefTest.cpp
1114–1116

Usually skip braces on single line blocks.

Might be marginally better to write these out without the loop, though - I realize it's some duplication (though currently it's fewer lines anyway). Makes for clearer error messages from gunit because the line of code is unambiguous about what's being tested rather than having to map it up through the array, etc.

This revision is now accepted and ready to land.Jan 20 2022, 7:17 PM
This revision was landed with ongoing or failed builds.Jan 21 2022, 7:47 AM
This revision was automatically updated to reflect the committed changes.