Teach clang-format to understand static_asserts better.

Before:
  template <bool B, bool C>
  class A {
    static_assert(B &&C, "Something is wrong");
  };

After:
  template <bool B, bool C>
  class A {
    static_assert(B && C, "Something is wrong");
  };

(Note the spacing around '&&'). Also change the identifier table to always
understand all C++11 keywords (which seems like the right thing to do).

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@187589 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/lib/Format/Format.cpp b/lib/Format/Format.cpp
index 290f059..f59fb37 100644
--- a/lib/Format/Format.cpp
+++ b/lib/Format/Format.cpp
@@ -1330,7 +1330,7 @@
   FormatTokenLexer(Lexer &Lex, SourceManager &SourceMgr,
                    encoding::Encoding Encoding)
       : FormatTok(NULL), GreaterStashed(false), TrailingWhitespace(0), Lex(Lex),
-        SourceMgr(SourceMgr), IdentTable(Lex.getLangOpts()),
+        SourceMgr(SourceMgr), IdentTable(getFormattingLangOpts()),
         Encoding(Encoding) {
     Lex.SetKeepWhitespaceMode(true);
   }
diff --git a/lib/Format/TokenAnnotator.cpp b/lib/Format/TokenAnnotator.cpp
index e0e24e2..39ebe95 100644
--- a/lib/Format/TokenAnnotator.cpp
+++ b/lib/Format/TokenAnnotator.cpp
@@ -93,6 +93,9 @@
       }
     }
 
+    if (Left->Previous && Left->Previous->is(tok::kw_static_assert))
+      Contexts.back().IsExpression = true;
+
     if (StartsObjCMethodExpr) {
       Contexts.back().ColonIsObjCMethodExpr = true;
       Left->Type = TT_ObjCMethodExpr;
diff --git a/unittests/Format/FormatTest.cpp b/unittests/Format/FormatTest.cpp
index 6a5f022..e2bb65d 100644
--- a/unittests/Format/FormatTest.cpp
+++ b/unittests/Format/FormatTest.cpp
@@ -3687,6 +3687,11 @@
   verifyIndependentOfContext("A<int &&, int &&> a;");
   verifyGoogleFormat("A<int&&> a;");
   verifyGoogleFormat("A<int&&, int&&> a;");
+
+  // Not rvalue references:
+  verifyFormat("template <bool B, bool C> class A {\n"
+               "  static_assert(B && C, \"Something is wrong\");\n"
+               "};");
 }
 
 TEST_F(FormatTest, FormatsBinaryOperatorsPrecedingEquals) {