以下是我的clang格式
---
AccessModifierOffset: '-4'
AlignConsecutiveAssignments: 'true'
AlignOperands: 'true'
AlignTrailingComments: 'true'
AllowShortCaseLabelsOnASingleLine: 'false'
AllowShortIfStatementsOnASingleLine: 'true'
AllowShortLoopsOnASingleLine: 'false'
AlwaysBreakTemplateDeclarations: 'true'
BinPackArguments: 'true'
BinPackParameters: 'true'
BreakBeforeBraces: Allman
BreakConstructorInitializersBeforeComma: 'true'
ColumnLimit: '80'
ConstructorInitializerAllOnOneLineOrOnePerLine: 'true'
Cpp11BracedListStyle: 'true'
IndentCaseLabels: 'false'
IndentWidth: '4'
MaxEmptyLinesToKeep: '2'
NamespaceIndentation: All
PointerAlignment: Left
SpaceAfterCStyleCast: 'true'
SpaceBeforeAssignmentOperators: 'true'
SpaceBeforeParens: ControlStatements
SpacesBeforeTrailingComments: '1'
SpacesInParentheses: 'false'
SpacesInSquareBrackets: 'false'
Standard: Auto
TabWidth: '4'
UseTab: Always
...
但是当我在 c++ 文件中运行它时,我得到如下结果(代码是乱码复制粘贴,尽管未对齐分配的问题区域是我在代码中看到的内容的逐字副本)
template <class X>
void prettyPrint(std::ostream& o, const X* x)
{
o << "*{";
if (x)
{
prettyPrint(o, *x);
}
else
{
o << "NULL";
}
// I wanted the following assignments to align !!!!
using value_type = std::decay_t<decltype(state)>;
using difference_type = std::ptrdiff_t;
using reference = value_type&;
using pointer = value_type*;
using iterator_category = std::input_iterator_tag;
o << "}";
}
设置好
AlignConsecutiveAssignments: 'true'
我发现上述行为是错误的,我的其余部分是否会.clang-format
弄乱结果,或者我应该将其报告为错误?