[PATCH] D57687: [clang-format] Add style option AllowShortLambdasOnASingleLine

Ronald Wampler via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Mon Feb 4 07:25:01 PST 2019


rdwampler created this revision.
rdwampler added reviewers: djasper, klimek.
Herald added a project: clang.
Herald added a subscriber: cfe-commits.

This option `AllowShortLambdasOnASingleLine` similar to the other `AllowShort*` options, but applied to C++ lambdas.

I considered making this dependent on `AllowShortFunctionsOnASingleLine`, but could not think of how the breaking should be behave when the option is set to `Inline` and `InlineOnly`.

I could not find a specific coding style that requires short lambdas to //always// break on a new line, but I do think it's fairly common practice. Also, I note that the patch: https://reviews.llvm.org/D44609 attempts to add an option to allow formatting lambda using the Allman style braces. Here is a coding style that requires Allman style braces, but allows lambdas to be on single line if they are short. So, maybe this option would be required to handle this situation?

Addresses: https://bugs.llvm.org//show_bug.cgi?id=32151


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D57687

Files:
  clang/docs/ClangFormatStyleOptions.rst
  clang/include/clang/Format/Format.h
  clang/lib/Format/Format.cpp
  clang/lib/Format/FormatToken.h
  clang/lib/Format/TokenAnnotator.cpp
  clang/lib/Format/UnwrappedLineParser.cpp
  clang/unittests/Format/FormatTest.cpp

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D57687.185040.patch
Type: text/x-patch
Size: 9291 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20190204/22ec53d0/attachment.bin>


More information about the cfe-commits mailing list