[cfe-dev] clang-format, how to align function declarations?

Petteri Salo petteri.salo at gmail.com
Wed Apr 16 11:14:26 PDT 2014


Hello,

Can someone give me some pointers about where to look in the clang-format
sources to make a modification which would allow alignment of the function
names in a group of function declarations.

Or tell me if it is impossible without significant re-write, in other words
not doable after work and family.

For example:

class FooBar
{
    // these three function declarations belong to "group A"
    char* doo();
    const char* daa();
    const SomeReallyLongTypeName& dii();
    //------------------------------------------------

    // these three function declarations belong to "group B"
    void someMoreDoo();
    int notSoMuchDaa();
    //------------------------------------------------
};

In a real scenario the comment lines with "group x" would not be present.

The end result I'm looking for is:
- The names of the three functions in the group A would start at the same
column, i.e. doo() and daa() would align with dii().
- The name notSoMuchDaa() would align with someMoreDoo()

the comment line with dashes (//----- ) would signify "end of group"

Thanks,

Petteri Salo
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-dev/attachments/20140416/efc8ad55/attachment.html>


More information about the cfe-dev mailing list