clang-format: [Java] Treat 'instanceof' like other binary operators.

This fixes llvm.org/PR21436.

llvm-svn: 222641
diff --git a/clang/lib/Format/FormatToken.h b/clang/lib/Format/FormatToken.h
index 84e1858..05b05a5 100644
--- a/clang/lib/Format/FormatToken.h
+++ b/clang/lib/Format/FormatToken.h
@@ -532,6 +532,7 @@
     kw_extends = &IdentTable.get("extends");
     kw_final = &IdentTable.get("final");
     kw_implements = &IdentTable.get("implements");
+    kw_instanceof = &IdentTable.get("instanceof");
     kw_interface = &IdentTable.get("interface");
     kw_synchronized = &IdentTable.get("synchronized");
     kw_throws = &IdentTable.get("throws");
@@ -557,6 +558,7 @@
   IdentifierInfo *kw_extends;
   IdentifierInfo *kw_final;
   IdentifierInfo *kw_implements;
+  IdentifierInfo *kw_instanceof;
   IdentifierInfo *kw_interface;
   IdentifierInfo *kw_synchronized;
   IdentifierInfo *kw_throws;
diff --git a/clang/lib/Format/TokenAnnotator.cpp b/clang/lib/Format/TokenAnnotator.cpp
index e36a16a..aa6a8f5 100644
--- a/clang/lib/Format/TokenAnnotator.cpp
+++ b/clang/lib/Format/TokenAnnotator.cpp
@@ -795,8 +795,10 @@
     // Line.MightBeFunctionDecl can only be true after the parentheses of a
     // function declaration have been found. In this case, 'Current' is a
     // trailing token of this declaration and thus cannot be a name.
-    if (isStartOfName(Current) &&
-        (!Line.MightBeFunctionDecl || Current.NestingLevel != 0)) {
+    if (Current.is(Keywords.kw_instanceof)) {
+      Current.Type = TT_BinaryOperator;
+    } else if (isStartOfName(Current) &&
+               (!Line.MightBeFunctionDecl || Current.NestingLevel != 0)) {
       Contexts.back().FirstStartOfName = &Current;
       Current.Type = TT_StartOfName;
     } else if (Current.is(tok::kw_auto)) {