This is an archive of the discontinued LLVM Phabricator instance.

[clang-format] Don't insert braces for loops with a null statement
ClosedPublic

Authored by owenpan on Sep 9 2022, 11:41 PM.

Diff Detail

Event Timeline

owenpan created this revision.Sep 9 2022, 11:41 PM
Herald added a project: Restricted Project. · View Herald TranscriptSep 9 2022, 11:41 PM
owenpan requested review of this revision.Sep 9 2022, 11:41 PM
Herald added a project: Restricted Project. · View Herald TranscriptSep 9 2022, 11:41 PM
Herald added a subscriber: cfe-commits. · View Herald Transcript
MyDeveloperDay accepted this revision.Sep 10 2022, 5:38 AM
This revision is now accepted and ready to land.Sep 10 2022, 5:38 AM
MyDeveloperDay added a comment.EditedSep 10 2022, 6:06 AM

Can't tell you how much I love this InsertBraces feature @owenpan, I work for a team (with a large code base) that uses them all the time, and we are catching missing braces in decade-old code! Thank you

sstwcw added a subscriber: sstwcw.Sep 10 2022, 12:44 PM

Can't tell you how much I love this InsertBraces feature @owenpan, I work for a team (with a large code base) that uses them all the time, and we are catching missing braces in decade-old code! Thank you

Glad to hear that InsertBraces is useful in the real world!

sstwcw added inline comments.Sep 13 2022, 2:04 PM
clang/unittests/Format/FormatTest.cpp
25370

Can you confirm that there is supposed to be only one space here while there are two in the next test? messUp turns two spaces into one space. The formatter doesn't change things inside the #if 0 block, both before and after D133647.

owenpan added inline comments.Sep 15 2022, 10:17 AM
clang/unittests/Format/FormatTest.cpp
25370

Good catch. Can you delete this line and line 25383 below when rebasing and updating D133647?

25383

Delete this line when landing D133647.