This is an archive of the discontinued LLVM Phabricator instance.

[clang-tidy] Don't split \r\n in modernize-use-std-print check
ClosedPublic

Authored by mikecrowe on Jul 9 2023, 6:57 AM.

Details

Summary

When given:
printf("Hello\r\n");

it's clearer to leave the CRLF intact and convert this to:
std::print("Hello\r\n");

than to remove the trailing newline and convert it to:
std::println("Hello\r");

Update the documentation to match, and clarify the situations for using
println vs print which weren't previously explained.

Diff Detail

Event Timeline

mikecrowe created this revision.Jul 9 2023, 6:57 AM
Herald added a project: Restricted Project. · View Herald Transcript
mikecrowe requested review of this revision.Jul 9 2023, 6:57 AM
Herald added a project: Restricted Project. · View Herald TranscriptJul 9 2023, 6:57 AM
Herald added a subscriber: cfe-commits. · View Herald Transcript
PiotrZSL accepted this revision.Jul 9 2023, 7:23 AM

LGTM

This revision is now accepted and ready to land.Jul 9 2023, 7:23 AM
This revision was automatically updated to reflect the committed changes.