summaryrefslogtreecommitdiffstats
path: root/clang/lib/Format
diff options
context:
space:
mode:
authorDaniel Jasper <djasper@google.com>2013-08-28 08:04:23 +0000
committerDaniel Jasper <djasper@google.com>2013-08-28 08:04:23 +0000
commita15da3068d6e0310ece35618a94e151681b5aa67 (patch)
tree4f7b416df020821cfaca0cb86fcd81e4d6cc51e7 /clang/lib/Format
parentfce1b03ee7e64214389ab5e17394cb75d99f77aa (diff)
downloadbcm5719-llvm-a15da3068d6e0310ece35618a94e151681b5aa67.tar.gz
bcm5719-llvm-a15da3068d6e0310ece35618a94e151681b5aa67.zip
clang-format: Fix corner case in ObjC interface definitions.
In @implementation ObjcClass - (void)method; { } @end the ObjC compiler seems to accept the superfluous comma after "method", but clang-format used to assert on the subsequent "{". This fixes llvm.org/PR16604. llvm-svn: 189453
Diffstat (limited to 'clang/lib/Format')
-rw-r--r--clang/lib/Format/UnwrappedLineParser.cpp8
1 files changed, 7 insertions, 1 deletions
diff --git a/clang/lib/Format/UnwrappedLineParser.cpp b/clang/lib/Format/UnwrappedLineParser.cpp
index 168b59e8ee4..9e4600b430d 100644
--- a/clang/lib/Format/UnwrappedLineParser.cpp
+++ b/clang/lib/Format/UnwrappedLineParser.cpp
@@ -1030,7 +1030,13 @@ void UnwrappedLineParser::parseObjCUntilAtEnd() {
addUnwrappedLine();
break;
}
- parseStructuralElement();
+ if (FormatTok->is(tok::l_brace)) {
+ parseBlock(/*MustBeDeclaration=*/false);
+ // In ObjC interfaces, nothing should be following the "}".
+ addUnwrappedLine();
+ } else {
+ parseStructuralElement();
+ }
} while (!eof());
}
OpenPOWER on IntegriCloud