[cfe-dev] Question and feature proposition for clang-format

Thomas Serre via cfe-dev cfe-dev at lists.llvm.org
Sun Apr 25 23:59:04 PDT 2021


Hello everyone,

I'm using clang-format to reformat and improve the readability of a quite
large codebase.
I've written my .clang_format and everything is going fine on .cc files.
However, I've some trouble formatting my header files.

In codebase, when headers are properly formatted, there are looking like
this :

int                     shortFunc
         (int);
unsigned long long      shortFunc2
         (int);
int
looooooonnnnnnnnngggggggggFunctioooonnnnnNaaaammmmeeee  (int, int,
int);

I'd like to keep the alignment on parentheses in header files.
However, the best I achieve with clang-format is this result :

int                                 shortFunc(int);
unsigned long long                  shortFunc2(int);
int
looooooonnnnnnnnngggggggggFunctioooonnnnnNaaaammmmeeee(int, int, int);

Here are my questions:

1) Do you know if I can achieve this format (alignment on function
names and on parentheses) in header files with clang-format?

2) If it is not possible, would it be possible for me to contribute to
clang-format in order to add this feature ?

I hope I'm writing on the right mailing list :)

Have a nice week,

Thomas
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-dev/attachments/20210426/5dc24617/attachment-0001.html>


More information about the cfe-dev mailing list