summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDaniel Jasper <djasper@google.com>2016-06-20 20:39:53 +0000
committerDaniel Jasper <djasper@google.com>2016-06-20 20:39:53 +0000
commit8b61d14d7e2103a19b22c7f1d9ed2e2ab4f87416 (patch)
tree96f7390172e5aa4dc04fc2d959ac0a6de756d4e9
parent3dd74b8edbf721932508dc8fe11fa99267aa0610 (diff)
downloadbcm5719-llvm-8b61d14d7e2103a19b22c7f1d9ed2e2ab4f87416.tar.gz
bcm5719-llvm-8b61d14d7e2103a19b22c7f1d9ed2e2ab4f87416.zip
clang-format: [Proto] Fix "import public" after r273179.
llvm-svn: 273196
-rw-r--r--clang/lib/Format/UnwrappedLineParser.cpp2
-rw-r--r--clang/unittests/Format/FormatTestProto.cpp6
2 files changed, 8 insertions, 0 deletions
diff --git a/clang/lib/Format/UnwrappedLineParser.cpp b/clang/lib/Format/UnwrappedLineParser.cpp
index 53d8c15d48d..2fe72987bc7 100644
--- a/clang/lib/Format/UnwrappedLineParser.cpp
+++ b/clang/lib/Format/UnwrappedLineParser.cpp
@@ -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();
diff --git a/clang/unittests/Format/FormatTestProto.cpp b/clang/unittests/Format/FormatTestProto.cpp
index 68d724981ce..2580f7fb8c0 100644
--- a/clang/unittests/Format/FormatTestProto.cpp
+++ b/clang/unittests/Format/FormatTestProto.cpp
@@ -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"
OpenPOWER on IntegriCloud