forked from OSchip/llvm-project
clang-format: Fix incorrect multi-var declstmt detection.
This is now obvious as the pointer alignment behavior was changed. Before (even with pointer alignment "Left"): MACRO Constructor(const int &i) : a(a), b(b) {} After: MACRO Constructor(const int& i) : a(a), b(b) {} llvm-svn: 235301
This commit is contained in:
parent
29c8270916
commit
e4ab49e8d3
|
@ -543,12 +543,12 @@ private:
|
|||
parseTemplateDeclaration();
|
||||
break;
|
||||
case tok::comma:
|
||||
if (Contexts.back().FirstStartOfName && Contexts.size() == 1) {
|
||||
if (Contexts.back().InCtorInitializer)
|
||||
Tok->Type = TT_CtorInitializerComma;
|
||||
else if (Contexts.back().FirstStartOfName && Contexts.size() == 1) {
|
||||
Contexts.back().FirstStartOfName->PartOfMultiVariableDeclStmt = true;
|
||||
Line.IsMultiVariableDeclStmt = true;
|
||||
}
|
||||
if (Contexts.back().InCtorInitializer)
|
||||
Tok->Type = TT_CtorInitializerComma;
|
||||
if (Contexts.back().IsForEachMacro)
|
||||
Contexts.back().IsExpression = true;
|
||||
break;
|
||||
|
|
|
@ -5336,6 +5336,7 @@ TEST_F(FormatTest, UnderstandsUsesOfStarAndAmp) {
|
|||
verifyIndependentOfContext("int x = ~*p;");
|
||||
verifyFormat("Constructor() : a(a), area(width * height) {}");
|
||||
verifyFormat("Constructor() : a(a), area(a, width * height) {}");
|
||||
verifyGoogleFormat("MACRO Constructor(const int& i) : a(a), b(b) {}");
|
||||
verifyFormat("void f() { f(a, c * d); }");
|
||||
|
||||
verifyIndependentOfContext("InvalidRegions[*R] = 0;");
|
||||
|
|
Loading…
Reference in New Issue