diff options
author | Daniel Jasper <djasper@google.com> | 2015-07-16 14:25:43 +0000 |
---|---|---|
committer | Daniel Jasper <djasper@google.com> | 2015-07-16 14:25:43 +0000 |
commit | c6dd273a989f995750c5e5a1ef06647477ac37e1 (patch) | |
tree | b3524981e37b9e477bd0f3fa8369be123699fdcf /clang/lib | |
parent | 8c0970febd9110f26fe6c8fe0d46c062e27f8f7e (diff) | |
download | bcm5719-llvm-c6dd273a989f995750c5e5a1ef06647477ac37e1.tar.gz bcm5719-llvm-c6dd273a989f995750c5e5a1ef06647477ac37e1.zip |
clang-format: [Proto] Handle enum bodies differently.
In proto, enum constants can contain complex options and should be
handled more like individual declarations.
Before:
enum Type {
UNKNOWN = 0 [(some_options) =
{
a: aa,
b: bb
}];
};
After:
enum Type {
UNKNOWN = 0 [(some_options) = {
a: aa,
b: bb
}];
};
llvm-svn: 242404
Diffstat (limited to 'clang/lib')
-rw-r--r-- | clang/lib/Format/UnwrappedLineParser.cpp | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/clang/lib/Format/UnwrappedLineParser.cpp b/clang/lib/Format/UnwrappedLineParser.cpp index 97fd98ecb94..e705c98c67b 100644 --- a/clang/lib/Format/UnwrappedLineParser.cpp +++ b/clang/lib/Format/UnwrappedLineParser.cpp @@ -811,9 +811,8 @@ void UnwrappedLineParser::parseStructuralElement() { // parseEnum falls through and does not yet add an unwrapped line as an // enum definition can start a structural element. parseEnum(); - // This does not apply for Java and JavaScript. - if (Style.Language == FormatStyle::LK_Java || - Style.Language == FormatStyle::LK_JavaScript) { + // This only applies for C++. + if (Style.Language != FormatStyle::LK_Cpp) { addUnwrappedLine(); return; } @@ -1554,6 +1553,9 @@ void UnwrappedLineParser::parseEnum() { // Java enums are different. parseJavaEnumBody(); return; + } else if (Style.Language == FormatStyle::LK_Proto) { + parseBlock(/*MustBeDeclaration=*/true); + return; } // Parse enum body. |