Like with ForEachMacros, support user to provide additional macros that act like if statements.
This makes it possible to support KJ_IF_MAYBE from the cap'n'proto library:
https://github.com/capnproto/capnproto/blob/master/kjdoc/tour.md#maybes.
Paths
| Differential D102730
[clang-format] Support custom If macros ClosedPublic Authored by • vlovich on May 18 2021, 3:29 PM.
Details Summary Like with ForEachMacros, support user to provide additional macros that act like if statements. This makes it possible to support KJ_IF_MAYBE from the cap'n'proto library:
Diff Detail Event Timeline
Comment Actions Looks good, but please add a test with the else IF and just else case. Also for me it would be ok to add your KJ_IF_MAYBE to the default configuration. But I have no experience on that.
Comment Actions Review response:
Comment Actions Fixed missing _ after the hyperlink to the KJ link in the Style options documentation. I'm assuming that's required formatting for hyperlinks by what renders the markdown.
• vlovich marked 3 inline comments as done. Comment ActionsReview response. Updated the options I changed via the dump_format_style.py script but didn't ingest all the other changes it generated.
Comment Actions Thanks for working on this! Concerning the lexer part, I wouldn't do anything cleaner.
Comment Actions Review response I've updated coverage for AllowShortIfStatementsOnASingleLine and This revision is now accepted and ready to land.Jun 22 2021, 11:42 AM This revision was landed with ongoing or failed builds.Jun 23 2021, 8:53 AM Closed by commit rGbe9a87fe9bc3: [clang-format] Add IfMacros option (authored by • vlovich). · Explain Why This revision was automatically updated to reflect the committed changes.
Revision Contents
Diff 347150 clang/docs/ClangFormatStyleOptions.rst
clang/docs/ReleaseNotes.rst
clang/include/clang/Format/Format.h
clang/lib/Format/Format.cpp
clang/lib/Format/FormatToken.h
clang/lib/Format/FormatTokenLexer.cpp
clang/lib/Format/TokenAnnotator.cpp
clang/unittests/Format/FormatTest.cpp
|
stiled? did you mean styled?