summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorNico Weber <nicolasweber@gmx.de>2013-01-09 21:42:32 +0000
committerNico Weber <nicolasweber@gmx.de>2013-01-09 21:42:32 +0000
commitd8ffe75ad155bb261cf64665d35118dc54a0c56d (patch)
tree8271b667d86335e43d18c4807ee18d996dcb2cc8
parent8696a8d9e38e3f4fc267db9d1c5c47415e335316 (diff)
downloadbcm5719-llvm-d8ffe75ad155bb261cf64665d35118dc54a0c56d.tar.gz
bcm5719-llvm-d8ffe75ad155bb261cf64665d35118dc54a0c56d.zip
Formatter: Make parseObjCUntilAtEnd() actually work.
llvm-svn: 172003
-rw-r--r--clang/lib/Format/UnwrappedLineParser.cpp2
-rw-r--r--clang/unittests/Format/FormatTest.cpp7
2 files changed, 9 insertions, 0 deletions
diff --git a/clang/lib/Format/UnwrappedLineParser.cpp b/clang/lib/Format/UnwrappedLineParser.cpp
index 688937c1e6a..1d0cb30af84 100644
--- a/clang/lib/Format/UnwrappedLineParser.cpp
+++ b/clang/lib/Format/UnwrappedLineParser.cpp
@@ -212,6 +212,8 @@ void UnwrappedLineParser::parseStructuralElement() {
return parseObjCInterface();
case tok::objc_protocol:
return parseObjCProtocol();
+ case tok::objc_end:
+ return; // Handled by the caller.
default:
break;
}
diff --git a/clang/unittests/Format/FormatTest.cpp b/clang/unittests/Format/FormatTest.cpp
index e06544a95f2..15fe9aa9d73 100644
--- a/clang/unittests/Format/FormatTest.cpp
+++ b/clang/unittests/Format/FormatTest.cpp
@@ -1189,6 +1189,8 @@ TEST_F(FormatTest, FormatObjCInterface) {
"@end");
verifyFormat("@interface Foo\n"
+ "@end\n"
+ "@interface Bar\n"
"@end");
verifyFormat("@interface Foo : Bar\n"
@@ -1262,6 +1264,11 @@ TEST_F(FormatTest, FormatObjCProtocol) {
verifyFormat("@protocol Foo;\n"
"@protocol Bar;\n");
+
+ verifyFormat("@protocol Foo\n"
+ "@end\n"
+ "@protocol Bar\n"
+ "@end");
}
TEST_F(FormatTest, ObjCAt) {
OpenPOWER on IntegriCloud