]> granicus.if.org Git - clang/commitdiff
Formatter: Make parseObjCUntilAtEnd() actually work.
authorNico Weber <nicolasweber@gmx.de>
Wed, 9 Jan 2013 21:42:32 +0000 (21:42 +0000)
committerNico Weber <nicolasweber@gmx.de>
Wed, 9 Jan 2013 21:42:32 +0000 (21:42 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@172003 91177308-0d34-0410-b5e6-96231b3b80d8

lib/Format/UnwrappedLineParser.cpp
unittests/Format/FormatTest.cpp

index 688937c1e6aa5af2f691c0fab159f32cccf66b0a..1d0cb30af8459a609906b3e646ede4c658aa8d5a 100644 (file)
@@ -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;
     }
index e06544a95f20574f89692a069f862c189c19bbbf..15fe9aa9d737ad2087f55c3fd3a38b9bc75e1a5a 100644 (file)
@@ -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) {