reference, declarationdefinition
definition → references, declarations, derived classes, virtual overrides
reference to multiple definitions → definitions
unreferenced

References

tools/clang/unittests/Format/FormatTestComments.cpp
   72     EXPECT_EQ(Code.str(), format(Code, Style)) << "Expected code is not stable";
   73     EXPECT_EQ(Code.str(), format(test::messUp(Code), Style));
   83     format(Code, Style, SC_DoNotCheck);
  148             format("#include \\\n"
  166             format("enum A {\n"
  179             format("enum A {\n"
  188             format("enum A {\n"
  198             format("enum A {\n"
  209             format("enum A {\n"
  239             format("void f()    {     // This does something ..\n"
  248             format("class C{void f()    { // This does something ..\n"
  255             format("int i;\\\n// single line trailing comment"));
  276             format("D(a, {\n"
  284             format("lineWith();   // comment\n"
  291             format("lineWith();   // comment\n"
  298             format("lineWith();   // comment\n"
  305             format("lineWith();   // comment\n"
  311             format("lineWith();\n"
  317             format("// first\n"
  324             format("f();\n"
  336             format("f();   // comment\n"
  344             format("f();   // comment\n"
  352             format("void              f() {\n"
  358             format("int xy;    // a\n"
  362             format("int xy;    // a\n"
  383             format("if( // This is some comment\n"
  398             format("SomeFunction(a,\n"
  404             format("SomeFunction(a,\n"
  410             format("SomeFunction(a, b, // comment (unclear relation)\n"
  415             format("SomeFunction(a,     // comment\n"
  421             format("aaaaaaaaaa(aaaa(aaaa,\n"
  427   EXPECT_EQ("// comment", format("// comment  "));
  429             format("int aaaaaaa, bbbbbbb; // comment                   ",
  431   EXPECT_EQ("// comment\\\n", format("// comment\\\n  \t \v   \f   "));
  432   EXPECT_EQ("// comment    \\\n", format("// comment    \\\n  \t \v   \f   "));
  440             format("f(aaaaaaaaaaaaaaaaaaaaaaaaa ,   \\\n"
  446       format("f(aaaaaaaaaaaaaaaaaaaaaaaaa    ,   \n"
  453       format("void      aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa(\n"
  480             format("  /*\n"
  492             format("class C {\n"
  504             format("  /*\n"
  512             format("  /*\n"
  519             format("int i; /* Comment with empty...\n"
  529             format("int foobar = 0; /* comment */\n"
  541             format("int foobar = 0; /* comment */\n"
  558             format("double *x; /* aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa\n"
  570       format("void ffffffffffff(int aaaaaaaa, int bbbbbbbb, int cccccccccccc)\n"
  582             format("void ffffffffff(int aaaaa /* test */);",
  590             format("// A comment that doesn't fit on one line",
  595             format("/// A comment that doesn't fit on one line",
  600             format("//! A comment that doesn't fit on one line",
  605             format("// a b c d e f  g h i j k", getLLVMStyleWithColumns(10)));
  610       format("\\\n// a b c d e f  g h i j k", getLLVMStyleWithColumns(10)));
  614             format("if (true) // A comment that doesn't fit on one line   ",
  617             format("//    Don't_touch_leading_whitespace",
  621             format("//Add leading whitespace", getLLVMStyleWithColumns(20)));
  624             format("///Add leading whitespace", getLLVMStyleWithColumns(20)));
  627             format("//!Add leading whitespace", getLLVMStyleWithColumns(20)));
  628   EXPECT_EQ("// whitespace", format("//whitespace", getLLVMStyle()));
  631             format("//Even if it makes the line exceed the column limit",
  633   EXPECT_EQ("//--But not here", format("//--But not here", getLLVMStyle()));
  636             format("/// line 1\n"
  646             format("///line 1\n"
  655             format("// aa bb             cc dd                   ",
  662             format("// A comment before a macro definition\n"
  670             format("void ffffff(\n"
  676             format("//\t aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
  681       format("#define XXX // a b c d e f g h", getLLVMStyleWithColumns(22)));
  685       format("#define XXX //q w e r t y u i", getLLVMStyleWithColumns(22)));
  691             format("{\n"
  703             format("{\n"
  716             format("//     A comment that doesn't fit on one line",
  722             format("///     A comment that doesn't fit on one line",
  730             format("// aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa\\\n"
  736             format("int a; // AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA\\\n"
  746             format("double a; // AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA\\\n"
  757       format("// IWYU pragma: aaaaaaaaaaaaaaaaaa bbbbbbbbbbbbbb", Pragmas));
  760       format("/* IWYU pragma: aaaaaaaaaaaaaaaaaa bbbbbbbbbbbbbb */", Pragmas));
  768             format("if (xxx == yyy && // aaaaaaaaaaaa bbbbbbbbb\n"
  775             format("if (xxxxxxxxxx == yyy && // aaaaaa bbbbbbbb cccc\n"
  782             format("if (xxxxxxxxxx && yyy || // aaaaaa bbbbbbbb cccc\n"
  788             format("fffffffff(&xxx, // aaaaaaaaaaaa bbbbbbbbbbb\n"
  798             format("#define A(x) /* \\\n"
  808             format("#define A(      \\\n"
  818             format("namespace {}\n   // Test\n#define A"));
  820             format("namespace {}\n   /* Test */\n#define A"));
  822             format("namespace {}\n   /* Test */    #define A"));
  834             format("void f() {\n"
  848             format("void f() {\n"
  865             format("int f(int i) {\n"
  885             format("int f(int i) {\n"
  906             format("int f(int i) {\n"
  926             format("void f() {\n"
  943             format("void f() {\n"
  963             format("int f(int i) {\n"
  985             format("int f(int i) {\n"
 1008             format("int f(int i) {\n"
 1029             format("void f() {\n"
 1045             format("int f(int i) {\n"
 1065             format("int f(int i) {\n"
 1086             format("int f(int i) {\n"
 1105             format("/* "
 1116       format("/* a b c d e f  g h i j k */", getLLVMStyleWithColumns(10)));
 1122       format("\\\n/* a b c d e f  g h i j k */", getLLVMStyleWithColumns(10)));
 1128             format("/*\n"
 1140             format("/*      \n"
 1152             format("/*\n"
 1161             format("/*\n"
 1173             format("{\n"
 1191             format("{\n"
 1207             format("   /*\n"
 1217             format("{\n"
 1227             format("/* A comment before a macro definition */\n"
 1238             format("  /* some comment\n"
 1250             format("/**\n"
 1259             format("/** multilineblockcommentwithnowrapopportunity */",
 1266             format("  /*       \n"
 1272             format("/* a a            */", getLLVMStyleWithColumns(15)));
 1274             format("/* a a            bc  */", getLLVMStyleWithColumns(15)));
 1277             format("/* aaa aaa aaaaa       */", getLLVMStyleWithColumns(15)));
 1280             format("/* aaa aaa aaaaa     */", getLLVMStyleWithColumns(15)));
 1292             format("#define X \\\n"
 1304             format("#define X \\\n"
 1314             format("#define X \\\n"
 1334             format("#ifdef A // line 1 about A\n"
 1368             format("#if A\n"
 1383       format("static SomeType type = { aaaaaaaaaaaaaaaaaaaa  ,  /* comment */\n"
 1416             format("S s =    {\n"
 1429             format("S s =    {\n"
 1447             format("if (true) { // comment about branch\n"
 1464             format("if (1) { // if line 1\n"
 1481             format("do { // line 1\n"
 1492             format("while (a < b) {// line 1\n"
 1504             format("// long long long long\n"
 1511             format("// long long long long\n"
 1519             format("// long long long long\n"
 1527             format("// long long long long\n"
 1541             format("/// long long long long\n"
 1546             format("//! long long long long\n"
 1551             format("/* long long long long\n"
 1556             format("///< long long long long\n"
 1561             format("//!< long long long long\n"
 1569             format("/*  long long long long\n"
 1577             format("/* long long long long\n"
 1584             format("/* long long long long\n"
 1594             format("/* long long long long\n"
 1607             format("{\n"
 1620             format("/* long long long long */", getLLVMStyleWithColumns(20)));
 1626             format("int i; /* long long long */", getLLVMStyleWithColumns(20)));
 1631             format("// long long long lon\n"
 1641             format("// long long long long\n"
 1651             format("// long long long long long long long long\n"
 1660             format("// long long long lon1\n"
 1670             format("// long long long lon1\n"
 1675   EXPECT_EQ("// long long long", format("// long              long\n"
 1681             format("int i; ///           a", getLLVMStyleWithColumns(20)));
 1686             format("// long long long long    \n"
 1692             format("/* long long long     */", getLLVMStyleWithColumns(20)));
 1697             format("/*               long */", getLLVMStyleWithColumns(20)));
 1707             format("{\n"
 1719             format("// long long long long\n"
 1726             format("// long long long longng\n"
 1736             format("int a; // Trailing comment\n"
 1743             format("/// This long line gets\n"
 1748             format(" //! This long line gets\n"
 1754             format("/* This long line gets\n"
 1764             format("{\n"
 1776             format("/*\n"
 1791             format("/// First line gets broken.\n"
 1798             format("int i; // first long long\n"
 1808             format("{\n"
 1819             format("int i; /* first line\n"
 1831       format("//     long\n"
 1839             format("/* Long long long line\n"
 1848             format("/* First comment block\n"
 1860             format("int i; // This long line gets broken.\n"
 1870             format("{\n"
 1881             format("//! long long long long\n"
 1889             format("/* long long long long\n"
 1897             format("/* long long long long\n"
 1906             format("// long long long long\n"
 1914             format(
 1923             format("// long long long long\n"
 1931             format("// long long long long\n"
 1939             format("// long long long long\n"
 1947             format("// long long long long\n"
 1955             format("// long long long long\n"
 1962             format("/* long long long long\n"
 1971             format(
 1981             format("/* First comment block\n"
 1991             format("// long long long long\n"
 1999             format("// - long long long long\n"
 2005             format("// * long long long long\n"
 2011             format("// + long long long long\n"
 2017             format("// 1. long long long long\n"
 2023             format("// -# long long long long\n"
 2030             format("// - long long long long\n"
 2038             format("// - long long long long\n"
 2046             format("// long long long long\n"
 2054             format("// long long long 10.\n"
 2066             format("#include \"t\" /* l l l\n"
 2075             format("int i; // long long long\n"
 2084             format("int i; // trigger reflow\n"
 2093             format("a = f(/* looooooooong long\n* long\n*/ a);",
 2101             format("a = f(/* loooooong long\n* long\n*/ a);",
 2105   EXPECT_EQ("/**/", format(" /**/", getLLVMStyleWithColumns(20)));
 2106   EXPECT_EQ("/* */", format(" /* */", getLLVMStyleWithColumns(20)));
 2107   EXPECT_EQ("/*  */", format(" /*  */", getLLVMStyleWithColumns(20)));
 2108   EXPECT_EQ("//", format(" //  ", getLLVMStyleWithColumns(20)));
 2109   EXPECT_EQ("///", format(" ///  ", getLLVMStyleWithColumns(20)));
 2121             format("// some text that reflows\n"
 2128             format("// some text that reflows\n"
 2139             format("// some text that reflows\n"
 2147             format("// some text that reflows\n"
 2156             format("// some text that\n"
 2161             format("// some text that\n"
 2167             format("/* some text that\n"
 2177             format("// some text that\n"
 2186             format("// some text that does\n"
 2196             format("#if 0\n"
 2204             format("#if false\n"
 2217             format("enum E {\n"
 2235             format("enum F {\n"
 2255             format("enum G {\n"
 2275             format("enum H {\n"
 2294             format("enum I {\n"
 2314             format("enum J {\n"
 2332             format("#ifdef SWIG\n"
 2339             format("#ifndef SWIG\n"
 2350       format("int xxxxxxxxx;                          /* "
 2377             format("/* *//* */  /* */\n/* *//* */  /* */"));
 2378   EXPECT_EQ("/* */ a /* */ b;", format("  /* */  a/* */  b;"));
 2384             format("#define A /*123*/ b\n"
 2392             format("#define A\n"
 2395   EXPECT_EQ("/*\n**\n*/", format("/*\n**\n*/"));
 2401             format("/*\n"
 2411             format("/*\n"
 2420             format("int aaaaaaaaaaaaaaaaaaaaaaaaaaaa =\n"
 2432             format("someFunction (1,   /* comment 1 */\n"
 2444       format(
 2452       format("int aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa; /* comment */\n"
 2461             format("/*\n"
 2467             format("/*\n"
 2473             format("/*\n"
 2478             format("/*\n"
 2482             format("/*\n"
 2491             format("#define A {        \\\n"
 2500             format("#define A {        \\\n"
 2511             format("a = {1111 /*    */\n"
 2517             format("a = {1111 /*      */\n"
 2524             format("a = {1111 /*      a */\n"
 2533             format("a = f(/* long long */ a);", getLLVMStyleWithColumns(16)));
 2538             format("a = f(/* long long */ a);", getLLVMStyleWithColumns(15)));
 2544             format("a = f(/* long\n"
 2553             format("a = f(/* long\n"
 2562             format("a = f(/* long\n"
 2572       format("a = f(a, /* long long */ b);", getLLVMStyleWithColumns(16)));
 2580       format("a = f(a, /* long long */ b);", getLLVMStyleWithColumns(15)));
 2586             format("a = f(a, /* long long */ (1 + 1));",
 2593             format("a = f(a, /* long long */ (1 + 1));",
 2608             format("#define MACRO(V)\\\n"
 2617             format("int i = f(abc, // line 1\n"
 2627             format("int ab; // line\n"
 2634             format("int ab; // line\n"
 2642             format("int ab; // line\n"
 2651             format("int ab; // line\n"
 2662             format("int i, j; // line 1\n"
 2669             format("int i, j; // line 1\n"
 2680             format("class A {\n"
 2693             format("class A {\n"
 2709             format("int f(int n) { // comment line 1 on f\n"
 2740             format("int f(int n) {\n"
 2769             format("int a; // line about a\n"
 2775             format("int a; // line about a\n"
 2783             format("int a; // line about a\n"
 2793             format("/*\n"
 2797             format("/*\n"
 2801             format("/*\n"
 2807             format("/*\n"
 2812             format("/*\n"
 2817             format("/*\n"
 2822             format("/*\n"
 2827             format("/**\n"
 2832             format("/**\n"
 2837             format("/**\n"
 2842             format("/**\n"
 2847             format("/**\n"
 2855             format("/*\n"
 2861             format("/*\n"
 2867             format("/*\n"
 2874             format("/* line 1\n"
 2879             format("/* line 1\n"
 2884             format("/* line 1\n"
 2889             format("/* line 1\n"
 2894             format("/* line 1\n"
 2899             format("int i; /* line 1\n"
 2904             format("int i; /* line 1\n"
 2909             format("int i; /* line 1\n"
 2917             format("/* line 1\n"
 2924             format("/* line 1\n"
 2932             format("/*\n"
 2945             format("/*\n"
 2958             format("/**\n"
 2970             format("/*\n"
 2987       format(
 3006             format("const /** comment comment comment comment */\n"
 3015             format("#comment\n"
 3020             format("# comment\n"
 3027             format("# comment comment comment\n"
 3036             format("data {\n"
 3045             format("data {# comment comment comment\n"
 3052             format("# comment comment comment\n"
 3060             format("k:val#comment comment\n"
 3069             format("id {k:val#comment comment\n"
 3081             format("k:val#commen1 commen2\n"
 3105   format(
 3123       format("/**\n"
 3131             format("/**\n"
 3141             format("/**\n"
 3152       " */\n", format(
 3165             format("/**\n"
 3176             format("/**\n"
 3187             format("/**\n"
 3199             format("/**\n"
 3207             format("/**\n"