r200406 - clang-format: More custom option fixes for protocol buffer files.
Daniel Jasper
djasper at google.com
Wed Jan 29 10:52:43 PST 2014
Author: djasper
Date: Wed Jan 29 12:52:43 2014
New Revision: 200406
URL: http://llvm.org/viewvc/llvm-project?rev=200406&view=rev
Log:
clang-format: More custom option fixes for protocol buffer files.
Before:
repeated double value = 1 [(aaaaaaa.aaaaaaaaa) = {
aaaaaaaaaaaaaaaa : AAAAAAAAAA,
bbbbbbbbbbbbbbbb : BBBBBBBBBB
}];
After:
repeated double value = 1
[(aaaaaaa.aaaaaaaaa) = {aaaaaaaaaaaaaaaa : AAAAAAAAAA,
bbbbbbbbbbbbbbbb : BBBBBBBBBB}];
Modified:
cfe/trunk/lib/Format/TokenAnnotator.cpp
cfe/trunk/unittests/Format/FormatTestProto.cpp
Modified: cfe/trunk/lib/Format/TokenAnnotator.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Format/TokenAnnotator.cpp?rev=200406&r1=200405&r2=200406&view=diff
==============================================================================
--- cfe/trunk/lib/Format/TokenAnnotator.cpp (original)
+++ cfe/trunk/lib/Format/TokenAnnotator.cpp Wed Jan 29 12:52:43 2014
@@ -280,7 +280,8 @@ private:
if (CurrentToken->isOneOf(tok::r_paren, tok::r_square))
return false;
updateParameterCount(Left, CurrentToken);
- if (CurrentToken->is(tok::colon))
+ if (CurrentToken->is(tok::colon) &&
+ Style.Language != FormatStyle::LK_Proto)
Left->Type = TT_DictLiteral;
if (!consumeToken())
return false;
Modified: cfe/trunk/unittests/Format/FormatTestProto.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/unittests/Format/FormatTestProto.cpp?rev=200406&r1=200405&r2=200406&view=diff
==============================================================================
--- cfe/trunk/unittests/Format/FormatTestProto.cpp (original)
+++ cfe/trunk/unittests/Format/FormatTestProto.cpp Wed Jan 29 12:52:43 2014
@@ -82,6 +82,9 @@ TEST_F(FormatTestProto, MessageFieldAttr
" [default = REALLY_REALLY_LONG_CONSTANT_VALUE];");
verifyFormat("repeated double value = 1\n"
" [(aaaaaaa.aaaaaaaaa) = {aaaaaaaaaaaaaaaaa : AAAAAAAA}];");
+ verifyFormat("repeated double value = 1\n"
+ " [(aaaaaaa.aaaaaaaaa) = {aaaaaaaaaaaaaaaa : AAAAAAAAAA,\n"
+ " bbbbbbbbbbbbbbbb : BBBBBBBBBB}];");
}
TEST_F(FormatTestProto, FormatsOptions) {
More information about the cfe-commits
mailing list