Lines Matching +defs:clang +defs:format +defs:style

11 #define DEBUG_TYPE "format-test"
13 namespace clang {
14 namespace format {
3830 verifyFormat("enum [[clang::enum_extensibility(open)]] E {\n"
3836 verifyFormat("enum [[nodiscard]] [[clang::enum_extensibility(open)]] E {\n"
3842 verifyFormat("enum [[clang::enum_extensibility(open)]] E { // foo\n"
3847 "enum [[clang::enum_extensibility(open)]] E{// foo\n"
4360 // Properly indent according to NamespaceIndentation style
5388 FormatStyle style = getChromiumStyle(FormatStyle::LK_Cpp);
5389 style.IndentWidth = 4;
5390 style.PPIndentWidth = 1;
5392 style.IndentPPDirectives = FormatStyle::PPDIS_None;
5402 style);
5404 style.IndentPPDirectives = FormatStyle::PPDIS_AfterHash;
5414 style);
5416 style.IndentPPDirectives = FormatStyle::PPDIS_BeforeHash;
5426 style);
5445 style);
5447 style.IndentPPDirectives = FormatStyle::PPDIS_None;
5455 style);
5464 style);
5476 style);
5488 style);
5496 style);
5502 style);
5504 style.PPIndentWidth = 2;
5512 style);
5513 style.IndentWidth = 8;
5521 style);
5523 style.IndentWidth = 1;
5524 style.PPIndentWidth = 4;
5532 style);
5538 style);
5540 style.IndentWidth = 4;
5541 style.PPIndentWidth = 1;
5542 style.IndentPPDirectives = FormatStyle::PPDIS_AfterHash;
5550 style);
5562 style);
5574 style);
5580 style);
5582 style.PPIndentWidth = 2;
5583 style.IndentWidth = 8;
5591 style);
5593 style.PPIndentWidth = 4;
5594 style.IndentWidth = 1;
5600 style);
5602 style.IndentWidth = 4;
5603 style.PPIndentWidth = 1;
5604 style.IndentPPDirectives = FormatStyle::PPDIS_BeforeHash;
5613 style);
5623 style);
5631 style);
5633 style.PPIndentWidth = 2;
5641 style);
5643 style.PPIndentWidth = 4;
5644 style.IndentWidth = 1;
5652 style);
8069 // Test the style where all parameters are on their own lines.
9705 " format(TheLine.First,\n"
10006 " format(TheLine.First,\n"
10596 // The return breaking style doesn't affect:
12265 verifyIndependentOfContext("MACRO(A *[[clang::attr]] a);");
12266 verifyIndependentOfContext("MACRO(A *[[clang::attr(\"foo\")]] a);");
12430 verifyFormat("x = (foo *[[clang::attr]])*v;");
12431 verifyFormat("x = (foo *[[clang::attr(\"foo\")]])*v;");
12443 "_Nonnull [[clang::attr]] __ptr32 __ptr64 __capability";
12471 verifyFormat("[[gsl::suppress(\"clang-tidy-check-name\")]] void f() {}");
12701 // Casts in Obj-C style calls used to not be recognized as such.
14441 // With nested lists, we should either format one item per line or all nested
15390 // This code would be painfully slow to format if we didn't skip it.
15409 format(std::string("int i;") + Code + "int j;",
15468 // FIXME: In LLVM style, there should be a space in front of a '<' for ObjC
15475 // If there's no return type (very rare in practice!), LLVM and Google style
15486 format("\"some text other\";", getLLVMStyleWithColumns(12)));
15490 format("\\\n\"some text other\";", getLLVMStyleWithColumns(12)));
15507 format("\"some text\"", getLLVMStyleWithColumns(10)));
15511 format("\"some text\"", getLLVMStyleWithColumns(7)));
15516 format("\"some text\"", getLLVMStyleWithColumns(6)));
15521 format("\"some tex and\"", getLLVMStyleWithColumns(6)));
15526 format("\"some/tex/and\"", getLLVMStyleWithColumns(6)));
15579 format("\"splitmeatrandompoint\"", getLLVMStyleWithColumns(10)));
15585 format("\"split/pathat/slashes\"", getLLVMStyleWithColumns(10)));
15591 format("\"split/pathat/slashes\"", getLLVMStyleWithColumns(10)));
15599 format("\"split at "
15667 format("aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa"
15677 format("u8\"utf8 string literal\";", getGoogleStyleWithColumns(16)));
15682 format("u\"utf16 string literal\";", getGoogleStyleWithColumns(16)));
15687 format("U\"utf32 string literal\";", getGoogleStyleWithColumns(16)));
15691 format("L\"wide string literal\";", getGoogleStyleWithColumns(16)));
15697 // This input makes clang-format try to split the incomplete unicode escape
15720 format(" _T(\"aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa\")", Style));
15732 // format(" _T ( \"aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa\" )",
15927 // LLVM style uses latest lexer.
15989 format("\"test\\n\"", getLLVMStyleWithColumns(7)));
15993 format("\"tes\\\\n\"", getLLVMStyleWithColumns(7)));
15997 format("\"\\\\\\\\\\n\"", getLLVMStyleWithColumns(7)));
16002 format("\"\\uff01test\"", getLLVMStyleWithColumns(8)));
16007 format("\"\\x000000000001next\"", getLLVMStyleWithColumns(16)));
16014 format("\"test\\000000000001\"", getLLVMStyleWithColumns(9)));
16019 format("\"test\\000000000001\"", getLLVMStyleWithColumns(10)));
20444 // clang-format off
20453 // clang-format on
20466 // clang-format off
20475 // clang-format on
20489 // clang-format off
20498 // clang-format on
20513 // clang-format off
20522 // clang-format on
20545 // clang-format off
20555 // clang-format on
20559 // clang-format off
20569 // clang-format on
21058 // Make a few changes to the style for testing purposes
22073 format("demo = std::array<struct test, 3>{test{56, 23, \"hello world "
22280 format("// foo bar baz bazfoo\n"
22289 format("// foo bar baz bazfoo\n"
22405 format("\"\xce\xe4\xed\xe0\xe6\xe4\xfb \xe2 "
22447 format("\"aaaaÄ\xc2\x8d\";", getLLVMStyleWithColumns(10)));
22451 format("\"aaaaaaaÄ\xc2\x8d\";", getLLVMStyleWithColumns(10)));
22457 format("\"Однажды, в студёную зимнюю пору,\"",
22465 format("\"一 二 三 四 五六 七 八 九 十\"", getLLVMStyleWithColumns(11)));
22474 format("\"一\t二 \t三 四 五\t六 \t七 八九十\tqq\"",
22481 format("\"aaaaaa\\\xC2\x8D\"", getLLVMStyleWithColumns(10)));
23265 // FIXME: this format is not ideal and we should consider forcing the first
24135 format("\"aaaaaaa bbbbbbb\";\r\n", getLLVMStyleWithColumns(10)));
24157 FormatStyle style = getLLVMStyle();
24159 EXPECT_EQ(style.LineEnding, FormatStyle::LE_DeriveLF);
24170 style);
24171 style.LineEnding = FormatStyle::LE_DeriveCRLF;
24182 style);
24184 style.LineEnding = FormatStyle::LE_LF;
24197 style);
24198 style.LineEnding = FormatStyle::LE_CRLF;
24211 style);
24213 style.LineEnding = FormatStyle::LE_DeriveLF;
24226 style);
24227 style.LineEnding = FormatStyle::LE_DeriveCRLF;
24240 style);
24346 verifyFormat("// clang-format off\n"
24348 "// clang-format on",
24350 verifyFormat("// clang-format off\n"
24352 "// clang-format on",
24492 "// clang-format off\n"
24494 "// clang-format on\n"
24497 " // clang-format off\n"
24499 " // clang-format on\n"
24502 "/* clang-format off */\n"
24504 "/* clang-format on */\n"
24507 " /* clang-format off */\n"
24509 " /* clang-format on */\n"
24513 verifyFormat("// clang-format off\n"
24515 "/* clang-format on */\n"
24520 "/* clang-format off */\n"
24522 "// clang-format off\n"
24524 "/* clang-format on */\n"
24527 "/* clang-format off */\n"
24532 "// clang-format off:\n"
24534 "// clang-format on: 1\n"
24537 "// clang-format off:\n"
24539 "// clang-format on: 1\n"
24543 "// clang-format off:0\n"
24545 "// clang-format only\n"
24548 "// clang-format off:0\n"
24550 "// clang-format only\n"
24553 verifyNoChange("// clang-format off\n"
24558 "// clang-format on");
24562 format("? ) =");
24729 guessLanguage("foo.h", "[[clang::fallthrough]];"));
24731 guessLanguage("foo.h", "[[clang:fallthrough] foo];"));
24735 guessLanguage("foo.h", "[[using clang: fallthrough]];"));
24737 guessLanguage("foo.h", "[[abusing clang:fallthrough] bar];"));
24746 "[[clang::callable_when(\"unconsumed\", \"unknown\")]]"));
25655 // The default in LLVM style is REI_OuterScope, but these tests were written
26073 // The default in LLVM style is REI_OuterScope, but these tests were written
28722 } // namespace format
28723 } // namespace clang