From 749c1b597a8f2f544d285e9cf5fe18552a3a0137 Mon Sep 17 00:00:00 2001 From: Hans Wennborg Date: Fri, 19 Oct 2018 16:19:52 +0000 Subject: Java annotation declaration being handled correctly Previously, Java annotation declarations (@interface AnnotationName) were being handled as ObjC interfaces. This caused the brace formatting to mess up, so that when you had a class with an interface defined in it, it would indent the final brace of the class. It used to format this class like so: class A { @interface B {} } But will now just skip the @interface and format it like so: class A { @interface B {} } Patch by Sam Maier! Differential Revision: https://reviews.llvm.org/D53434 llvm-svn: 344789 --- clang/lib/Format/UnwrappedLineParser.cpp | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'clang/lib/Format/UnwrappedLineParser.cpp') diff --git a/clang/lib/Format/UnwrappedLineParser.cpp b/clang/lib/Format/UnwrappedLineParser.cpp index 4debdd15ba7..3cd3c8f9cdf 100644 --- a/clang/lib/Format/UnwrappedLineParser.cpp +++ b/clang/lib/Format/UnwrappedLineParser.cpp @@ -1130,6 +1130,10 @@ void UnwrappedLineParser::parseStructuralElement() { nextToken(); parseBracedList(); break; + } else if (Style.Language == FormatStyle::LK_Java && + FormatTok->is(Keywords.kw_interface)) { + nextToken(); + break; } switch (FormatTok->Tok.getObjCKeywordID()) { case tok::objc_public: -- cgit v1.2.3