[PATCH] Added an option to avoid splitting certain kinds of comments into lines.

Alp Toker alp at nuanti.com
Thu Jan 2 07:44:03 PST 2014


On 02/01/2014 15:38, Alexander Kornienko wrote:
> On Thu, Jan 2, 2014 at 4:28 PM, Alp Toker <alp at nuanti.com 
> <mailto:alp at nuanti.com>> wrote:
>
>
>     On 02/01/2014 15:19, Alexander Kornienko wrote:
>
>         On Thu, Jan 2, 2014 at 11:54 AM, Alexander Kornienko
>         <alexfh at google.com <mailto:alexfh at google.com>
>         <mailto:alexfh at google.com <mailto:alexfh at google.com>>> wrote:
>
>             On Thu, Jan 2, 2014 at 11:37 AM, Alp Toker <alp at nuanti.com
>         <mailto:alp at nuanti.com>
>             <mailto:alp at nuanti.com <mailto:alp at nuanti.com>>> wrote:
>
>
>                 On 02/01/2014 10:24, Manuel Klimek wrote:
>
>                     On Thu, Jan 2, 2014 at 11:21 AM, Alp Toker
>         <alp at nuanti.com <mailto:alp at nuanti.com>
>                     <mailto:alp at nuanti.com <mailto:alp at nuanti.com>>
>         <mailto:alp at nuanti.com <mailto:alp at nuanti.com>
>
>                     <mailto:alp at nuanti.com <mailto:alp at nuanti.com>>>>
>         wrote:
>
>                         Just saw this after Manuel replied.
>
>                         Is it OK to reformat IWYU pragmas in other coding
>                     styles, say in
>                         the LLVM style?
>
>
>                     I think we mainly want to not have *all* pragmas
>         in *all*
>                     coding styles. IWYU is just an example, and we can
>         easily
>                     add it to other styles.
>
>                         If not, that's an indication this kind of setting
>                     should be
>                         separated from individual coding style
>         descriptions as
>                     it appears
>                         equally applicable to WebKit, Chromium, LLVM and
>                     custom styles.
>
>
>                     Well, you can set it for all of those? What is your
>                     proposed solution?
>
>
>                 A quick fix without major surgery on the proposed
>         patch would
>                 be to have the same default value, or empty default value,
>                 shared between all built-in coding styles so that
>         switching
>                 between them doesn't change behaviour.
>
>                 This makes sense because non-reformatted comment
>         pragmas are
>                 project-level / user-level settings not related to or
>         really
>                 defined by any coding style.
>
>                 This'll be great for lit RUN lines too(!)
>
>
>             And for CHECK.*: lines as well (i'll update the patch).
>         But this
>             is a good example of why it doesn't make sense to make this a
>             global setting. I can easily imagine comments starting
>         with " RUN:
>             " or " CHECK: ", that don't have special meaning in any
>         code, that
>             is not lit tests. And then it would be undesirable to
>         leave these
>             comments on a single line, if they exceed column limit.
>
>
>         Thinking a bit more, it seems like a better idea to put the
>         setting for RUN: and CHECK.*: lines in .clang-format inside
>         the tests/ directories.
>
>
>     Agree fully. Ditto for IWYU -- no need to hard-code it in GoogleStyle.
>
>
> IWYU pragmas are neither limited to a certain narrow kind of C++ 
> files, nor too generic (it's rather unlikely, that someone uses this 
> substring for a different purpose ;). So they can be safely put into 
> all styles (which is done in the committed version of the patch).

Cool, just saw your commit. Putting it in the core inherited LLVMStyle 
more or less addresses my concerns :-)

Thanks for the feature Alexander

Alp.


-- 
http://www.nuanti.com
the browser experts




More information about the cfe-commits mailing list