clang-format覆盖WebKit样式的多行注释

ill*_*zur 6 c++ clang-format

我正在尝试使用clang-format来清理我的存储库中的代码.我们使用WebKit样式作为格式化的基础,但是我们还希望确保多行注释的格式正确.

根据我的理解,可以通过定义.clang格式文件来覆盖给定样式的格式规则:

BasedOnStyle: WebKit
AlignTrailingComments: true
Run Code Online (Sandbox Code Playgroud)

这种方式clang-format应该对齐尾随注释.

给定输入文件:

    /**
     * This is a multi-line comment
     */
    void function() {
        /**
         * This is comment inside the function
         */
    }
Run Code Online (Sandbox Code Playgroud)

我的期望是以下输出

/**
 * This is a multi-line comment
 */
void function()
{
    /**
     * This is comment inside the function
     */
}
Run Code Online (Sandbox Code Playgroud)

但是我得到的是:

/**
     * This is a multi-line comment
     */
void function()
{
    /**
         * This is comment inside the function
         */
}
Run Code Online (Sandbox Code Playgroud)

我已经尝试将Webkit的格式化选项转储为.clang格式文件,并将AlignTrailingComments从false更改为true.这也没有任何影响.

Webkit样式中是否存在一些干扰AlignTrailingComments选项的选项?

DrP*_*rJo 2

AlignTrailingComments对齐连续行中的注释尾随代码:

int short;        // short
int longlonglong; // long
Run Code Online (Sandbox Code Playgroud)