diff options
| -rw-r--r-- | clang/lib/Format/FormatToken.h | 2 | ||||
| -rw-r--r-- | clang/lib/Format/TokenAnnotator.cpp | 3 | ||||
| -rw-r--r-- | clang/unittests/Format/FormatTestJava.cpp | 1 |
3 files changed, 5 insertions, 1 deletions
diff --git a/clang/lib/Format/FormatToken.h b/clang/lib/Format/FormatToken.h index 7ffbfbd4eba..4811e02dd22 100644 --- a/clang/lib/Format/FormatToken.h +++ b/clang/lib/Format/FormatToken.h @@ -551,6 +551,7 @@ struct AdditionalKeywords { kw_implements = &IdentTable.get("implements"); kw_instanceof = &IdentTable.get("instanceof"); kw_interface = &IdentTable.get("interface"); + kw_native = &IdentTable.get("native"); kw_package = &IdentTable.get("package"); kw_synchronized = &IdentTable.get("synchronized"); kw_throws = &IdentTable.get("throws"); @@ -581,6 +582,7 @@ struct AdditionalKeywords { IdentifierInfo *kw_implements; IdentifierInfo *kw_instanceof; IdentifierInfo *kw_interface; + IdentifierInfo *kw_native; IdentifierInfo *kw_package; IdentifierInfo *kw_synchronized; IdentifierInfo *kw_throws; diff --git a/clang/lib/Format/TokenAnnotator.cpp b/clang/lib/Format/TokenAnnotator.cpp index 6ad1ad2cc7f..b4eb3656bdf 100644 --- a/clang/lib/Format/TokenAnnotator.cpp +++ b/clang/lib/Format/TokenAnnotator.cpp @@ -1749,7 +1749,8 @@ bool TokenAnnotator::spaceRequiredBefore(const AnnotatedLine &Line, return Style.SpaceBeforeParens != FormatStyle::SBPO_Never; if ((Left.isOneOf(tok::kw_static, tok::kw_public, tok::kw_private, tok::kw_protected) || - Left.isOneOf(Keywords.kw_final, Keywords.kw_abstract)) && + Left.isOneOf(Keywords.kw_final, Keywords.kw_abstract, + Keywords.kw_native)) && Right.is(TT_TemplateOpener)) return true; } diff --git a/clang/unittests/Format/FormatTestJava.cpp b/clang/unittests/Format/FormatTestJava.cpp index b187206e5c6..3c7cf327685 100644 --- a/clang/unittests/Format/FormatTestJava.cpp +++ b/clang/unittests/Format/FormatTestJava.cpp @@ -292,6 +292,7 @@ TEST_F(FormatTestJava, Generics) { verifyFormat("protected <R> ArrayList<R> get() {}"); verifyFormat("private <R> ArrayList<R> get() {}"); verifyFormat("public static <R> ArrayList<R> get() {}"); + verifyFormat("public static native <R> ArrayList<R> get();"); verifyFormat("public final <X> Foo foo() {}"); verifyFormat("public abstract <X> Foo foo();"); verifyFormat("<T extends B> T getInstance(Class<T> type);"); |

