This is an archive of the discontinued LLVM Phabricator instance.

[clang-format] Do not insert space after new/delete keywords in C function declarations
ClosedPublic

Authored by penagos on Feb 22 2022, 5:20 PM.

Diff Detail

Event Timeline

penagos created this revision.Feb 22 2022, 5:20 PM
penagos updated this revision to Diff 410700.Feb 22 2022, 8:08 PM
This comment was removed by penagos.
penagos published this revision for review.Feb 22 2022, 8:13 PM

The windows build failure appears to be unrelated to this change. I found the need to include !Left.Previous in the conditional so as to account for the existing unittest in the form of:

new (expr)

To not wind up formatting this case as:

new(expr)

Though it's still unclear to me whether or not it'd make more sense to continue to pursue a change to introduce C as a language. Thoughts?

Herald added a project: Restricted Project. · View Herald TranscriptFeb 22 2022, 8:13 PM
Herald added a subscriber: cfe-commits. · View Herald Transcript
curdeius accepted this revision.Feb 22 2022, 11:13 PM

Though it's still unclear to me whether or not it'd make more sense to continue to pursue a change to introduce C as a language. Thoughts?

I prefer your current approach (and there should be not that many cases that we need a special treatment for C).
Adding a new language would be to disruptive and difficult, as well as hard to use in some cases (headers in C and C++ often share the same extension).

clang/unittests/Format/FormatTest.cpp
9926

Why there's no space after delete in the input?

This revision is now accepted and ready to land.Feb 22 2022, 11:13 PM
penagos updated this revision to Diff 410788.Feb 23 2022, 5:47 AM

Add missing space in unittest.

penagos marked an inline comment as done.Feb 23 2022, 5:49 AM

Though it's still unclear to me whether or not it'd make more sense to continue to pursue a change to introduce C as a language. Thoughts?

I prefer your current approach (and there should be not that many cases that we need a special treatment for C).

Makes sense. I'll also need someone to commit on my behalf:

  • Luis Penagos
  • luis@penagos.co

Thanks!

clang/unittests/Format/FormatTest.cpp
9926

Whoops, good catch.

This revision was landed with ongoing or failed builds.Feb 24 2022, 1:06 AM
This revision was automatically updated to reflect the committed changes.
Herald added a project: Restricted Project. · View Herald TranscriptApr 4 2022, 4:33 AM