Skip to content

clang-format only formats comments correctly when column width is set explicitly #38728

@llvmbot

Description

@llvmbot
Bugzilla Link 39380
Version unspecified
OS Linux
Reporter LLVM Bugzilla Contributor

Extended Description

After a few hours trying around I finally found the following issue with clang-format-6.0 on Ubuntu using a configuration file derived from dumping WebKit style:

If the configuration file contains the original line

ColumnLimit: 0
then a C++ code comment like
//some text
will not be fixed by adding an extra space after '//'

Changing the configuration file to

ColumnLimit: 120
a C++ code comment like
//some text
is converted to
// some text

This means that identical .clang-format config files lead to different output depending on the input not only for line wrapping (which I would accept), but also to the completely unrelated comments.

BTW: IMHO adding spaces to a comment should be an extra option anyway

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions