diff options
author | Nico Weber <nicolasweber@gmx.de> | 2014-11-10 16:30:02 +0000 |
---|---|---|
committer | Nico Weber <nicolasweber@gmx.de> | 2014-11-10 16:30:02 +0000 |
commit | a644d7f39c22e918c1368169e508048b7860e32e (patch) | |
tree | 176aaa006ba6bfdb85fe406a84d9cb528e479211 /clang/lib/Format/TokenAnnotator.cpp | |
parent | 337f5b27adaa61395cba6af8fe1b2999dbc234fa (diff) | |
download | bcm5719-llvm-a644d7f39c22e918c1368169e508048b7860e32e.tar.gz bcm5719-llvm-a644d7f39c22e918c1368169e508048b7860e32e.zip |
clang-format: [Java] Never treat @interface as annotation.
'@' followed by any keyword can't be an annotation, but @interface is currently
the only combination of '@' and a keyword that's allowed, so limit it to this
case. `@interface Foo` without a leading `public` was misformatted prior to
this patch.
llvm-svn: 221607
Diffstat (limited to 'clang/lib/Format/TokenAnnotator.cpp')
-rw-r--r-- | clang/lib/Format/TokenAnnotator.cpp | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/clang/lib/Format/TokenAnnotator.cpp b/clang/lib/Format/TokenAnnotator.cpp index d00e648706b..62ec93f3234 100644 --- a/clang/lib/Format/TokenAnnotator.cpp +++ b/clang/lib/Format/TokenAnnotator.cpp @@ -842,7 +842,8 @@ private: // function declaration have been found. Current.Type = TT_TrailingAnnotation; } else if (Style.Language == FormatStyle::LK_Java && Current.Previous && - Current.Previous->is(tok::at)) { + Current.Previous->is(tok::at) && + Current.isNot(Keywords.kw_interface)) { const FormatToken& AtToken = *Current.Previous; if (!AtToken.Previous || AtToken.Previous->Type == TT_LeadingJavaAnnotation) |