[cfe-dev] Clang format documentation as .clang-format

Bram De Jong via cfe-dev cfe-dev at lists.llvm.org
Fri Nov 30 02:48:37 PST 2018


Hi all,

Yesterday I was (manually) going through all the clang format options and
crafting a format file for our organisation. While doing that I wondered:
wouldn't it be great if the documentation of clang-format was actually a
.clang-format file!

I.e. the docs could be a simple as:

AlignTrailingComments: false

# If true, aligns trailing comments.
#
# true:                                   false:
# int a;     // My comment a      vs.     int a; // My comment a
# int b = 2; // comment  b                int b = 2; // comment about b

AllowAllParametersOfDeclarationOnNextLine: true

# If the function declaration doesn’t fit on a line, allow putting all
parameters of a function
# declaration onto the next line even if BinPackParameters is false.
#
# true:
# void myFunction(
#     int a, int b, int c, int d, int e);
#
# false:
# void myFunction(int a,
#                 int b,
#                 int c,
#                 int d,
#                 int e);


I understand this isn't markdown, but this would tremendously improve the
ease of making your "own" clang-format specs.

Right now are some websites which help you with this:

   - https://zed0.co.uk/clang-format-configurator/
   - https://clangformat.com/

But neither supports v8, for example, nor do they contain the actual docs
of the functions...

Greetings,

Bram
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-dev/attachments/20181130/b5dff3c7/attachment.html>


More information about the cfe-dev mailing list