r222128 - clang-format: Fix regression introduced in r221609.
Daniel Jasper
djasper at google.com
Mon Nov 17 05:55:05 PST 2014
Author: djasper
Date: Mon Nov 17 07:55:04 2014
New Revision: 222128
URL: http://llvm.org/viewvc/llvm-project?rev=222128&view=rev
Log:
clang-format: Fix regression introduced in r221609.
Before:
void f() { f(a, c *d); }
After:
void f() { f(a, c * d); }
Modified:
cfe/trunk/lib/Format/TokenAnnotator.cpp
cfe/trunk/unittests/Format/FormatTest.cpp
Modified: cfe/trunk/lib/Format/TokenAnnotator.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Format/TokenAnnotator.cpp?rev=222128&r1=222127&r2=222128&view=diff
==============================================================================
--- cfe/trunk/lib/Format/TokenAnnotator.cpp (original)
+++ cfe/trunk/lib/Format/TokenAnnotator.cpp Mon Nov 17 07:55:04 2014
@@ -763,7 +763,8 @@ private:
Previous && Previous->isOneOf(tok::star, tok::amp);
Previous = Previous->Previous)
Previous->Type = TT_PointerOrReference;
- Contexts.back().IsExpression = Contexts.back().InCtorInitializer;
+ if (Line.MustBeDeclaration)
+ Contexts.back().IsExpression = Contexts.back().InCtorInitializer;
} else if (Current.Previous &&
Current.Previous->Type == TT_CtorInitializerColon) {
Contexts.back().IsExpression = true;
Modified: cfe/trunk/unittests/Format/FormatTest.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/unittests/Format/FormatTest.cpp?rev=222128&r1=222127&r2=222128&view=diff
==============================================================================
--- cfe/trunk/unittests/Format/FormatTest.cpp (original)
+++ cfe/trunk/unittests/Format/FormatTest.cpp Mon Nov 17 07:55:04 2014
@@ -5009,6 +5009,7 @@ TEST_F(FormatTest, UnderstandsUsesOfStar
verifyIndependentOfContext("aaa && aaa->f();");
verifyIndependentOfContext("int x = ~*p;");
verifyFormat("Constructor() : a(a), area(width * height) {}");
+ verifyFormat("void f() { f(a, c * d); }");
verifyIndependentOfContext("InvalidRegions[*R] = 0;");
More information about the cfe-commits
mailing list