clang-format: [Proto] Fix "import public" after r273179.

llvm-svn: 273196
This commit is contained in:
Daniel Jasper 2016-06-20 20:39:53 +00:00
parent 3dd74b8edb
commit 8b61d14d7e
2 changed files with 8 additions and 0 deletions

View File

@ -889,6 +889,8 @@ void UnwrappedLineParser::parseStructuralElement() {
}
if (Style.Language == FormatStyle::LK_Proto) {
nextToken();
if (FormatTok->is(tok::kw_public))
nextToken();
if (!FormatTok->is(tok::string_literal))
return;
nextToken();

View File

@ -196,6 +196,12 @@ TEST_F(FormatTestProto, FormatsImports) {
"message A {\n"
"}");
verifyFormat("import public \"a.proto\";\n"
"import \"b.proto\";\n"
"// comment\n"
"message A {\n"
"}");
// Missing semicolons should not confuse clang-format.
verifyFormat("import \"a.proto\"\n"
"import \"b.proto\"\n"