Skip to content
Snippets Groups Projects
Commit 9d5d990e authored by Daniel Jasper's avatar Daniel Jasper
Browse files

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

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@273196 91177308-0d34-0410-b5e6-96231b3b80d8
parent 38538eaf
No related branches found
No related tags found
No related merge requests found
...@@ -889,6 +889,8 @@ void UnwrappedLineParser::parseStructuralElement() { ...@@ -889,6 +889,8 @@ void UnwrappedLineParser::parseStructuralElement() {
} }
if (Style.Language == FormatStyle::LK_Proto) { if (Style.Language == FormatStyle::LK_Proto) {
nextToken(); nextToken();
if (FormatTok->is(tok::kw_public))
nextToken();
if (!FormatTok->is(tok::string_literal)) if (!FormatTok->is(tok::string_literal))
return; return;
nextToken(); nextToken();
......
...@@ -196,6 +196,12 @@ TEST_F(FormatTestProto, FormatsImports) { ...@@ -196,6 +196,12 @@ TEST_F(FormatTestProto, FormatsImports) {
"message A {\n" "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. // Missing semicolons should not confuse clang-format.
verifyFormat("import \"a.proto\"\n" verifyFormat("import \"a.proto\"\n"
"import \"b.proto\"\n" "import \"b.proto\"\n"
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment