This is an archive of the discontinued LLVM Phabricator instance.

[clang-format] Fix a bug in merging blocks with a wrapped l_brace
ClosedPublic

Authored by owenpan on Aug 31 2022, 11:30 PM.

Details

Summary

When the opening brace of a control statement block is wrapped, we must check the previous line to determine whether to try to merge the block.

Fixes https://github.com/llvm/llvm-project/issues/38639.
Fixes https://github.com/llvm/llvm-project/issues/48007.
Fixes https://github.com/llvm/llvm-project/issues/57421.

Diff Detail

Event Timeline

owenpan created this revision.Aug 31 2022, 11:30 PM
Herald added a project: Restricted Project. · View Herald TranscriptAug 31 2022, 11:30 PM
owenpan requested review of this revision.Aug 31 2022, 11:30 PM
Herald added a project: Restricted Project. · View Herald TranscriptAug 31 2022, 11:30 PM
Herald added a subscriber: cfe-commits. · View Herald Transcript
HazardyKnusperkeks added inline comments.
clang/lib/Format/UnwrappedLineFormatter.cpp
716

switch?

This revision is now accepted and ready to land.Sep 1 2022, 12:32 PM
owenpan added inline comments.Sep 1 2022, 5:22 PM
clang/lib/Format/UnwrappedLineFormatter.cpp
716

It wasn't in the list, and I don't think it should be. We can add it in a separate patch if the need for merging switch statements ever arises.