if (CurrentToken->isOneOf(tok::r_paren, tok::r_square, tok::r_brace,
tok::question, tok::colon))
return false;
- if (CurrentToken->isOneOf(tok::pipepipe, tok::ampamp) &&
+ if (CurrentToken->Parent->isOneOf(tok::pipepipe, tok::ampamp) &&
+ CurrentToken->Parent->Type != TT_PointerOrReference &&
Line.First.isNot(tok::kw_template))
return false;
updateParameterCount(Left, CurrentToken);
TEST_F(FormatTest, StaticInitializers) {
verifyFormat("static SomeClass SC = { 1, 'a' };");
- // FIXME: Format like enums if the static initializer does not fit on a line.
verifyFormat(
"static SomeClass WithALoooooooooooooooooooongName = {\n"
" 100000000, \"aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa\"\n"
TEST_F(FormatTest, MacroDefinitionsWithIncompleteCode) {
verifyFormat("#define A :");
-
- // FIXME: Improve formatting of case labels in macros.
verifyFormat("#define SOMECASES \\\n"
" case 1: \\\n"
" case 2\n",
getLLVMStyleWithColumns(20));
-
verifyFormat("#define A template <typename T>");
verifyFormat("#define STR(x) #x\n"
"f(STR(this_is_a_string_literal{));");
" aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa::\n"
" aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa();");
- // FIXME: Look into whether we should indent 4 from the start or 4 from
- // "bbbbb..." here instead of what we are doing now.
verifyFormat(
"aaaaaaaaaaaaaaa(bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb::\n"
" cccccccccccccccccccccccccccccccccccccccccccccc());");
verifyGoogleFormat("return sizeof(int**);");
verifyIndependentOfContext("Type **A = static_cast<Type **>(P);");
verifyGoogleFormat("Type** A = static_cast<Type**>(P);");
- // FIXME: The newline is wrong.
verifyFormat("auto a = [](int **&, int ***) {};");
verifyIndependentOfContext("InvalidRegions[*R] = 0;");
verifyGoogleFormat("int f(int a, char&& b) {}");
verifyGoogleFormat("void f() { int&& a = b; }");
- // FIXME: These require somewhat deeper changes in template arguments
- // formatting.
- // verifyIndependentOfContext("A<int &&> a;");
- // verifyIndependentOfContext("A<int &&, int &&> a;");
- // verifyGoogleFormat("A<int&&> a;");
- // verifyGoogleFormat("A<int&&, int&&> a;");
+ verifyIndependentOfContext("A<int &&> a;");
+ verifyIndependentOfContext("A<int &&, int &&> a;");
+ verifyGoogleFormat("A<int&&> a;");
+ verifyGoogleFormat("A<int&&, int&&> a;");
}
TEST_F(FormatTest, FormatsBinaryOperatorsPrecedingEquals) {