This is an archive of the discontinued LLVM Phabricator instance.

[clang-format] Allow `throw` to be a keyword in front of casts
ClosedPublic

Authored by rymiel on Aug 26 2022, 2:35 PM.

Details

Summary

This makes throw more similar to return. However, unlike return,
it has to more strict as to not remove spaces after usages of throw as
a (deprecated) exception specifier.

Fixes https://github.com/llvm/llvm-project/issues/57391

Diff Detail

Event Timeline

rymiel created this revision.Aug 26 2022, 2:35 PM
Herald added a project: Restricted Project. · View Herald TranscriptAug 26 2022, 2:35 PM
rymiel requested review of this revision.Aug 26 2022, 2:35 PM
Herald added a project: Restricted Project. · View Herald TranscriptAug 26 2022, 2:35 PM
Herald added a subscriber: cfe-commits. · View Herald Transcript
rymiel added a project: Restricted Project.Aug 26 2022, 2:35 PM
MyDeveloperDay accepted this revision.Aug 27 2022, 11:04 PM

This at least seems to make sense

This revision is now accepted and ready to land.Aug 27 2022, 11:04 PM

We should add a test case for TT_CastRParen in clang/unittests/Format/TokenAnnotatorTest.cpp.

rymiel updated this revision to Diff 456402.Aug 29 2022, 10:43 AM

Add a few token annotator tests

owenpan accepted this revision.Aug 29 2022, 12:12 PM

Add a few token annotator tests

Thanks!

MyDeveloperDay added inline comments.Aug 29 2022, 2:15 PM
clang/unittests/Format/FormatTest.cpp
10961

Can we add a test that covers the setting of SpaceAfterCStyleCast with throw? and SpacesInCStyleCastParentheses for completeness

rymiel updated this revision to Diff 456480.Aug 29 2022, 3:43 PM

Add extra tests for spacing options

rymiel marked an inline comment as done.Aug 29 2022, 3:44 PM
MyDeveloperDay accepted this revision.Sep 2 2022, 9:43 AM
curdeius accepted this revision.Sep 5 2022, 12:42 AM

@rymiel, please provide your name and email address for the commit message, so that we can land it for you.

This revision was landed with ongoing or failed builds.Sep 5 2022, 3:36 AM
This revision was automatically updated to reflect the committed changes.