[cfe-dev] clang-format and "ASCII art" formatting

Manuel Klimek klimek at google.com
Fri Dec 7 11:38:46 PST 2012


On Fri, Dec 7, 2012 at 8:32 PM, Sebastian Redl <
sebastian.redl at getdesigned.at> wrote:

>
> On 07.12.2012, at 20:11, Sean Silva wrote:
>
> >> Regarding this specific example: I think it could be "simple" to just
> treat
> >> the whole line as "unbreakable" whenever there are several "case" on it.
> >>
> >> That is, if two 'case' are on the same physical line, just treat this
> whole
> >> line as a black box, and contend yourself with aligning it first
> non-blank
> >> character.
> >
> > That seems like it would work well and be a good general policy. There
> > are harder examples though like
> > <http://clang.llvm.org/doxygen/Lexer_8cpp_source.html#l01013> where
> > the source code is actually aligned with contents of nearby comments.
>
> Recognizing and leaving alone "tabular" array initializers would generally
> be a good thing. These are very common.
>

I think it's interesting to look at the two different use cases for
clang-format:
1. while writing my code, I basically type one big line (or break lines
arbitrarily) and then hit clang-format to fix it all up for me. In that
case I don't want clang-format to exclude certain constructs by itself
2. when running over a source file before checking it in

I think if we can have 1 and 2 lead to consistent layouts, that would be a
plus.

Cheers,
/Manuel
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-dev/attachments/20121207/83928217/attachment.html>


More information about the cfe-dev mailing list