Proposal for clang-format -r option

mateusz janek via cfe-commits cfe-commits at lists.llvm.org
Wed Jan 11 15:19:44 PST 2017


Hello,

First of all, I want to say 'Hello' to everyone, I'm new in llvm/clang dev
community.

Today I want to present you a small clang-format proposal.

I want to propose a '-r' option, with which, clang-format will search for
files, which will match regex[s] passed like normal files, down in the
directories tree. Motivation is more user-friendly clang-format. Now when
user want to do such thing, he need to write some scripts/use bash magic.
On Windows, it's even harder. Sample clang-format call, for c++ files,
would look e.g. like this:
clang-format -i -r .\.cpp$

This patch provides strict regex matching, so such call won't work:
'clang-format -i -r *.cpp'

Next thing to implement could be some kind of 'easy regexs' or so, which
would accept '*.cpp', but IMHO this isn't in the scope of this patch, so I
didn't implement it.

I didn't write any test or so. Before, I wanted to write this mail and get
feedback if -r option is even a thing and you will like it. After your
acceptance, I'll write tests, update documentation etc.

Of course, patch is backward compatible.

If you have questions/comments/accepts/rejects feel free (:

Kind Regards,
Stryku
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20170112/bd066ad3/attachment.html>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: clang_format-r.patch
Type: application/octet-stream
Size: 6785 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20170112/bd066ad3/attachment.obj>


More information about the cfe-commits mailing list