for (unsigned i = Start; i != End; ++i) {
if (ScopeStack.size() != 0 &&
- Changes[i].nestingAndIndentLevel() <
- Changes[ScopeStack.back()].nestingAndIndentLevel())
+ Changes[i].indentAndNestingLevel() <
+ Changes[ScopeStack.back()].indentAndNestingLevel())
ScopeStack.pop_back();
- if (i != Start && Changes[i].nestingAndIndentLevel() >
- Changes[i - 1].nestingAndIndentLevel())
+ if (i != Start && Changes[i].indentAndNestingLevel() >
+ Changes[i - 1].indentAndNestingLevel())
ScopeStack.push_back(i);
bool InsideNestedScope = ScopeStack.size() != 0;
// Measure the scope level (i.e. depth of (), [], {}) of the first token, and
// abort when we hit any token in a higher scope than the starting one.
- auto NestingAndIndentLevel = StartAt < Changes.size()
- ? Changes[StartAt].nestingAndIndentLevel()
+ auto IndentAndNestingLevel = StartAt < Changes.size()
+ ? Changes[StartAt].indentAndNestingLevel()
: std::pair<unsigned, unsigned>(0, 0);
// Keep track of the number of commas before the matching tokens, we will only
unsigned i = StartAt;
for (unsigned e = Changes.size(); i != e; ++i) {
- if (Changes[i].nestingAndIndentLevel() < NestingAndIndentLevel)
+ if (Changes[i].indentAndNestingLevel() < IndentAndNestingLevel)
break;
if (Changes[i].NewlinesBefore != 0) {
if (Changes[i].Tok->is(tok::comma)) {
++CommasBeforeMatch;
- } else if (Changes[i].nestingAndIndentLevel() > NestingAndIndentLevel) {
+ } else if (Changes[i].indentAndNestingLevel() > IndentAndNestingLevel) {
// Call AlignTokens recursively, skipping over this scope block.
unsigned StoppedAt = AlignTokens(Style, Matches, Changes, i);
i = StoppedAt - 1;
const Change *StartOfBlockComment;
int IndentationOffset;
- // A combination of nesting level and indent level, which are used in
+ // A combination of indent level and nesting level, which are used in
// tandem to compute lexical scope, for the purposes of deciding
// when to stop consecutive alignment runs.
- std::pair<unsigned, unsigned>
- nestingAndIndentLevel() const {
- return std::make_pair(Tok->NestingLevel, Tok->IndentLevel);
+ std::pair<unsigned, unsigned> indentAndNestingLevel() const {
+ return std::make_pair(Tok->IndentLevel, Tok->NestingLevel);
}
};
Alignment);
Alignment.BinPackParameters = true;
Alignment.ColumnLimit = 80;
+
+ // Bug 33507
+ Alignment.PointerAlignment = FormatStyle::PAS_Middle;
+ verifyFormat(
+ "auto found = range::find_if(vsProducts, [&](auto * aProduct) {\n"
+ " static const Version verVs2017;\n"
+ " return true;\n"
+ "});\n",
+ Alignment);
+ Alignment.PointerAlignment = FormatStyle::PAS_Right;
}
TEST_F(FormatTest, LinuxBraceBreaking) {