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

Konstantin Tokarev annulen at yandex.ru
Fri Dec 7 08:43:43 PST 2012


07.12.2012, 20:39, "Daniel Jasper" <djasper at google.com>:
> Hi all,although I think we can make clang-format (clang/lib/Format) format more and more pieces of C++ according to a specific style, I am convinced that there are cases where automatic formatting is not the right solution.
> An example is:
> http://clang.llvm.org/doxygen/ParseExpr_8cpp-source.html line 60-90. Here, careful human thought leads to much more readable code then simply following a style guide.

IMO, manual column formatting should be avoided in most cases. For example, code fragment you are referring to would be even more readable (and conforming to coding style) if used line breaks befor "return" statements.

> In order to handle such cases and still be able to auto-format entire files, I propose to add certain markers around areas of a file that clang-format should not touch. Does anyone have thoughts on this? How would we best design this? Add special comments like "// NO clang-format {"?



-- 
Regards,
Konstantin



More information about the cfe-dev mailing list