r286041 - clang-format: Better support for CUDA's triple brackets.
Daniel Jasper via cfe-commits
cfe-commits at lists.llvm.org
Sat Nov 5 10:43:17 PDT 2016
Author: djasper
Date: Sat Nov 5 12:43:16 2016
New Revision: 286041
URL: http://llvm.org/viewvc/llvm-project?rev=286041&view=rev
Log:
clang-format: Better support for CUDA's triple brackets.
Before:
aaaaaaaaaaaaaaa<
aaaaaaaaa, aaaaaaaaaa,
aaaaaaaaaaaaaa><<<aaaaaaaaa, aaaaaaaaaa, aaaaaaaaaaaaaaaaaa>>>();
After:
aaaaaaaaaaaaaaa<aaaaaaaaa, aaaaaaaaaa, aaaaaaaaaaaaaa>
<<<aaaaaaaaa, aaaaaaaaaa, aaaaaaaaaaaaaaaaaa>>>();
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=286041&r1=286040&r2=286041&view=diff
==============================================================================
--- cfe/trunk/lib/Format/TokenAnnotator.cpp (original)
+++ cfe/trunk/lib/Format/TokenAnnotator.cpp Sat Nov 5 12:43:16 2016
@@ -2488,6 +2488,8 @@ bool TokenAnnotator::canBreakBefore(cons
return true;
if (Right.is(TT_RangeBasedForLoopColon))
return false;
+ if (Left.is(TT_TemplateCloser) && Right.is(TT_TemplateOpener))
+ return true;
if (Left.isOneOf(TT_TemplateCloser, TT_UnaryOperator) ||
Left.is(tok::kw_operator))
return false;
Modified: cfe/trunk/unittests/Format/FormatTest.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/unittests/Format/FormatTest.cpp?rev=286041&r1=286040&r2=286041&view=diff
==============================================================================
--- cfe/trunk/unittests/Format/FormatTest.cpp (original)
+++ cfe/trunk/unittests/Format/FormatTest.cpp Sat Nov 5 12:43:16 2016
@@ -11391,6 +11391,8 @@ TEST_F(FormatTest, TripleAngleBrackets)
EXPECT_EQ("f<param><<<1, 1>>>();", format("f< param > <<< 1, 1 >>> ();"));
verifyFormat("aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa"
"aaaaaaaaaaa<<<\n 1, 1>>>();");
+ verifyFormat("aaaaaaaaaaaaaaa<aaaaaaaaa, aaaaaaaaaa, aaaaaaaaaaaaaa>\n"
+ " <<<aaaaaaaaa, aaaaaaaaaa, aaaaaaaaaaaaaaaaaa>>>();");
}
TEST_F(FormatTest, MergeLessLessAtEnd) {
More information about the cfe-commits
mailing list