diff options
Diffstat (limited to 'clang')
| -rw-r--r-- | clang/lib/Format/TokenAnnotator.cpp | 3 | ||||
| -rw-r--r-- | clang/unittests/Format/FormatTestProto.cpp | 5 |
2 files changed, 7 insertions, 1 deletions
diff --git a/clang/lib/Format/TokenAnnotator.cpp b/clang/lib/Format/TokenAnnotator.cpp index b1f414f8dd7..7b2c595403a 100644 --- a/clang/lib/Format/TokenAnnotator.cpp +++ b/clang/lib/Format/TokenAnnotator.cpp @@ -1254,7 +1254,8 @@ bool TokenAnnotator::spaceRequiredBetween(const AnnotatedLine &Line, const FormatToken &Left, const FormatToken &Right) { if (Style.Language == FormatStyle::LK_Proto) { - if (Right.is(tok::l_paren) && Left.TokenText == "returns") + if (Right.is(tok::l_paren) && + (Left.TokenText == "returns" || Left.TokenText == "option")) return true; } if (Right.is(tok::hashhash)) diff --git a/clang/unittests/Format/FormatTestProto.cpp b/clang/unittests/Format/FormatTestProto.cpp index d102c6567c1..7623e46db44 100644 --- a/clang/unittests/Format/FormatTestProto.cpp +++ b/clang/unittests/Format/FormatTestProto.cpp @@ -68,5 +68,10 @@ TEST_F(FormatTestProto, MessageFieldAttributes) { " [default = REALLY_REALLY_LONG_CONSTANT_VALUE];"); } +TEST_F(FormatTestProto, FormatsOptions) { + verifyFormat("option java_package = \"my.test.package\";"); + verifyFormat("option (my_custom_option) = \"abc\";"); +} + } // end namespace tooling } // end namespace clang |

