[cfe-dev] clang-format: placement of cv-qualifiers

David Blaikie via cfe-dev cfe-dev at lists.llvm.org
Fri Mar 18 08:13:04 PDT 2016


This is probably more of a job for clang-tidy rather than clang-format. The
places where clang-format does anything more than modify whitespace (as is
the case here - reordering tokens) are pretty carefully selected. Whereas
clang-tidy is intended for all sorts of non-whitespace changes, including
the sort of thing you've described here.

I don't think I've heard of anyone working on something like this.

On Fri, Mar 18, 2016 at 5:04 AM, Sven Over via cfe-dev <
cfe-dev at lists.llvm.org> wrote:

> Hi, Clang Developers!
>
> It would be extremely useful for me if clang-format could take care of the
> placement of the cv-qualifier in cv-qualified types. What I mean is that I
> would like to use clang-format to enforce a convention to put cv-qualifiers
> on the left side of a type, i.e. write
>
>   T const, T const*, T const* const
>
> instead of
>
>   const T, const T*, const T* const
>
> I'm thinking of an option like
>
>   CVQualifier: left
>
> to enforce "T const" etc.,
>
>   CVQualifier: right
>
> to enforce "const T" etc., and
>
>   CVQualifier: none
>
> to not enforce either and leave cv-qualifiers where they are.
>
> I was wondering if any work in that direction has been done already. I
> can't find anything. Also, if anyone has some helpful ideas/pointers, I'd
> be very grateful. I've only spend a few hours dabbling with clang
> refactoring, so it'll take me some amount of time to understand how this
> could be implemented. Time well invested, I guess, but still, if someone
> has some ideas, please do tell!
>
> Thanks everyone!
> Sven.
>
> _______________________________________________
> cfe-dev mailing list
> cfe-dev at lists.llvm.org
> http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-dev
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-dev/attachments/20160318/dd1ca240/attachment-0001.html>


More information about the cfe-dev mailing list