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
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);
}
}
}
+ if (Left->Previous && Left->Previous->is(tok::kw_static_assert))
+ Contexts.back().IsExpression = true;
+
if (StartsObjCMethodExpr) {
Contexts.back().ColonIsObjCMethodExpr = true;
Left->Type = TT_ObjCMethodExpr;
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) {