r175286 - Done break between 'operator' and '<<'.
Daniel Jasper
djasper at google.com
Fri Feb 15 11:24:08 PST 2013
Author: djasper
Date: Fri Feb 15 13:24:08 2013
New Revision: 175286
URL: http://llvm.org/viewvc/llvm-project?rev=175286&view=rev
Log:
Done break between 'operator' and '<<'.
Before:
ostream &operator
<<(ostream &out, some::ns::SomeReallyLongType WithSomeReallyLongValue);
After:
ostream &operator<<(ostream &out,
some::ns::SomeReallyLongType WithSomeReallyLongValue);
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=175286&r1=175285&r2=175286&view=diff
==============================================================================
--- cfe/trunk/lib/Format/TokenAnnotator.cpp (original)
+++ cfe/trunk/lib/Format/TokenAnnotator.cpp Fri Feb 15 13:24:08 2013
@@ -1055,7 +1055,7 @@ bool TokenAnnotator::canBreakBefore(cons
return true;
if (Left.Type == TT_PointerOrReference || Left.Type == TT_TemplateCloser ||
Left.Type == TT_UnaryOperator || Left.Type == TT_ConditionalExpr ||
- Left.is(tok::question))
+ Left.is(tok::question) || Left.is(tok::kw_operator))
return false;
if (Left.is(tok::equal) && Line.Type == LT_VirtualFunctionDecl)
return false;
Modified: cfe/trunk/unittests/Format/FormatTest.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/unittests/Format/FormatTest.cpp?rev=175286&r1=175285&r2=175286&view=diff
==============================================================================
--- cfe/trunk/unittests/Format/FormatTest.cpp (original)
+++ cfe/trunk/unittests/Format/FormatTest.cpp Fri Feb 15 13:24:08 2013
@@ -1620,6 +1620,10 @@ TEST_F(FormatTest, UndestandsOverloadedO
verifyFormat("void operator delete(void *ptr);");
verifyFormat("void operator delete[](void *ptr);");
+ verifyFormat(
+ "ostream &operator<<(ostream &OutputStream,\n"
+ " SomeReallyLongType WithSomeReallyLongValue);");
+
verifyGoogleFormat("operator void*();");
verifyGoogleFormat("operator SomeType<SomeType<int>>();");
}
More information about the cfe-commits
mailing list