clang: include/clang/Format/Format.h Source File (original) (raw)
1
2
3
4
5
6
7
8
9
10
11
12
13
14#ifndef LLVM_CLANG_FORMAT_FORMAT_H
15#define LLVM_CLANG_FORMAT_FORMAT_H
16
20#include "llvm/ADT/ArrayRef.h"
21#include "llvm/Support/Regex.h"
22#include "llvm/Support/SourceMgr.h"
23#include
24#include <system_error>
25
26namespace llvm {
27namespace vfs {
28class FileSystem;
29}
30}
31
34
46public:
47 const char *name() const noexcept override;
48 std::string message(int EV) const override;
49};
52
53
54
55struct FormatStyle {
56
57
58
59 bool InheritsParentConfig;
60
61
62
63 int AccessModifierOffset;
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86 bool AlignAfterOpenBracket;
87
88
89 enum ArrayInitializerAlignmentStyle : int8_t {
90
91
92
93
94
95
96
97
98
99 AIAS_Left,
100
101
102
103
104
105
106
107
108
109 AIAS_Right,
110
111 AIAS_None
112 };
113
114
115
116
117
118
119
120
121
122 ArrayInitializerAlignmentStyle AlignArrayOfStructures;
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144 struct AlignConsecutiveStyle {
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165 bool Enabled;
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182 bool AcrossEmptyLines;
183
184
185
186
187
188
189
190
191
192
193
194
195 bool AcrossComments;
196
197
198
199
200
201
202
203
204
205
206
207 bool AlignCompound;
208
209
210
211
212
213
214
215
216
217
218
219
220
221 bool AlignFunctionDeclarations;
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237 bool AlignFunctionPointers;
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256 bool PadOperators;
257 bool operator==(const AlignConsecutiveStyle &R) const {
258 return Enabled == R.Enabled && AcrossEmptyLines == R.AcrossEmptyLines &&
259 AcrossComments == R.AcrossComments &&
260 AlignCompound == R.AlignCompound &&
261 AlignFunctionDeclarations == R.AlignFunctionDeclarations &&
262 AlignFunctionPointers == R.AlignFunctionPointers &&
263 PadOperators == R.PadOperators;
264 }
265 bool operator!=(const AlignConsecutiveStyle &R) const {
266 return !(*this == R);
267 }
268 };
269
270
271
272
273
274
275
276
277
278
279
280
281 AlignConsecutiveStyle AlignConsecutiveMacros;
282
283
284
285
286
287
288
289
290
291 AlignConsecutiveStyle AlignConsecutiveAssignments;
292
293
294
295
296
297
298
299
300
301
302 AlignConsecutiveStyle AlignConsecutiveBitFields;
303
304
305
306
307
308
309
310
311
312
313 AlignConsecutiveStyle AlignConsecutiveDeclarations;
314
315
316
317 struct ShortCaseStatementsAlignmentStyle {
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334 bool Enabled;
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353 bool AcrossEmptyLines;
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372 bool AcrossComments;
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389 bool AlignCaseArrows;
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407 bool AlignCaseColons;
408 bool operator==(const ShortCaseStatementsAlignmentStyle &R) const {
409 return Enabled == R.Enabled && AcrossEmptyLines == R.AcrossEmptyLines &&
410 AcrossComments == R.AcrossComments &&
411 AlignCaseArrows == R.AlignCaseArrows &&
412 AlignCaseColons == R.AlignCaseColons;
413 }
414 };
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429 ShortCaseStatementsAlignmentStyle AlignConsecutiveShortCaseStatements;
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444 AlignConsecutiveStyle AlignConsecutiveTableGenBreakingDAGArgColons;
445
446
447
448
449
450
451
452
453
454 AlignConsecutiveStyle AlignConsecutiveTableGenCondOperatorColons;
455
456
457
458
459
460
461
462
463
464 AlignConsecutiveStyle AlignConsecutiveTableGenDefinitionColons;
465
466
467 enum EscapedNewlineAlignmentStyle : int8_t {
468
469
470
471
472
473
474
475 ENAS_DontAlign,
476
477
478
479
480
481
482
483 ENAS_Left,
484
485
486
487
488
489
490
491
492 ENAS_LeftWithLastLine,
493
494
495
496
497
498
499
500 ENAS_Right,
501 };
502
503
504
505 EscapedNewlineAlignmentStyle AlignEscapedNewlines;
506
507
508 enum OperandAlignmentStyle : int8_t {
509
510
511
512 OAS_DontAlign,
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528 OAS_Align,
529
530
531
532
533
534
535
536
537
538 OAS_AlignAfterOperator,
539 };
540
541
542
543
544 OperandAlignmentStyle AlignOperands;
545
546
547 enum TrailingCommentsAlignmentKinds : int8_t {
548
549
550
551
552
553
554
555
556 TCAS_Leave,
557
558
559
560
561
562
563
564
565 TCAS_Always,
566
567
568
569
570
571
572
573
574 TCAS_Never,
575 };
576
577
578 struct TrailingCommentsAlignmentStyle {
579
580 TrailingCommentsAlignmentKinds Kind;
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603 unsigned OverEmptyLines;
604
605
606
607
608
609
610
611
612 bool AlignPPAndNotPP;
613
614 bool operator==(const TrailingCommentsAlignmentStyle &R) const {
615 return Kind == R.Kind && OverEmptyLines == R.OverEmptyLines &&
616 AlignPPAndNotPP == R.AlignPPAndNotPP;
617 }
618 bool operator!=(const TrailingCommentsAlignmentStyle &R) const {
619 return !(*this == R);
620 }
621 };
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641 TrailingCommentsAlignmentStyle AlignTrailingComments;
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658 bool AllowAllArgumentsOnNextLine;
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681 bool AllowAllParametersOfDeclarationOnNextLine;
682
683
684 enum BreakBeforeNoexceptSpecifierStyle : int8_t {
685
686
687
688
689
690
691
692
693
694 BBNSS_Never,
695
696
697
698
699
700
701
702
703
704
705 BBNSS_OnlyWithParen,
706
707
708
709
710
711
712
713
714
715
716
717 BBNSS_Always,
718 };
719
720
721
722 BreakBeforeNoexceptSpecifierStyle AllowBreakBeforeNoexceptSpecifier;
723
724
725
726
727
728 bool AllowBreakBeforeQtProperty;
729
730
731
732 enum ShortBlockStyle : int8_t {
733
734
735
736
737
738
739
740
741 SBS_Never,
742
743
744
745
746
747
748
749 SBS_Empty,
750
751
752
753
754
755 SBS_Always,
756 };
757
758
759
760
761 ShortBlockStyle AllowShortBlocksOnASingleLine;
762
763
764
765
766
767
768
769
770
771
772
773
774 bool AllowShortCaseExpressionOnASingleLine;
775
776
777
778
779
780
781
782
783
784
785
786
787
788 bool AllowShortCaseLabelsOnASingleLine;
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807 bool AllowShortCompoundRequirementOnASingleLine;
808
809
810
811
812
813
814
815
816
817
818
819
820
821 bool AllowShortEnumsOnASingleLine;
822
823
824
825 enum ShortFunctionStyle : int8_t {
826
827 SFS_None,
828
829
830
831
832
833
834
835
836
837
838
839
840
841 SFS_InlineOnly,
842
843
844
845
846
847
848
849 SFS_Empty,
850
851
852
853
854
855
856
857
858
859
860 SFS_Inline,
861
862
863
864
865
866
867
868 SFS_All,
869 };
870
871
872
873
874 ShortFunctionStyle AllowShortFunctionsOnASingleLine;
875
876
877 enum ShortIfStyle : int8_t {
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894 SIS_Never,
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910 SIS_WithoutElse,
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926 SIS_OnlyFirstIf,
927
928
929
930
931
932
933
934
935
936
937
938
939
940 SIS_AllIfsAndElse,
941 };
942
943
944
945 ShortIfStyle AllowShortIfStatementsOnASingleLine;
946
947
948
949 enum ShortLambdaStyle : int8_t {
950
951 SLS_None,
952
953
954
955
956
957
958
959 SLS_Empty,
960
961
962
963
964
965
966
967 SLS_Inline,
968
969
970
971
972
973 SLS_All,
974 };
975
976
977
978
979 ShortLambdaStyle AllowShortLambdasOnASingleLine;
980
981
982
983
984 bool AllowShortLoopsOnASingleLine;
985
986
987
988 bool AllowShortNamespacesOnASingleLine;
989
990
991
992 enum DefinitionReturnTypeBreakingStyle : int8_t {
993
994
995 DRTBS_None,
996
997 DRTBS_All,
998
999 DRTBS_TopLevel,
1000 };
1001
1002
1003
1004 enum ReturnTypeBreakingStyle : int8_t {
1005
1006 RTBS_None,
1007
1008
1009
1010
1011
1012
1013
1014
1015
1016
1017 RTBS_Automatic,
1018
1019
1020
1021
1022
1023
1024
1025
1026
1027
1028
1029 RTBS_ExceptShortType,
1030
1031
1032
1033
1034
1035
1036
1037
1038
1039
1040
1041
1042
1043
1044
1045
1046
1047 RTBS_All,
1048
1049
1050
1051
1052
1053
1054
1055
1056
1057
1058
1059
1060
1061
1062 RTBS_TopLevel,
1063
1064
1065
1066
1067
1068
1069
1070
1071
1072
1073
1074
1075
1076
1077
1078
1079 RTBS_AllDefinitions,
1080
1081
1082
1083
1084
1085
1086
1087
1088
1089
1090
1091
1092
1093 RTBS_TopLevelDefinitions,
1094 };
1095
1096
1097
1098
1099 DefinitionReturnTypeBreakingStyle AlwaysBreakAfterDefinitionReturnType;
1100
1101
1102
1103
1104
1105
1106
1107
1108
1109
1110
1111
1112
1113
1114
1115
1116
1117
1118
1119 bool AlwaysBreakBeforeMultilineStrings;
1120
1121
1122 enum BreakTemplateDeclarationsStyle : int8_t {
1123
1124
1125
1126
1127
1128
1129
1130
1131
1132 BTDS_Leave,
1133
1134
1135
1136
1137
1138
1139
1140
1141
1142 BTDS_No,
1143
1144
1145
1146
1147
1148
1149
1150
1151
1152
1153 BTDS_MultiLine,
1154
1155
1156
1157
1158
1159
1160
1161
1162
1163
1164 BTDS_Yes
1165 };
1166
1167
1168
1169
1170
1171
1172
1173
1174
1175
1176
1177
1178
1179
1180
1181
1182
1183
1184
1185
1186
1187
1188
1189 std::vectorstd::string AttributeMacros;
1190
1191
1192
1193
1194
1195
1196
1197
1198
1199
1200
1201
1202
1203
1204
1205
1206
1207
1208 bool BinPackArguments;
1209
1210
1211
1212
1213
1214
1215
1216
1217
1218
1219
1220
1221
1222
1223
1224 bool BinPackLongBracedList;
1225
1226
1227 enum BinPackParametersStyle : int8_t {
1228
1229
1230
1231
1232
1233 BPPS_BinPack,
1234
1235
1236
1237
1238
1239
1240
1241
1242
1243 BPPS_OnePerLine,
1244
1245
1246
1247
1248
1249
1250 BPPS_AlwaysOnePerLine,
1251 };
1252
1253
1254
1255 BinPackParametersStyle BinPackParameters;
1256
1257
1258 enum BitFieldColonSpacingStyle : int8_t {
1259
1260
1261
1262
1263 BFCS_Both,
1264
1265
1266
1267
1268
1269 BFCS_None,
1270
1271
1272
1273
1274 BFCS_Before,
1275
1276
1277
1278
1279
1280 BFCS_After
1281 };
1282
1283
1284 BitFieldColonSpacingStyle BitFieldColonSpacing;
1285
1286
1287
1288
1289
1290
1291
1292
1293
1294
1295
1296
1297
1298
1299
1300
1301
1302
1303
1304
1305
1306
1307
1308
1309
1310
1311
1312
1313
1314
1315
1316
1317 int BracedInitializerIndentWidth;
1318
1319
1320 enum BraceWrappingAfterControlStatementStyle : int8_t {
1321
1322
1323
1324
1325
1326
1327
1328
1329 BWACS_Never,
1330
1331
1332
1333
1334
1335
1336
1337
1338
1339
1340 BWACS_MultiLine,
1341
1342
1343
1344
1345
1346
1347
1348
1349
1350 BWACS_Always
1351 };
1352
1353
1354
1355
1356
1357
1358
1359
1360 struct BraceWrappingFlags {
1361
1362
1363
1364
1365
1366
1367
1368
1369
1370
1371
1372
1373
1374
1375
1376 bool AfterCaseLabel;
1377
1378
1379
1380
1381
1382
1383
1384
1385
1386 bool AfterClass;
1387
1388
1389 BraceWrappingAfterControlStatementStyle AfterControlStatement;
1390
1391
1392
1393
1394
1395
1396
1397
1398
1399
1400
1401 bool AfterEnum;
1402
1403
1404
1405
1406
1407
1408
1409
1410
1411
1412
1413
1414
1415
1416
1417 bool AfterFunction;
1418
1419
1420
1421
1422
1423
1424
1425
1426
1427
1428
1429
1430
1431
1432
1433 bool AfterNamespace;
1434
1435
1436
1437
1438
1439 bool AfterObjCDeclaration;
1440
1441
1442
1443
1444
1445
1446
1447
1448
1449
1450
1451
1452
1453 bool AfterStruct;
1454
1455
1456
1457
1458
1459
1460
1461
1462
1463
1464
1465
1466
1467 bool AfterUnion;
1468
1469
1470
1471
1472
1473
1474
1475
1476
1477
1478
1479
1480
1481 bool AfterExternBlock;
1482
1483
1484
1485
1486
1487
1488
1489
1490
1491
1492
1493
1494
1495
1496
1497 bool BeforeCatch;
1498
1499
1500
1501
1502
1503
1504
1505
1506
1507
1508
1509
1510
1511 bool BeforeElse;
1512
1513
1514
1515
1516
1517
1518
1519
1520
1521
1522
1523
1524
1525
1526
1527
1528 bool BeforeLambdaBody;
1529
1530
1531
1532
1533
1534
1535
1536
1537
1538
1539
1540
1541
1542 bool BeforeWhile;
1543
1544 bool IndentBraces;
1545
1546
1547
1548
1549
1550
1551
1552
1553
1554
1555
1556
1557
1558 bool SplitEmptyFunction;
1559
1560
1561
1562
1563
1564
1565
1566
1567
1568
1569
1570 bool SplitEmptyRecord;
1571
1572
1573
1574
1575
1576
1577
1578
1579
1580
1581
1582 bool SplitEmptyNamespace;
1583 };
1584
1585
1586
1587
1588
1589
1590
1591
1592
1593
1594
1595
1596
1597
1598 BraceWrappingFlags BraceWrapping;
1599
1600
1601
1602
1603
1604
1605
1606
1607
1608
1609
1610
1611 bool BreakAdjacentStringLiterals;
1612
1613
1614 enum AttributeBreakingStyle : int8_t {
1615
1616
1617
1618
1619
1620
1621
1622
1623
1624
1625
1626
1627
1628
1629
1630
1631
1632
1633
1634
1635
1636
1637
1638
1639
1640
1641
1642
1643 ABS_Always,
1644
1645
1646
1647
1648
1649
1650
1651
1652
1653
1654
1655
1656
1657
1658
1659
1660
1661
1662
1663
1664
1665
1666
1667
1668 ABS_Leave,
1669
1670
1671
1672
1673
1674
1675
1676
1677
1678
1679
1680
1681
1682
1683
1684
1685
1686
1687
1688
1689
1690 ABS_Never,
1691 };
1692
1693
1694
1695
1696
1697
1698 AttributeBreakingStyle BreakAfterAttributes;
1699
1700
1701
1702
1703
1704
1705
1706
1707
1708
1709 bool BreakAfterOpenBracketBracedList;
1710
1711
1712
1713
1714
1715
1716
1717
1718
1719 bool BreakAfterOpenBracketFunction;
1720
1721
1722
1723
1724
1725
1726
1727
1728
1729 bool BreakAfterOpenBracketIf;
1730
1731
1732
1733
1734
1735
1736
1737
1738
1739 bool BreakAfterOpenBracketLoop;
1740
1741
1742
1743
1744
1745
1746
1747
1748
1749 bool BreakAfterOpenBracketSwitch;
1750
1751
1752
1753 ReturnTypeBreakingStyle BreakAfterReturnType;
1754
1755
1756
1757
1758
1759
1760
1761
1762
1763
1764
1765
1766
1767
1768
1769
1770
1771
1772 bool BreakArrays;
1773
1774
1775
1776 enum BinPackStyle : int8_t {
1777
1778 BPS_Auto,
1779
1780 BPS_Always,
1781
1782 BPS_Never,
1783 };
1784
1785
1786 enum BinaryOperatorStyle : int8_t {
1787
1788
1789
1790
1791
1792
1793
1794
1795
1796
1797
1798 BOS_None,
1799
1800
1801
1802
1803
1804
1805
1806
1807
1808
1809
1810 BOS_NonAssignment,
1811
1812
1813
1814
1815
1816
1817
1818
1819
1820
1821
1822 BOS_All,
1823 };
1824
1825
1826
1827 BinaryOperatorStyle BreakBeforeBinaryOperators;
1828
1829
1830 enum BraceBreakingStyle : int8_t {
1831
1832
1833
1834
1835
1836
1837
1838
1839
1840
1841
1842
1843
1844
1845
1846
1847
1848
1849
1850
1851
1852
1853
1854
1855
1856
1857
1858
1859
1860
1861
1862
1863
1864
1865
1866
1867
1868
1869
1870
1871
1872
1873
1874
1875 BS_Attach,
1876
1877
1878
1879
1880
1881
1882
1883
1884
1885
1886
1887
1888
1889
1890
1891
1892
1893
1894
1895
1896
1897
1898
1899
1900
1901
1902
1903
1904
1905
1906
1907
1908
1909
1910
1911
1912
1913
1914
1915
1916
1917
1918
1919
1920
1921
1922
1923
1924
1925 BS_Linux,
1926
1927
1928
1929
1930
1931
1932
1933
1934
1935
1936
1937
1938
1939
1940
1941
1942
1943
1944
1945
1946
1947
1948
1949
1950
1951
1952
1953
1954
1955
1956
1957
1958
1959
1960
1961
1962
1963
1964
1965
1966
1967
1968
1969
1970
1971
1972
1973
1974
1975 BS_Mozilla,
1976
1977
1978
1979
1980
1981
1982
1983
1984
1985
1986
1987
1988
1989
1990
1991
1992
1993
1994
1995
1996
1997
1998
1999
2000
2001
2002
2003
2004
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
2025 BS_Stroustrup,
2026
2027
2028
2029
2030
2031
2032
2033
2034
2035
2036
2037
2038
2039
2040
2041
2042
2043
2044
2045
2046
2047
2048
2049
2050
2051
2052
2053
2054
2055
2056
2057
2058
2059
2060
2061
2062
2063
2064
2065
2066
2067
2068
2069
2070
2071
2072
2073
2074
2075
2076
2077
2078
2079
2080
2081
2082
2083
2084
2085 BS_Allman,
2086
2087
2088
2089
2090
2091
2092
2093
2094
2095
2096
2097
2098
2099
2100
2101
2102
2103
2104
2105
2106
2107
2108
2109
2110
2111
2112
2113
2114
2115
2116
2117
2118
2119
2120
2121
2122
2123
2124
2125
2126
2127
2128
2129
2130
2131
2132
2133
2134
2135
2136
2137
2138
2139
2140
2141
2142
2143
2144
2145 BS_Whitesmiths,
2146
2147
2148
2149
2150
2151
2152
2153
2154
2155
2156
2157
2158
2159
2160
2161
2162
2163
2164
2165
2166
2167
2168
2169
2170
2171
2172
2173
2174
2175
2176
2177
2178
2179
2180
2181
2182
2183
2184
2185
2186
2187
2188
2189
2190
2191
2192
2193
2194
2195
2196
2197
2198
2199
2200
2201
2202
2203
2204
2205
2206
2207
2208 BS_GNU,
2209
2210
2211
2212
2213
2214
2215
2216
2217
2218
2219
2220
2221
2222
2223
2224
2225
2226
2227
2228
2229
2230
2231
2232
2233
2234
2235
2236
2237
2238
2239
2240
2241
2242
2243
2244
2245
2246
2247
2248
2249
2250
2251
2252
2253
2254
2255 BS_WebKit,
2256
2257 BS_Custom
2258 };
2259
2260
2261
2262 BraceBreakingStyle BreakBeforeBraces;
2263
2264
2265
2266
2267
2268
2269
2270
2271
2272
2273
2274
2275 bool BreakBeforeCloseBracketBracedList;
2276
2277
2278
2279
2280
2281
2282
2283
2284
2285
2286 bool BreakBeforeCloseBracketFunction;
2287
2288
2289
2290
2291
2292
2293
2294
2295
2296
2297
2298
2299 bool BreakBeforeCloseBracketIf;
2300
2301
2302
2303
2304
2305
2306
2307
2308
2309
2310
2311
2312 bool BreakBeforeCloseBracketLoop;
2313
2314
2315
2316
2317
2318
2319
2320
2321
2322
2323
2324
2325 bool BreakBeforeCloseBracketSwitch;
2326
2327
2328 enum BreakBeforeConceptDeclarationsStyle : int8_t {
2329
2330
2331
2332
2333 BBCDS_Never,
2334
2335
2336
2337 BBCDS_Allowed,
2338
2339
2340
2341
2342
2343
2344 BBCDS_Always,
2345 };
2346
2347
2348
2349 BreakBeforeConceptDeclarationsStyle BreakBeforeConceptDeclarations;
2350
2351
2352 enum BreakBeforeInlineASMColonStyle : int8_t {
2353
2354
2355
2356
2357 BBIAS_Never,
2358
2359
2360
2361
2362
2363
2364
2365
2366 BBIAS_OnlyMultiline,
2367
2368
2369
2370
2371
2372
2373 BBIAS_Always,
2374 };
2375
2376
2377
2378 BreakBeforeInlineASMColonStyle BreakBeforeInlineASMColon;
2379
2380
2381
2382
2383
2384
2385
2386
2387
2388
2389
2390
2391
2392
2393
2394
2395
2396
2397
2398
2399
2400
2401
2402
2403
2404
2405 bool BreakBeforeTemplateCloser;
2406
2407
2408
2409
2410
2411
2412
2413
2414
2415
2416
2417
2418
2419
2420 bool BreakBeforeTernaryOperators;
2421
2422
2423 enum BreakBinaryOperationsStyle : int8_t {
2424
2425
2426
2427
2428
2429 BBO_Never,
2430
2431
2432
2433
2434
2435
2436
2437
2438
2439
2440 BBO_OnePerLine,
2441
2442
2443
2444
2445
2446
2447
2448
2449
2450 BBO_RespectPrecedence
2451 };
2452
2453
2454
2455 BreakBinaryOperationsStyle BreakBinaryOperations;
2456
2457
2458 enum BreakConstructorInitializersStyle : int8_t {
2459
2460
2461
2462
2463
2464
2465 BCIS_BeforeColon,
2466
2467
2468
2469
2470
2471
2472
2473 BCIS_BeforeComma,
2474
2475
2476
2477
2478
2479
2480 BCIS_AfterColon
2481 };
2482
2483
2484
2485 BreakConstructorInitializersStyle BreakConstructorInitializers;
2486
2487
2488
2489
2490
2491
2492
2493
2494
2495
2496
2497
2498
2499 bool BreakFunctionDefinitionParameters;
2500
2501
2502
2503
2504
2505
2506
2507
2508
2509 bool BreakAfterJavaFieldAnnotations;
2510
2511
2512
2513
2514
2515
2516
2517
2518
2519
2520
2521
2522
2523
2524
2525
2526
2527
2528
2529
2530
2531
2532
2533
2534
2535
2536
2537
2538
2539
2540
2541
2542
2543
2544
2545
2546
2547
2548
2549
2550
2551
2552 bool BreakStringLiterals;
2553
2554
2555
2556
2557
2558
2559
2560 unsigned ColumnLimit;
2561
2562
2563
2564
2565
2566
2567
2568
2569
2570 std::string CommentPragmas;
2571
2572
2573 enum BreakInheritanceListStyle : int8_t {
2574
2575
2576
2577
2578
2579
2580
2581 BILS_BeforeColon,
2582
2583
2584
2585
2586
2587
2588
2589
2590 BILS_BeforeComma,
2591
2592
2593
2594
2595
2596
2597
2598 BILS_AfterColon,
2599
2600
2601
2602
2603
2604
2605 BILS_AfterComma,
2606 };
2607
2608
2609
2610 BreakInheritanceListStyle BreakInheritanceList;
2611
2612
2613
2614 BreakTemplateDeclarationsStyle BreakTemplateDeclarations;
2615
2616
2617
2618
2619
2620
2621
2622
2623
2624
2625
2626
2627
2628
2629
2630
2631
2632
2633
2634
2635
2636
2637
2638 bool CompactNamespaces;
2639
2640
2641
2642
2643
2644
2645
2646
2647
2648 unsigned ConstructorInitializerIndentWidth;
2649
2650
2651
2652
2653
2654
2655
2656
2657
2658
2659 unsigned ContinuationIndentWidth;
2660
2661
2662 enum BracedListStyle : int8_t {
2663
2664
2665
2666
2667
2668
2669
2670
2671
2672
2673
2674
2675
2676
2677
2678 BLS_Block,
2679
2680
2681
2682
2683
2684
2685
2686
2687
2688
2689
2690
2691
2692
2693
2694
2695
2696
2697
2698 BLS_FunctionCall,
2699
2700
2701
2702
2703
2704
2705
2706
2707
2708
2709
2710
2711
2712
2713
2714
2715
2716 BLS_AlignFirstComment,
2717 };
2718
2719
2720
2721 BracedListStyle Cpp11BracedListStyle;
2722
2723
2724
2725
2726
2727
2728
2729
2730
2731
2732
2733
2734 bool DerivePointerAlignment;
2735
2736
2737
2738 bool DisableFormat;
2739
2740
2741
2742
2743 enum EmptyLineAfterAccessModifierStyle : int8_t {
2744
2745
2746
2747
2748
2749
2750
2751
2752
2753
2754
2755
2756
2757
2758 ELAAMS_Never,
2759
2760
2761 ELAAMS_Leave,
2762
2763
2764
2765
2766
2767
2768
2769
2770
2771
2772
2773
2774
2775
2776
2777
2778
2779
2780
2781
2782 ELAAMS_Always,
2783 };
2784
2785
2786
2787
2788
2789 EmptyLineAfterAccessModifierStyle EmptyLineAfterAccessModifier;
2790
2791
2792 enum EmptyLineBeforeAccessModifierStyle : int8_t {
2793
2794
2795
2796
2797
2798
2799
2800
2801
2802
2803
2804
2805
2806
2807 ELBAMS_Never,
2808
2809 ELBAMS_Leave,
2810
2811
2812
2813
2814
2815
2816
2817
2818
2819
2820
2821
2822
2823
2824
2825
2826
2827 ELBAMS_LogicalBlock,
2828
2829
2830
2831
2832
2833
2834
2835
2836
2837
2838
2839
2840
2841
2842
2843
2844
2845
2846
2847 ELBAMS_Always,
2848 };
2849
2850
2851
2852 EmptyLineBeforeAccessModifierStyle EmptyLineBeforeAccessModifier;
2853
2854
2855 enum EnumTrailingCommaStyle : int8_t {
2856
2857
2858
2859
2860
2861 ETC_Leave,
2862
2863
2864
2865
2866
2867 ETC_Insert,
2868
2869
2870
2871
2872
2873 ETC_Remove,
2874 };
2875
2876
2877
2878
2879
2880
2881
2882
2883
2884
2885 EnumTrailingCommaStyle EnumTrailingComma;
2886
2887
2888
2889
2890
2891
2892
2893
2894
2895
2896
2897
2898
2899
2900 bool ExperimentalAutoDetectBinPacking;
2901
2902
2903
2904
2905
2906
2907
2908
2909
2910
2911
2912
2913
2914
2915
2916 bool FixNamespaceComments;
2917
2918
2919
2920
2921
2922
2923
2924
2925
2926
2927
2928
2929
2930
2931
2932
2933
2934 std::vectorstd::string ForEachMacros;
2935
2936 tooling::IncludeStyle IncludeStyle;
2937
2938
2939
2940
2941
2942
2943
2944
2945
2946
2947
2948
2949
2950
2951
2952
2953
2954
2955
2956
2957 std::vectorstd::string IfMacros;
2958
2959
2960
2961
2962
2963
2964
2965
2966
2967
2968
2969
2970
2971
2972
2973
2974
2975
2976
2977
2978
2979
2980
2981
2982
2983
2984 bool IndentAccessModifiers;
2985
2986
2987
2988
2989
2990
2991
2992
2993
2994
2995
2996
2997
2998
2999
3000
3001
3002
3003
3004
3005
3006
3007 bool IndentCaseBlocks;
3008
3009
3010
3011
3012
3013
3014
3015
3016
3017
3018
3019
3020
3021
3022
3023
3024
3025
3026 bool IndentCaseLabels;
3027
3028
3029
3030
3031
3032
3033
3034
3035
3036
3037
3038
3039 bool IndentExportBlock;
3040
3041
3042 enum IndentExternBlockStyle : int8_t {
3043
3044
3045
3046
3047
3048
3049
3050
3051
3052
3053
3054
3055
3056
3057
3058
3059
3060 IEBS_AfterExternBlock,
3061
3062
3063
3064
3065
3066
3067 IEBS_NoIndent,
3068
3069
3070
3071
3072
3073
3074 IEBS_Indent,
3075 };
3076
3077
3078
3079 IndentExternBlockStyle IndentExternBlock;
3080
3081
3082
3083
3084
3085
3086
3087
3088
3089
3090
3091
3092
3093
3094
3095
3096 bool IndentGotoLabels;
3097
3098
3099 enum PPDirectiveIndentStyle : int8_t {
3100
3101
3102
3103
3104
3105
3106
3107
3108 PPDIS_None,
3109
3110
3111
3112
3113
3114
3115
3116
3117 PPDIS_AfterHash,
3118
3119
3120
3121
3122
3123
3124
3125
3126 PPDIS_BeforeHash,
3127
3128
3129
3130
3131
3132
3133
3134
3135
3136
3137
3138 PPDIS_Leave
3139 };
3140
3141
3142
3143 PPDirectiveIndentStyle IndentPPDirectives;
3144
3145
3146
3147
3148
3149
3150
3151
3152
3153
3154
3155
3156
3157
3158
3159
3160
3161
3162
3163
3164
3165
3166 bool IndentRequiresClause;
3167
3168
3169
3170
3171
3172
3173
3174
3175
3176
3177
3178
3179
3180 unsigned IndentWidth;
3181
3182
3183
3184
3185
3186
3187
3188
3189
3190
3191
3192
3193
3194 bool IndentWrappedFunctionNames;
3195
3196
3197
3198
3199
3200
3201
3202
3203
3204
3205
3206
3207
3208
3209
3210
3211
3212
3213
3214
3215
3216
3217
3218
3219
3220
3221
3222
3223
3224
3225
3226 bool InsertBraces;
3227
3228
3229
3230 bool InsertNewlineAtEOF;
3231
3232
3233 enum TrailingCommaStyle : int8_t {
3234
3235 TCS_None,
3236
3237
3238
3239
3240
3241 TCS_Wrapped,
3242 };
3243
3244
3245
3246
3247
3248
3249
3250
3251
3252
3253
3254
3255
3256
3257
3258
3259
3260 TrailingCommaStyle InsertTrailingCommas;
3261
3262
3263
3264
3265
3266
3267
3268
3269
3270
3271
3272
3273
3274
3275
3276
3277
3278
3279
3280
3281
3282
3283
3284
3285
3286
3287
3288
3289
3290
3291
3292 struct IntegerLiteralSeparatorStyle {
3293
3294
3295
3296
3297
3298
3299
3301
3302
3303
3304
3305
3306
3307
3308 int8_t BinaryMinDigitsInsert;
3309
3310
3311
3312
3313
3314
3315
3316
3317
3318
3319
3320 int8_t BinaryMaxDigitsRemove;
3321
3322
3323
3324
3325
3326
3328
3329
3330
3331
3332
3333
3334
3335 int8_t DecimalMinDigitsInsert;
3336
3337
3338
3339
3340
3341
3342
3343
3344
3345
3346
3347 int8_t DecimalMaxDigitsRemove;
3348
3349
3350
3351
3352
3353
3354 int8_t Hex;
3355
3356
3357
3358
3359
3360
3361
3362
3363 int8_t HexMinDigitsInsert;
3364
3365
3366
3367
3368
3369
3370
3371
3372
3373
3374
3375
3376 int8_t HexMaxDigitsRemove;
3377 bool operator==(const IntegerLiteralSeparatorStyle &R) const {
3378 return Binary == R.Binary &&
3379 BinaryMinDigitsInsert == R.BinaryMinDigitsInsert &&
3380 BinaryMaxDigitsRemove == R.BinaryMaxDigitsRemove &&
3382 DecimalMinDigitsInsert == R.DecimalMinDigitsInsert &&
3383 DecimalMaxDigitsRemove == R.DecimalMaxDigitsRemove &&
3384 Hex == R.Hex && HexMinDigitsInsert == R.HexMinDigitsInsert &&
3385 HexMaxDigitsRemove == R.HexMaxDigitsRemove;
3386 }
3387 bool operator!=(const IntegerLiteralSeparatorStyle &R) const {
3389 }
3390 };
3391
3392
3393
3394
3396
3397
3398
3399
3400
3401
3402
3403
3404
3405
3406
3407
3408
3409
3410
3411
3412
3413
3414
3415
3416
3417
3418
3419
3420
3421
3422
3423
3424
3425
3426
3427
3428
3430
3431
3432
3434
3435
3436
3437
3438
3440
3441
3442
3443
3444
3446
3447
3448
3449
3450
3452 };
3453
3454
3455
3457
3458
3459
3460
3461
3462
3463
3464
3465
3466
3467
3468
3469
3470
3471
3473
3474
3475
3476
3477
3478
3479
3480
3481
3482
3483
3484
3485
3487
3489
3490
3491
3492
3493
3494
3495
3496
3498
3505 };
3506
3507
3508
3510
3511
3512
3513
3514
3515
3516
3517
3518
3519
3520
3521
3522
3523
3524
3526
3527
3529
3530
3531
3532
3533
3534
3535
3537
3538
3539
3540
3541
3542
3543
3544
3545
3546
3547
3548
3549
3551 };
3552
3553
3554
3555
3556
3557
3558
3560
3561
3562
3563
3564
3565
3567
3569
3571
3573
3575
3577
3579
3581
3583
3584
3586
3588
3589
3591
3592
3593
3595 };
3607
3608
3609
3610
3611
3612
3613
3614
3616
3617
3619
3621
3623
3625
3627 };
3628
3629
3630
3632
3633
3634
3635
3636
3637
3638
3639
3640
3641
3642
3643
3644
3645
3646
3647
3648
3649
3650
3651
3652
3653
3654
3655
3656
3657
3658
3659
3661
3662
3663
3665
3666
3667
3668
3669
3670
3671
3672
3673
3674
3675
3676
3677
3678
3679
3680
3681
3682
3683
3684
3685
3686
3687
3688
3689
3690
3691
3692
3693
3694
3695
3696
3697
3698
3699
3700
3701
3702
3703
3705
3706
3707
3708
3710
3711
3712
3713
3714
3715
3716
3717
3718
3719
3720
3721
3722
3724
3725
3727
3728
3729
3730
3731
3732
3733
3734
3735
3737
3738
3739
3740
3741
3742
3743
3744
3745
3747
3748
3749
3750
3751
3752
3753
3754
3755
3757 };
3758
3759
3760
3762
3763
3764
3765
3766
3767
3768
3769
3770
3771
3772
3773
3775
3776
3785
3786
3787
3788
3789
3790
3791
3792
3793
3794
3795
3796
3797
3799
3800
3801
3802
3803
3804
3806
3807
3808
3809
3810
3811
3813
3814
3815
3816
3817
3818
3820
3821
3822
3823
3824
3825
3826
3828
3833
3835 return !(*this == R);
3836 }
3837 };
3838
3839
3840
3842
3843
3844
3845
3846
3847
3848
3849
3850
3851
3852
3853
3854
3855
3856
3857
3858
3859
3860
3861
3862
3863
3864
3865
3866
3867
3868
3869
3870
3871
3872
3873
3875
3876
3877
3878
3879
3880
3881
3882
3883
3884
3886
3887
3888
3889
3890
3891
3892
3893
3894
3895
3896
3897
3898
3899
3900
3901
3902
3903
3904
3905
3906
3907
3908
3910
3911
3912
3913
3914
3915
3916
3917
3918
3919
3920
3921
3922
3923
3924
3925
3926
3927
3928
3929
3930
3931
3933
3934
3935
3936
3938
3939
3940
3941
3943
3944
3945
3946
3947
3948
3949
3950
3951
3952
3953
3954
3955
3956
3957
3958
3959
3960
3961
3962
3964
3965
3967
3968
3969
3970
3971
3972
3974
3975
3976
3977
3978
3979
3981
3982
3983
3984
3985
3986
3987
3988
3989
3990
3992
3993
3994
3995
3996
3997
3998
3999
4000
4001
4002
4003
4004
4006
4007
4008
4009
4010
4011
4012
4013
4014
4015
4016
4017
4018
4019
4021 };
4022
4023
4024
4026
4027
4028
4030
4031
4032
4034
4035
4036
4038
4039
4040
4042
4043
4044
4046
4047
4048
4050
4051
4052
4054
4055
4056
4058
4059
4060
4062
4063
4064
4066
4067
4068
4069
4071
4072
4073
4075
4076
4078
4079
4080
4081
4083
4084
4085
4086
4088
4089
4090
4091
4093 };
4094
4095
4096
4098
4099
4100
4101
4102
4103
4104
4105
4106
4107
4108
4109
4110
4111
4113
4114
4116
4117
4118
4119
4120
4121
4123
4124
4125
4126
4127
4129
4130
4131
4132
4133
4135
4136
4137
4138
4139
4140
4141
4142
4143
4144
4145
4147 };
4148
4149
4150
4151
4152
4153
4154
4155
4156
4157
4159
4160
4161
4162
4163
4164
4165
4166
4167
4168
4169
4170
4171
4172
4173
4174
4175
4176
4177
4178
4179
4180
4181
4182
4183
4185
4186
4188
4190
4192
4194
4196
4197
4198
4206 };
4207
4208
4209
4210
4211
4212
4213
4214
4215
4216
4217
4218
4219
4220
4221
4222
4223
4224
4225
4226
4227
4228
4229
4230
4231
4232
4233
4234
4235
4236
4237
4238
4239
4240
4241
4242
4243
4245
4246
4248
4250
4251
4252
4253
4255
4256
4257
4258
4260
4261
4262
4263
4265 };
4266
4267
4268
4270
4271
4272
4274
4275
4276
4277
4278
4279
4280
4282
4283
4284
4285
4286
4287
4288
4289
4291
4292
4293
4294
4295
4296
4297
4298
4299
4300
4302 };
4303
4304
4305
4306
4308
4309
4310
4311
4312
4313
4314
4315
4316
4317
4318
4319
4320
4321
4322
4323
4324
4325
4326
4327
4328
4329
4330
4331
4332
4333
4334
4335
4336
4337
4338
4339
4340
4341
4342
4343
4344
4345
4346
4347
4348
4349
4350
4351
4352
4353
4354
4355
4356
4357
4358
4359
4360
4362
4363
4364
4365
4366
4367
4368
4369
4370
4371
4372
4373
4374
4375
4376
4377
4378
4379
4380
4381
4382
4383
4385
4386
4388
4389
4390
4391
4392
4393
4395
4396
4397
4398
4399
4400
4402
4403
4404
4405
4406
4407
4408
4410 };
4411
4412
4413
4414
4415
4416
4417
4418
4419
4421
4422
4423
4424
4425
4426
4427
4428
4429
4430
4431
4432
4433
4434
4435
4436
4437
4439
4440
4441
4443
4444
4445
4446
4447
4448
4449
4450
4451
4452
4453
4454
4455
4456
4457
4458
4459
4460
4461
4462
4464
4465
4466
4467
4468
4469
4470
4471
4472
4473
4474
4475
4476
4477
4478
4479
4480
4482
4483
4484
4485
4486
4487
4488
4489
4490
4491
4492
4493
4494
4495
4496
4497
4499
4500
4501
4502
4503
4504
4505
4506
4507
4508
4509
4510
4511
4513
4514
4515
4516
4517
4518
4519
4520
4521
4522
4523
4524
4525
4526
4527
4528
4529
4530
4531
4532
4533
4534
4535
4537 };
4538
4539
4540
4542
4543
4545
4546
4547
4548
4549
4550
4551
4552
4553
4555
4556
4557
4558
4559
4560
4561
4563 };
4564
4565
4566
4568
4569
4578
4579
4580
4581
4582
4583
4584
4585
4586
4587
4588
4589
4590
4591
4592
4593
4594
4595
4596
4597
4598
4599
4600
4601
4602
4603
4604
4605
4606
4607
4608
4609
4610
4611
4612
4613
4614
4615
4616
4617
4618
4619
4620
4621
4622
4623
4624
4626
4627
4628
4629
4630
4631
4632
4633
4634
4635
4636
4637
4638
4639
4640
4641
4642
4643
4644
4645
4646
4648
4649
4650
4652
4653
4655
4656
4658
4659
4660
4661
4662
4663
4664
4665
4666
4667
4668
4670
4671
4672
4673
4674
4675
4676
4677
4684 return !(*this == R);
4685 }
4686 };
4687
4688
4689
4691
4692
4694
4695
4696
4697
4698
4699
4701
4702
4703
4704
4705
4706
4708 };
4709
4710
4711
4712
4713
4715
4716
4718
4719
4720
4721
4722
4723
4724
4725
4727
4728
4729
4730
4731
4732
4733
4734
4735
4736
4737
4739
4740
4741
4742
4743
4744
4745
4746
4747
4748
4749
4750
4751
4752
4754 };
4755
4756
4757
4759
4760
4761
4762
4763
4764
4765
4767
4768
4769
4770
4771
4772
4773
4775
4776
4777
4778
4779
4780
4781
4783
4784
4785
4786
4787
4788
4789
4791
4792
4794
4795
4796
4797
4798
4799
4801
4802
4803
4804
4805
4807
4808
4809
4810
4811
4813
4814
4815
4816
4817
4819 };
4820
4821
4822
4824
4825
4826
4827
4828
4829
4830
4831
4833
4834
4835
4836
4837
4838
4839
4840
4841
4843
4844
4845
4846
4847
4848
4849
4850
4851
4852
4853
4855
4856
4857
4858
4859
4860
4861
4862
4864
4865
4866
4867
4868
4869
4870
4872
4873
4874
4875
4876
4877
4878
4879
4880
4881
4883
4884
4886
4887
4888
4890
4891
4892
4893
4894
4895
4896
4897
4898
4900
4901
4902
4903
4904
4905
4906
4907
4908
4909
4910
4911
4913
4914
4915
4916
4917
4918
4919
4920
4921
4922
4924
4925
4926
4927
4928
4929
4930
4931
4932
4933
4934
4936
4937
4939 };
4940
4941
4942
4944
4945
4946
4947
4948
4949
4950
4951
4952
4954
4955
4956
4957
4958
4959
4961
4962
4963
4964
4965
4966
4968
4969
4970
4971
4972
4973
4975
4976
4977
4978
4979
4980
4982
4983
4984
4985
4986
4987
4989
4990
4991
4992
4993
4994
4996
4997
4998
4999
5000
5001
5002
5004
5005
5006
5007
5008
5009
5010
5012
5013
5014
5015
5016
5017
5018
5019
5021
5022
5023
5024
5025
5026
5027
5028
5029
5031
5032
5033
5034
5035
5036
5037
5039
5047
5052 Other.AfterFunctionDeclarationName &&
5061 }
5062 };
5063
5064
5065
5066
5067
5068
5069
5070
5071
5072
5073
5074
5075
5076
5078
5079
5080
5081
5082
5083
5084
5085
5086
5088
5089
5090
5091
5092
5093
5094
5095
5097
5098
5099
5100
5101
5102
5104
5105
5106
5107
5108
5109
5110
5112
5113
5114
5115
5116
5117
5118
5120
5121
5122
5123
5124
5125
5126
5128 };
5129
5130
5131
5132
5133
5134
5135
5137
5138
5139
5140
5141
5142
5143
5144
5145
5146
5147
5148
5149
5150
5151
5152
5153
5154
5155
5156
5157
5158
5159
5160
5161
5163
5164
5165
5167
5168
5169
5170
5171
5173
5174
5175
5176
5177
5179
5180
5182 };
5183
5184
5186
5187
5188
5189
5190
5191
5192
5193
5194
5195
5196
5197
5198
5199
5200
5201
5202
5204
5205
5206
5207
5208
5209
5210
5211
5218
5219
5220
5221
5222
5223
5224
5225
5226
5227
5228
5229
5230
5231
5232
5233
5234
5235
5236
5237
5238
5239
5240
5241
5242
5243
5244
5245
5246
5247
5248
5249
5250
5252
5253
5255
5256
5257
5258
5259
5260
5261
5262
5264
5265
5267 };
5268
5269
5270
5271
5272
5273
5274
5275
5276
5277
5278
5279
5281
5282
5283
5284
5285
5286
5287
5288
5289
5290
5292
5293
5294
5295
5296
5297
5298
5299
5300
5301
5303
5304
5305
5306
5307
5308
5309
5311
5312
5313
5314
5315
5316
5318
5319
5320
5321
5322
5323
5324
5325
5326
5327
5329
5330
5331
5332
5333
5335
5339
5347
5355 return !(*this == R);
5356 }
5357 };
5358
5359
5360
5361
5362
5363
5364
5365
5366
5367
5368
5369
5370
5371
5372
5374
5375
5376
5377
5378
5379
5380
5381
5382
5383
5385
5386
5387
5388
5389
5390
5391
5392
5393
5395
5396
5398
5400
5402
5404
5406
5407
5409
5411 };
5412
5413
5414
5415
5416
5417
5418
5420
5421
5422
5423
5424
5425
5426
5427
5428
5429
5430
5431
5432
5433
5434
5435
5437
5438
5439
5440
5441
5442
5443
5444
5445
5447
5448
5449
5450
5451
5452
5453
5454
5455
5456
5457
5458
5459
5460
5461
5462
5463
5464
5465
5466
5467
5468
5469
5470
5471
5473
5474
5476
5477
5478
5479
5481
5482
5483
5484
5485
5486
5488
5489
5490
5491
5492
5493
5494
5496 };
5497
5498
5499
5501
5502
5503
5505
5506
5507
5508
5509
5510
5511
5512
5514
5515
5516
5517
5518
5519
5520
5521
5522
5524
5525
5526
5527
5528
5529
5530
5531
5532
5533
5534
5535
5536
5537
5538
5539
5541
5542
5543
5544
5545
5546
5548
5550
5552
5553
5555
5556
5558
5559
5561 };
5562
5563
5564
5566
5567
5568
5569
5570
5571
5572
5573
5575
5576
5577
5578
5579
5580
5581
5582
5583
5584
5585
5586
5587
5589
5590
5591
5592
5593
5594
5595
5596
5597
5598
5599
5600
5601
5602
5603
5604
5606
5607
5609
5610
5611
5612
5613
5614
5615
5616
5618
5619
5620
5621
5622
5623
5624
5625
5626
5627
5628
5629
5631
5632
5634 };
5635
5636
5637
5639
5641 return AccessModifierOffset == R.AccessModifierOffset &&
5642 AlignAfterOpenBracket == R.AlignAfterOpenBracket &&
5643 AlignArrayOfStructures == R.AlignArrayOfStructures &&
5644 AlignConsecutiveAssignments == R.AlignConsecutiveAssignments &&
5645 AlignConsecutiveBitFields == R.AlignConsecutiveBitFields &&
5646 AlignConsecutiveDeclarations == R.AlignConsecutiveDeclarations &&
5647 AlignConsecutiveMacros == R.AlignConsecutiveMacros &&
5648 AlignConsecutiveShortCaseStatements ==
5649 R.AlignConsecutiveShortCaseStatements &&
5650 AlignConsecutiveTableGenBreakingDAGArgColons ==
5651 R.AlignConsecutiveTableGenBreakingDAGArgColons &&
5652 AlignConsecutiveTableGenCondOperatorColons ==
5653 R.AlignConsecutiveTableGenCondOperatorColons &&
5654 AlignConsecutiveTableGenDefinitionColons ==
5655 R.AlignConsecutiveTableGenDefinitionColons &&
5656 AlignEscapedNewlines == R.AlignEscapedNewlines &&
5657 AlignOperands == R.AlignOperands &&
5658 AlignTrailingComments == R.AlignTrailingComments &&
5659 AllowAllArgumentsOnNextLine == R.AllowAllArgumentsOnNextLine &&
5660 AllowAllParametersOfDeclarationOnNextLine ==
5661 R.AllowAllParametersOfDeclarationOnNextLine &&
5662 AllowBreakBeforeNoexceptSpecifier ==
5663 R.AllowBreakBeforeNoexceptSpecifier &&
5664 AllowBreakBeforeQtProperty == R.AllowBreakBeforeQtProperty &&
5665 AllowShortBlocksOnASingleLine == R.AllowShortBlocksOnASingleLine &&
5666 AllowShortCaseExpressionOnASingleLine ==
5667 R.AllowShortCaseExpressionOnASingleLine &&
5668 AllowShortCaseLabelsOnASingleLine ==
5669 R.AllowShortCaseLabelsOnASingleLine &&
5670 AllowShortCompoundRequirementOnASingleLine ==
5671 R.AllowShortCompoundRequirementOnASingleLine &&
5672 AllowShortEnumsOnASingleLine == R.AllowShortEnumsOnASingleLine &&
5673 AllowShortFunctionsOnASingleLine ==
5674 R.AllowShortFunctionsOnASingleLine &&
5675 AllowShortIfStatementsOnASingleLine ==
5676 R.AllowShortIfStatementsOnASingleLine &&
5677 AllowShortLambdasOnASingleLine == R.AllowShortLambdasOnASingleLine &&
5678 AllowShortLoopsOnASingleLine == R.AllowShortLoopsOnASingleLine &&
5679 AllowShortNamespacesOnASingleLine ==
5680 R.AllowShortNamespacesOnASingleLine &&
5681 AlwaysBreakBeforeMultilineStrings ==
5682 R.AlwaysBreakBeforeMultilineStrings &&
5683 AttributeMacros == R.AttributeMacros &&
5684 BinPackArguments == R.BinPackArguments &&
5685 BinPackLongBracedList == R.BinPackLongBracedList &&
5686 BinPackParameters == R.BinPackParameters &&
5687 BitFieldColonSpacing == R.BitFieldColonSpacing &&
5688 BracedInitializerIndentWidth == R.BracedInitializerIndentWidth &&
5689 BreakAdjacentStringLiterals == R.BreakAdjacentStringLiterals &&
5690 BreakAfterAttributes == R.BreakAfterAttributes &&
5691 BreakAfterJavaFieldAnnotations == R.BreakAfterJavaFieldAnnotations &&
5692 BreakAfterOpenBracketBracedList ==
5693 R.BreakAfterOpenBracketBracedList &&
5694 BreakAfterOpenBracketFunction == R.BreakAfterOpenBracketFunction &&
5695 BreakAfterOpenBracketIf == R.BreakAfterOpenBracketIf &&
5696 BreakAfterOpenBracketLoop == R.BreakAfterOpenBracketLoop &&
5697 BreakAfterOpenBracketSwitch == R.BreakAfterOpenBracketSwitch &&
5698 BreakAfterReturnType == R.BreakAfterReturnType &&
5699 BreakArrays == R.BreakArrays &&
5700 BreakBeforeBinaryOperators == R.BreakBeforeBinaryOperators &&
5701 BreakBeforeBraces == R.BreakBeforeBraces &&
5702 BreakBeforeCloseBracketBracedList ==
5703 R.BreakBeforeCloseBracketBracedList &&
5704 BreakBeforeCloseBracketFunction ==
5705 R.BreakBeforeCloseBracketFunction &&
5706 BreakBeforeCloseBracketIf == R.BreakBeforeCloseBracketIf &&
5707 BreakBeforeCloseBracketLoop == R.BreakBeforeCloseBracketLoop &&
5708 BreakBeforeCloseBracketSwitch == R.BreakBeforeCloseBracketSwitch &&
5709 BreakBeforeConceptDeclarations == R.BreakBeforeConceptDeclarations &&
5710 BreakBeforeInlineASMColon == R.BreakBeforeInlineASMColon &&
5711 BreakBeforeTemplateCloser == R.BreakBeforeTemplateCloser &&
5712 BreakBeforeTernaryOperators == R.BreakBeforeTernaryOperators &&
5713 BreakBinaryOperations == R.BreakBinaryOperations &&
5714 BreakConstructorInitializers == R.BreakConstructorInitializers &&
5715 BreakFunctionDefinitionParameters ==
5716 R.BreakFunctionDefinitionParameters &&
5717 BreakInheritanceList == R.BreakInheritanceList &&
5718 BreakStringLiterals == R.BreakStringLiterals &&
5719 BreakTemplateDeclarations == R.BreakTemplateDeclarations &&
5720 ColumnLimit == R.ColumnLimit && CommentPragmas == R.CommentPragmas &&
5721 CompactNamespaces == R.CompactNamespaces &&
5722 ConstructorInitializerIndentWidth ==
5723 R.ConstructorInitializerIndentWidth &&
5724 ContinuationIndentWidth == R.ContinuationIndentWidth &&
5725 Cpp11BracedListStyle == R.Cpp11BracedListStyle &&
5726 DerivePointerAlignment == R.DerivePointerAlignment &&
5727 DisableFormat == R.DisableFormat &&
5728 EmptyLineAfterAccessModifier == R.EmptyLineAfterAccessModifier &&
5729 EmptyLineBeforeAccessModifier == R.EmptyLineBeforeAccessModifier &&
5730 EnumTrailingComma == R.EnumTrailingComma &&
5731 ExperimentalAutoDetectBinPacking ==
5732 R.ExperimentalAutoDetectBinPacking &&
5733 FixNamespaceComments == R.FixNamespaceComments &&
5734 ForEachMacros == R.ForEachMacros &&
5736 IncludeStyle.IncludeCategories == R.IncludeStyle.IncludeCategories &&
5738 R.IncludeStyle.IncludeIsMainRegex &&
5740 R.IncludeStyle.IncludeIsMainSourceRegex &&
5741 IncludeStyle.MainIncludeChar == R.IncludeStyle.MainIncludeChar &&
5742 IndentAccessModifiers == R.IndentAccessModifiers &&
5743 IndentCaseBlocks == R.IndentCaseBlocks &&
5744 IndentCaseLabels == R.IndentCaseLabels &&
5745 IndentExportBlock == R.IndentExportBlock &&
5746 IndentExternBlock == R.IndentExternBlock &&
5747 IndentGotoLabels == R.IndentGotoLabels &&
5748 IndentPPDirectives == R.IndentPPDirectives &&
5749 IndentRequiresClause == R.IndentRequiresClause &&
5750 IndentWidth == R.IndentWidth &&
5751 IndentWrappedFunctionNames == R.IndentWrappedFunctionNames &&
5752 InsertBraces == R.InsertBraces &&
5753 InsertNewlineAtEOF == R.InsertNewlineAtEOF &&
5764 R.MacrosSkippedByRemoveParentheses &&
5772 R.ObjCBreakBeforeNestedBlockParam &&
5780 R.PenaltyBreakBeforeFirstCallParameter &&
5788 R.PenaltyBreakTemplateDeclaration &&
5798 R.RemoveEmptyLinesInUnwrappedLines &&
5816 R.SpaceBeforeCtorInitializerColon &&
5823 R.SpaceBeforeRangeBasedForLoopColon &&
5830 R.SpacesInLineCommentPrefix.Minimum &&
5832 R.SpacesInLineCommentPrefix.Maximum &&
5840 R.TableGenBreakingDAGArgOperators &&
5846 R.VerilogBreakBetweenInstancePorts &&
5849 }
5850
5852
5853
5854
5855
5856
5857
5858
5859
5861 typedef std::map<LanguageKind, FormatStyle> MapType;
5862
5864
5865
5866
5867
5868
5869
5870 void Add(FormatStyle Style);
5871
5872
5874
5875 private:
5876 std::shared_ptr Styles;
5877 };
5878
5880 const FormatStyle &MainStyle,
5881 const std::vector &ConfigurationStyles);
5882
5883private:
5885
5886 friend std::error_code
5887 parseConfiguration(llvm::MemoryBufferRef Config, FormatStyle *Style,
5888 bool AllowUnknownOptions,
5889 llvm::SourceMgr::DiagHandlerTy DiagHandler,
5890 void *DiagHandlerCtxt, bool IsDotHFile);
5891};
5892
5893
5894
5895FormatStyle
5896getLLVMStyle(FormatStyle::LanguageKind Language = FormatStyle::LK_Cpp);
5897
5898
5899
5900
5901
5903
5904
5905
5907
5908
5909
5911
5912
5913
5915
5916
5917
5919
5920
5921
5923
5925
5926
5928
5929
5930
5931
5932
5933
5934
5936 FormatStyle *Style);
5937
5938
5939
5940
5941
5942
5943
5944
5945
5946
5947
5948
5949
5950
5951
5952std::error_code
5954 bool AllowUnknownOptions = false,
5955 llvm::SourceMgr::DiagHandlerTy DiagHandler = nullptr,
5956 void *DiagHandlerCtx = nullptr, bool IsDotHFile = false);
5957
5958
5960 bool AllowUnknownOptions = false,
5961 bool IsDotHFile = false) {
5962 return parseConfiguration(llvm::MemoryBufferRef(Config, "YAML"), Style,
5963 AllowUnknownOptions, nullptr,
5964 nullptr, IsDotHFile);
5965}
5966
5967
5969
5970
5971
5972tooling::Replacements sortIncludes(const FormatStyle &Style, StringRef Code,
5975 unsigned *Cursor = nullptr);
5976
5977
5978
5979
5982 const FormatStyle &Style);
5983
5984
5985
5986
5987
5988
5989
5990
5991
5992
5993
5994
5995
5996
5999 const FormatStyle &Style);
6000
6001
6003
6004
6006
6007
6008
6009
6011};
6012
6013
6014
6015
6016
6017
6018
6019
6020
6021
6022
6023
6024tooling::Replacements reformat(const FormatStyle &Style, StringRef Code,
6026 StringRef FileName = "",
6028
6029
6030
6031
6032tooling::Replacements reformat(const FormatStyle &Style, StringRef Code,
6034 StringRef FileName, bool *IncompleteFormat);
6035
6036
6037
6038
6039
6040tooling::Replacements cleanup(const FormatStyle &Style, StringRef Code,
6042 StringRef FileName = "");
6043
6044
6045
6046
6047
6049 StringRef Code,
6051 StringRef FileName = "");
6052
6053
6054
6055
6056
6057
6058
6060 StringRef Code,
6062 StringRef FileName = "");
6063
6064
6065
6066
6067
6068
6070 StringRef Code,
6072 StringRef FileName = "");
6073
6074
6075
6076
6078
6079
6080
6081
6083
6084
6085
6086
6088
6089
6090
6092
6093
6094
6095
6096
6097
6098
6099
6100
6101
6102
6103
6104
6105
6106
6107
6108
6109
6110
6111
6112
6113
6114
6115
6116
6117
6118
6119
6120
6123 StringRef Code = "", llvm::vfs::FileSystem *FS = nullptr,
6124 bool AllowUnknownOptions = false,
6125 llvm::SourceMgr::DiagHandlerTy DiagHandler = nullptr);
6126
6127
6128
6130
6131
6133 switch (Language) {
6134 case FormatStyle::LK_C:
6135 return "C";
6136 case FormatStyle::LK_Cpp:
6137 return "C++";
6138 case FormatStyle::LK_CSharp:
6139 return "CSharp";
6140 case FormatStyle::LK_ObjC:
6141 return "Objective-C";
6142 case FormatStyle::LK_Java:
6143 return "Java";
6144 case FormatStyle::LK_JavaScript:
6145 return "JavaScript";
6146 case FormatStyle::LK_Json:
6147 return "Json";
6148 case FormatStyle::LK_Proto:
6149 return "Proto";
6150 case FormatStyle::LK_TableGen:
6151 return "TableGen";
6152 case FormatStyle::LK_TextProto:
6153 return "TextProto";
6154 case FormatStyle::LK_Verilog:
6155 return "Verilog";
6156 default:
6157 return "Unknown";
6158 }
6159}
6160
6163
6164}
6165}
6166
6167template <>
6168struct std::is_error_code_enum<clang::format::ParseError> : std::true_type {};
6169
6170#endif
std::error_code parseConfiguration(llvm::MemoryBufferRef Config, FormatStyle *Style, bool AllowUnknownOptions=false, llvm::SourceMgr::DiagHandlerTy DiagHandler=nullptr, void *DiagHandlerCtx=nullptr, bool IsDotHFile=false)
Parse configuration from YAML-formatted text.
StringRef getLanguageName(FormatStyle::LanguageKind Language)
Definition Format.h:6132
const char * DefaultFallbackStyle
The suggested predefined style to use as the fallback style in getStyle. Different builds can modify ...
const char * StyleOptionHelpDescription
Description to be used for help text for a llvm::cl option for specifying format style....
tooling::Replacements separateDefinitionBlocks(const FormatStyle &Style, StringRef Code, ArrayRef< tooling::Range > Ranges, StringRef FileName="")
Inserts or removes empty lines separating definition blocks including classes, structs,...
const char * DefaultFormatStyle
The suggested format style to use by default. This allows tools using getStyle to have a consistent d...
Defines the clang::LangOptions interface.
const char * name() const noexcept override
std::string message(int EV) const override
bool operator!=(const CommonEntityInfo &LHS, const CommonEntityInfo &RHS)
FormatStyle getWebKitStyle()
tooling::Replacements reformat(const FormatStyle &Style, StringRef Code, ArrayRef< tooling::Range > Ranges, StringRef FileName, FormattingAttemptStatus *Status)
tooling::Replacements sortUsingDeclarations(const FormatStyle &Style, StringRef Code, ArrayRef< tooling::Range > Ranges, StringRef FileName)
std::error_code make_error_code(ParseError e)
FormatStyle getClangFormatStyle()
static std::string format(StringRef NumericLiteral, const FormatStyle &Style)
FormatStyle getGoogleStyle(FormatStyle::LanguageKind Language)
std::string configurationAsText(const FormatStyle &Style)
FormatStyle getMicrosoftStyle(FormatStyle::LanguageKind Language)
const std::error_category & getParseCategory()
FormatStyle::LanguageKind guessLanguage(StringRef FileName, StringRef Code)
tooling::Replacements fixNamespaceEndComments(const FormatStyle &Style, StringRef Code, ArrayRef< tooling::Range > Ranges, StringRef FileName)
ParseError
Definition Format.h:35
@ DuplicateQualifierSpecified
Definition Format.h:41
@ Success
Definition Format.h:36
@ MissingQualifierType
Definition Format.h:42
@ Error
Definition Format.h:37
@ Unsuitable
Definition Format.h:38
@ BinPackTrailingCommaConflict
Definition Format.h:39
@ InvalidQualifierSpecified
Definition Format.h:40
@ MissingQualifierOrder
Definition Format.h:43
tooling::Replacements cleanup(const FormatStyle &Style, StringRef Code, ArrayRef< tooling::Range > Ranges, StringRef FileName)
FormatStyle getGNUStyle()
bool isClangFormatOff(StringRef Comment)
FormatStyle getMozillaStyle()
bool getPredefinedStyle(StringRef Name, FormatStyle::LanguageKind Language, FormatStyle *Style)
Expected< tooling::Replacements > cleanupAroundReplacements(StringRef Code, const tooling::Replacements &Replaces, const FormatStyle &Style)
tooling::Replacements sortIncludes(const FormatStyle &Style, StringRef Code, ArrayRef< tooling::Range > Ranges, StringRef FileName, unsigned *Cursor)
bool isClangFormatOn(StringRef Comment)
FormatStyle getLLVMStyle(FormatStyle::LanguageKind Language)
Expected< FormatStyle > getStyle(StringRef StyleName, StringRef FileName, StringRef FallbackStyleName, StringRef Code, llvm::vfs::FileSystem *FS, bool AllowUnknownOptions, llvm::SourceMgr::DiagHandlerTy DiagHandler)
FormatStyle getChromiumStyle(FormatStyle::LanguageKind Language)
std::error_code parseConfiguration(llvm::MemoryBufferRef Config, FormatStyle *Style, bool AllowUnknownOptions, llvm::SourceMgr::DiagHandlerTy DiagHandler, void *DiagHandlerCtxt, bool IsDotHFile)
Expected< tooling::Replacements > formatReplacements(StringRef Code, const tooling::Replacements &Replaces, const FormatStyle &Style)
LangOptions getFormattingLangOpts(const FormatStyle &Style)
The JSON file list parser is used to communicate input to InstallAPI.
unsigned TabWidth
The number of columns used for tab stops.
Definition Format.h:5504
unsigned ObjCBlockIndentWidth
The number of characters to use for indentation of ObjC blocks.
Definition Format.h:3885
bool ObjCBreakBeforeNestedBlockParam
Break parameters list into lines when there is nested block parameters in a function call.
Definition Format.h:3909
bool SpaceAfterTemplateKeyword
If true, a space will be inserted after the template keyword.
Definition Format.h:4790
WrapNamespaceBodyWithEmptyLinesStyle WrapNamespaceBodyWithEmptyLines
Wrap namespace body with empty lines.
Definition Format.h:5638
ReferenceAlignmentStyle ReferenceAlignment
Reference alignment style (overrides PointerAlignment for references).
Definition Format.h:4269
ReflowCommentsStyle
Types of comment reflow style.
Definition Format.h:4273
@ RCS_IndentOnly
Only apply indentation rules, moving comments left or right, without changing formatting inside the c...
Definition Format.h:4290
@ RCS_Always
Apply indentation rules and reflow long comments into new lines, trying to obey the ColumnLimit.
Definition Format.h:4301
@ RCS_Never
Leave comments untouched.
Definition Format.h:4281
int PPIndentWidth
The number of columns to use for indentation of preprocessor statements. When set to -1 (default) Ind...
Definition Format.h:4112
SeparateDefinitionStyle
The style if definition blocks should be separated.
Definition Format.h:4570
@ SDS_Never
Remove any empty line between definition blocks.
Definition Format.h:4576
@ SDS_Always
Insert an empty line between definition blocks.
Definition Format.h:4574
@ SDS_Leave
Leave definition blocks as they are.
Definition Format.h:4572
SpacesInParensStyle SpacesInParens
If true, spaces will be inserted after ( and before ). This option is deprecated. The previous behavi...
Definition Format.h:5280
bool isJavaScript() const
Definition Format.h:3602
DAGArgStyle
Different ways to control the format inside TableGen DAGArg.
Definition Format.h:5475
@ DAS_BreakAll
Break inside DAGArg after the operator and the all elements.
Definition Format.h:5495
@ DAS_DontBreak
Never break inside DAGArg.
Definition Format.h:5480
@ DAS_BreakElements
Break inside DAGArg after each list element but for the last. This aligns to the first element.
Definition Format.h:5487
bool VerilogBreakBetweenInstancePorts
For Verilog, put each port on its own line in module instantiations.
Definition Format.h:5588
std::vector< std::string > JavaImportGroups
A vector of prefixes ordered by the desired groups for Java imports.
Definition Format.h:3429
unsigned PenaltyBreakTemplateDeclaration
The penalty for breaking after template declaration.
Definition Format.h:4061
SortJavaStaticImportOptions SortJavaStaticImport
When sorting Java imports, by default static imports are placed before non-static imports....
Definition Format.h:4714
RequiresClausePositionStyle
The possible positions for the requires clause. The IndentRequires option is only used if the require...
Definition Format.h:4442
@ RCPS_WithPreceding
Try to put the clause together with the preceding part of a declaration. For class templates: stick t...
Definition Format.h:4498
@ RCPS_SingleLine
Try to put everything in the same line if possible. Otherwise normal line breaking rules take over.
Definition Format.h:4536
@ RCPS_OwnLineWithBrace
As with OwnLine, except, unless otherwise prohibited, place a following open brace (of a function def...
Definition Format.h:4481
@ RCPS_OwnLine
Always put the requires clause on its own line (possibly followed by a semicolon).
Definition Format.h:4463
@ RCPS_WithFollowing
Try to put the requires clause together with the class or function declaration.
Definition Format.h:4512
std::vector< RawStringFormat > RawStringFormats
Defines hints for detecting supported languages code blocks in raw strings.
Definition Format.h:4244
UseTabStyle
This option is deprecated. See LF and CRLF of LineEnding.
Definition Format.h:5547
@ UT_ForContinuationAndIndentation
Fill all leading whitespace with tabs, and use spaces for alignment that appears within a line (e....
Definition Format.h:5554
@ UT_ForIndentation
Use tabs only for indentation.
Definition Format.h:5551
@ UT_Always
Use tabs whenever we need to fill whitespace that spans at least from one tab stop to the next one.
Definition Format.h:5560
@ UT_AlignWithSpaces
Use tabs for line continuation and indentation, and spaces for alignment.
Definition Format.h:5557
@ UT_Never
Never use tab.
Definition Format.h:5549
LanguageStandard Standard
Parse and format C++ constructs compatible with this standard.
Definition Format.h:5419
bool isTableGen() const
Definition Format.h:3606
bool isProto() const
Definition Format.h:3605
PointerAlignmentStyle
The &, && and * alignment style.
Definition Format.h:4077
@ PAS_Right
Align pointer to the right.
Definition Format.h:4087
@ PAS_Middle
Align pointer in the middle.
Definition Format.h:4092
@ PAS_Left
Align pointer to the left.
Definition Format.h:4082
bool isJava() const
Definition Format.h:3601
bool isTextProto() const
Definition Format.h:3604
SpaceBeforeParensCustom SpaceBeforeParensOptions
Control of individual space before parentheses.
Definition Format.h:5077
std::vector< std::string > Macros
A list of macros of the form = .
Definition Format.h:3704
RequiresExpressionIndentationKind RequiresExpressionIndentation
The indentation used for requires expression bodies.
Definition Format.h:4567
SpaceInEmptyBracesStyle SpaceInEmptyBraces
Specifies when to insert a space in empty braces.
Definition Format.h:5136
SpacesInLineComment SpacesInLineCommentPrefix
How many spaces are allowed at the start of a line comment. To disable the maximum set it to -1,...
Definition Format.h:5251
bool SkipMacroDefinitionBody
Do not format macro definition body.
Definition Format.h:4651
PointerAlignmentStyle PointerAlignment
Pointer and reference alignment style.
Definition Format.h:4097
std::optional< FormatStyle > GetLanguageStyle(LanguageKind Language) const
PackConstructorInitializersStyle
Different ways to try to fit all constructor initializers on a line.
Definition Format.h:3966
@ PCIS_CurrentLine
Put all constructor initializers on the current line if they fit. Otherwise, put each one on its own ...
Definition Format.h:3991
@ PCIS_Never
Always put each constructor initializer on its own line.
Definition Format.h:3973
@ PCIS_BinPack
Bin-pack constructor initializers.
Definition Format.h:3980
@ PCIS_NextLine
Same as PCIS_CurrentLine except that if all constructor initializers do not fit on the current line,...
Definition Format.h:4005
@ PCIS_NextLineOnly
Put all constructor initializers on the next line if they fit. Otherwise, put each one on its own lin...
Definition Format.h:4020
bool SpaceBeforeRangeBasedForLoopColon
If false, spaces will be removed before range-based for loop colon.
Definition Format.h:5096
unsigned PenaltyReturnTypeOnItsOwnLine
Penalty for putting the return type of a function onto its own line.
Definition Format.h:4074
bool SpaceBeforeCaseColon
If false, spaces will be removed before case colon.
Definition Format.h:4842
std::vector< std::string > StatementAttributeLikeMacros
Macros which are ignored in front of a statement, as if they were an attribute. So that they are not ...
Definition Format.h:5436
SpacesInParensStyle
Different ways to put a space before opening and closing parentheses.
Definition Format.h:5254
@ SIPO_Never
Never put a space in parentheses.
Definition Format.h:5263
@ SIPO_Custom
Configure each individual space in parentheses in SpacesInParensOptions.
Definition Format.h:5266
bool operator==(const CallGraphNode::CallRecord &LHS, const CallGraphNode::CallRecord &RHS)
JavaScriptQuoteStyle JavaScriptQuotes
The JavaScriptQuoteStyle to use for JavaScript strings.
Definition Format.h:3456
NumericLiteralComponentStyle
Control over each component in a numeric literal.
Definition Format.h:3777
@ NLCS_Leave
Leave this component of the literal as is.
Definition Format.h:3779
@ NLCS_Upper
Format this component with uppercase characters.
Definition Format.h:3781
@ NLCS_Lower
Format this component with lowercase characters.
Definition Format.h:3783
RequiresExpressionIndentationKind
Indentation logic for requires expression bodies.
Definition Format.h:4544
@ REI_Keyword
Align requires expression body relative to the requires keyword.
Definition Format.h:4562
@ REI_OuterScope
Align requires expression body relative to the indentation level of the outer scope the requires expr...
Definition Format.h:4554
SpaceBeforeParensStyle
Different ways to put a space before opening parentheses.
Definition Format.h:4885
@ SBPO_ControlStatementsExceptControlMacros
Same as SBPO_ControlStatements except this option doesn't apply to ForEach and If macros....
Definition Format.h:4912
@ SBPO_ControlStatements
Put a space before opening parentheses only after control statement keywords (for/if/while....
Definition Format.h:4899
@ SBPO_Always
Always put a space before opening parentheses, except when it's prohibited by the syntax rules (in fu...
Definition Format.h:4935
@ SBPO_Never
This is deprecated and replaced by Custom below, with all SpaceBeforeParensOptions but AfterPlacement...
Definition Format.h:4889
@ SBPO_Custom
Configure each individual space before parentheses in SpaceBeforeParensOptions.
Definition Format.h:4938
@ SBPO_NonEmptyParentheses
Put a space before opening parentheses only if the parentheses are not empty.
Definition Format.h:4923
std::vector< std::string > WhitespaceSensitiveMacros
A vector of macros which are whitespace-sensitive and should not be touched.
Definition Format.h:5605
bool SpaceAfterOperatorKeyword
If true, a space will be inserted after the operator keyword.
Definition Format.h:4782
bool ObjCSpaceAfterProperty
Add a space after @property in Objective-C, i.e. use @property (readonly) instead of @property(readon...
Definition Format.h:3937
ReflowCommentsStyle ReflowComments
Comment reformatting style.
Definition Format.h:4307
std::vector< std::string > TypeNames
A vector of non-keyword identifiers that should be interpreted as type names.
Definition Format.h:5523
LineEndingStyle
Line ending style.
Definition Format.h:3618
@ LE_DeriveCRLF
Use \r\n unless the input has more lines ending in \n.
Definition Format.h:3626
@ LE_CRLF
Use \r\n.
Definition Format.h:3622
@ LE_LF
Use \n.
Definition Format.h:3620
@ LE_DeriveLF
Use \n unless the input has more lines ending in \r\n.
Definition Format.h:3624
SpacesInAnglesStyle
Styles for adding spacing after < and before > in template argument lists.
Definition Format.h:5166
@ SIAS_Always
Add spaces after < and before >.
Definition Format.h:5178
@ SIAS_Never
Remove spaces after < and before >.
Definition Format.h:5172
@ SIAS_Leave
Keep a single space after < and before > if any spaces were present. Option Standard: Cpp03 takes pre...
Definition Format.h:5181
IntegerLiteralSeparatorStyle IntegerLiteralSeparator
Format integer literal separators (' for C++ and _ for C#, Java, and JavaScript).
Definition Format.h:3395
std::vector< std::string > TableGenBreakingDAGArgOperators
Works only when TableGenBreakInsideDAGArg is not DontBreak. The string list needs to consist of ident...
Definition Format.h:5472
bool SpaceBeforeCpp11BracedList
If true, a space will be inserted before a C++11 braced list used to initialize an object (after the ...
Definition Format.h:4854
unsigned PenaltyExcessCharacter
The penalty for each character outside of the column limit.
Definition Format.h:4065
SortJavaStaticImportOptions
Position for Java Static imports.
Definition Format.h:4693
@ SJSIO_After
Static imports are placed after non-static imports.
Definition Format.h:4707
@ SJSIO_Before
Static imports are placed before non-static imports.
Definition Format.h:4700
NamespaceIndentationKind NamespaceIndentation
The indentation used for namespaces.
Definition Format.h:3761
bool SpaceBeforeSquareBrackets
If true, spaces will be before [. Lambdas will not be affected. Only the first [ will get a space add...
Definition Format.h:5087
bool RemoveSemicolon
Remove semicolons after the closing braces of functions and constructors/destructors.
Definition Format.h:4438
Language
The language for the input, used to select and validate the language standard and possible actions.
bool isCpp() const
Definition Format.h:3596
bool isCSharp() const
Definition Format.h:3599
bool SpaceBeforeAssignmentOperators
If false, spaces will be removed before assignment operators.
Definition Format.h:4832
unsigned PenaltyBreakComment
The penalty for each line break introduced inside a comment.
Definition Format.h:4041
QualifierAlignmentStyle
Different specifiers and qualifiers alignment styles.
Definition Format.h:4115
@ QAS_Custom
Change specifiers/qualifiers to be aligned based on QualifierOrder. With:
Definition Format.h:4146
@ QAS_Leave
Don't change specifiers/qualifiers to either Left or Right alignment (default).
Definition Format.h:4122
@ QAS_Left
Change specifiers/qualifiers to be left-aligned.
Definition Format.h:4128
@ QAS_Right
Change specifiers/qualifiers to be right-aligned.
Definition Format.h:4134
SpacesInParensCustom SpacesInParensOptions
Control of individual spaces in parentheses.
Definition Format.h:5373
SpacesInAnglesStyle SpacesInAngles
The SpacesInAnglesStyle to use for template argument lists.
Definition Format.h:5185
BinPackStyle ObjCBinPackProtocolList
Controls bin-packing Objective-C protocol conformance list items into as few lines as possible when t...
Definition Format.h:3874
bool ObjCSpaceBeforeProtocolList
Add a space in front of an Objective-C protocol list, i.e. use Foo instead of Foo<Protocol...
Definition Format.h:3942
bool SpacesInContainerLiterals
If true, spaces will be inserted around if/for/switch/while conditions. This option is deprecated....
Definition Format.h:5203
std::string OneLineFormatOffRegex
A regular expression that describes markers for turning formatting off for one line....
Definition Format.h:3963
RemoveParenthesesStyle RemoveParentheses
Remove redundant parentheses.
Definition Format.h:4420
UseTabStyle UseTab
The way to use tab characters in the resulting file.
Definition Format.h:5565
std::vector< std::string > ObjCPropertyAttributeOrder
The order in which ObjC property attributes should appear.
Definition Format.h:3932
std::string MacroBlockBegin
A regular expression matching macros that start a block.
Definition Format.h:3660
unsigned PenaltyBreakString
The penalty for each line break introduced inside a string literal.
Definition Format.h:4057
unsigned PenaltyBreakOpenParenthesis
The penalty for breaking after (.
Definition Format.h:4049
WrapNamespaceBodyWithEmptyLinesStyle
Different styles for wrapping namespace body with empty lines.
Definition Format.h:5608
@ WNBWELS_Never
Remove all empty lines at the beginning and the end of namespace body.
Definition Format.h:5617
@ WNBWELS_Always
Always have at least one empty line at the beginning and the end of namespace body except that the nu...
Definition Format.h:5630
@ WNBWELS_Leave
Keep existing newlines at the beginning and the end of namespace body. MaxEmptyLinesToKeep still appl...
Definition Format.h:5633
unsigned PenaltyBreakBeforeFirstCallParameter
The penalty for breaking a function call after call(.
Definition Format.h:4033
LambdaBodyIndentationKind
Indentation logic for lambda bodies.
Definition Format.h:3528
@ LBI_Signature
Align lambda body relative to the lambda signature. This is the default.
Definition Format.h:3536
@ LBI_OuterScope
For statements within block scope, align lambda body relative to the indentation level of the outer s...
Definition Format.h:3550
bool isJson() const
Definition Format.h:3600
unsigned PenaltyBreakFirstLessLess
The penalty for breaking before the first <<.
Definition Format.h:4045
std::vector< std::string > MacrosSkippedByRemoveParentheses
A vector of function-like macros whose invocations should be skipped by RemoveParentheses.
Definition Format.h:3709
RequiresClausePositionStyle RequiresClausePosition
The position of the requires clause.
Definition Format.h:4541
bool SpaceBeforeJsonColon
If true, a space will be added before a JSON colon. For other languages, e.g. JavaScript,...
Definition Format.h:4882
bool JavaScriptWrapImports
Whether to wrap JavaScript import/export statements.
Definition Format.h:3472
bool SpaceBeforeInheritanceColon
If false, spaces will be removed before inheritance colon.
Definition Format.h:4871
SpaceInEmptyBracesStyle
This option is deprecated. See Block of SpaceInEmptyBraces.
Definition Format.h:5103
@ SIEB_Block
Only insert a space in empty blocks.
Definition Format.h:5119
@ SIEB_Always
Always insert a space in empty braces.
Definition Format.h:5111
@ SIEB_Never
Never insert a space in empty braces.
Definition Format.h:5127
std::vector< std::string > TypenameMacros
A vector of macros that should be interpreted as type declarations instead of as function calls.
Definition Format.h:5540
LanguageStandard
Supported language standards for parsing and formatting C++ constructs.
Definition Format.h:5394
@ LS_Cpp03
Parse and format as C++03. Cpp03 is a deprecated alias for c++03
Definition Format.h:5397
@ LS_Cpp14
Parse and format as C++14.
Definition Format.h:5401
@ LS_Cpp17
Parse and format as C++17.
Definition Format.h:5403
@ LS_Cpp11
Parse and format as C++11.
Definition Format.h:5399
@ LS_Auto
Automatic detection based on the input.
Definition Format.h:5410
@ LS_Latest
Parse and format using the latest supported language version. Cpp11 is a deprecated alias for Latest
Definition Format.h:5408
@ LS_Cpp20
Parse and format as C++20.
Definition Format.h:5405
KeepEmptyLinesStyle KeepEmptyLines
Which empty lines are kept. See MaxEmptyLinesToKeep for how many consecutive empty lines are kept.
Definition Format.h:3509
bool isVerilog() const
Definition Format.h:3603
SortUsingDeclarationsOptions
Using declaration sorting options.
Definition Format.h:4717
@ SUD_LexicographicNumeric
Using declarations are sorted in the order defined as follows: Split the strings by :: and discard an...
Definition Format.h:4753
@ SUD_Never
Using declarations are never sorted.
Definition Format.h:4726
@ SUD_Lexicographic
Using declarations are sorted in the order defined as follows: Split the strings by :: and discard an...
Definition Format.h:4738
unsigned PenaltyBreakScopeResolution
The penalty for breaking after ::.
Definition Format.h:4053
DAGArgStyle TableGenBreakInsideDAGArg
The styles of the line break inside the DAGArg in TableGen.
Definition Format.h:5500
LambdaBodyIndentationKind LambdaBodyIndentation
The indentation style of lambda bodies. Signature (the default) causes the lambda body to be indented...
Definition Format.h:3559
NamespaceIndentationKind
Different ways to indent namespace contents.
Definition Format.h:3726
@ NI_None
Don't indent in namespaces.
Definition Format.h:3736
@ NI_All
Indent in all namespaces.
Definition Format.h:3756
@ NI_Inner
Indent only in inner namespaces (nested in other namespaces).
Definition Format.h:3746
SeparateDefinitionStyle SeparateDefinitionBlocks
Specifies the use of empty lines to separate definition blocks, including classes,...
Definition Format.h:4625
bool SpaceAfterCStyleCast
If true, a space is inserted after C style casts.
Definition Format.h:4766
SpaceAroundPointerQualifiersStyle SpaceAroundPointerQualifiers
Defines in which cases to put a space before or after pointer qualifiers.
Definition Format.h:4823
SpaceAroundPointerQualifiersStyle
Different ways to put a space before opening parentheses.
Definition Format.h:4793
@ SAPQ_Both
Ensure that there is a space both before and after pointer qualifiers.
Definition Format.h:4818
@ SAPQ_Default
Don't ensure spaces around pointer qualifiers and use PointerAlignment instead.
Definition Format.h:4800
@ SAPQ_Before
Ensure that there is a space before pointer qualifiers.
Definition Format.h:4806
@ SAPQ_After
Ensure that there is a space after pointer qualifiers.
Definition Format.h:4812
std::vector< std::string > TemplateNames
A vector of non-keyword identifiers that should be interpreted as template names.
Definition Format.h:5513
bool SpacesInSquareBrackets
If true, spaces will be inserted after [ and before ]. Lambdas without arguments or unspecified size ...
Definition Format.h:5384
std::vector< std::string > StatementMacros
A vector of macros that should be interpreted as complete statements.
Definition Format.h:5446
RemoveParenthesesStyle
Types of redundant parentheses to remove.
Definition Format.h:4387
@ RPS_ReturnStatement
Also remove parentheses enclosing the expression in a return/co_return statement.
Definition Format.h:4409
@ RPS_MultipleParentheses
Replace multiple parentheses with single parentheses.
Definition Format.h:4401
@ RPS_Leave
Do not remove parentheses.
Definition Format.h:4394
std::vector< std::string > NamespaceMacros
A vector of macros which are used to open namespace blocks.
Definition Format.h:3774
unsigned PenaltyBreakBeforeMemberAccess
The penalty for breaking before a member access operator (., ->).
Definition Format.h:4037
LineEndingStyle LineEnding
Line ending style (\n or \r\n) to use.
Definition Format.h:3631
unsigned SpacesBeforeTrailingComments
If true, spaces may be inserted into (). This option is deprecated. See InEmptyParentheses of SpacesI...
Definition Format.h:5162
bool RemoveEmptyLinesInUnwrappedLines
Remove empty lines within unwrapped lines.
Definition Format.h:4384
unsigned MaxEmptyLinesToKeep
The maximum number of consecutive empty lines to keep.
Definition Format.h:3723
PackConstructorInitializersStyle PackConstructorInitializers
The pack constructor initializers style to use.
Definition Format.h:4025
SortIncludesOptions SortIncludes
Controls if and how clang-format will sort #includes.
Definition Format.h:4690
bool SpaceAfterLogicalNot
If true, a space is inserted after the logical not operator (!).
Definition Format.h:4774
bool KeepFormFeed
This option is deprecated. See AtEndOfFile of KeepEmptyLines.
Definition Format.h:3525
std::string MacroBlockEnd
A regular expression matching macros that end a block.
Definition Format.h:3664
unsigned ShortNamespaceLines
The maximal number of unwrapped lines that a short namespace spans. Defaults to 1.
Definition Format.h:4647
std::vector< std::string > QualifierOrder
The order in which the qualifiers appear. The order is an array that can contain any of the following...
Definition Format.h:4184
bool RemoveBracesLLVM
Remove optional braces of control statements (if, else, for, and while) in C++ according to the LLVM ...
Definition Format.h:4361
ReferenceAlignmentStyle
The & and && alignment style.
Definition Format.h:4247
@ RAS_Middle
Align reference in the middle.
Definition Format.h:4264
@ RAS_Right
Align reference to the right.
Definition Format.h:4259
@ RAS_Pointer
Align reference like PointerAlignment.
Definition Format.h:4249
@ RAS_Left
Align reference to the left.
Definition Format.h:4254
bool SpaceBeforeCtorInitializerColon
If false, spaces will be removed before constructor initializer colon.
Definition Format.h:4863
unsigned PenaltyBreakAssignment
The penalty for breaking around an assignment operator.
Definition Format.h:4029
QualifierAlignmentStyle QualifierAlignment
Different ways to arrange specifiers and qualifiers (e.g. const/volatile).
Definition Format.h:4158
LanguageKind
Supported languages.
Definition Format.h:3566
@ LK_Java
Should be used for Java.
Definition Format.h:3576
@ LK_Cpp
Should be used for C++.
Definition Format.h:3572
@ LK_TableGen
Should be used for TableGen code.
Definition Format.h:3587
@ LK_ObjC
Should be used for Objective-C, Objective-C++.
Definition Format.h:3582
@ LK_CSharp
Should be used for C#.
Definition Format.h:3574
@ LK_TextProto
Should be used for Protocol Buffer messages in text format (https://developers.google....
Definition Format.h:3590
@ LK_Json
Should be used for JSON.
Definition Format.h:3580
@ LK_JavaScript
Should be used for JavaScript.
Definition Format.h:3578
@ LK_Verilog
Should be used for Verilog and SystemVerilog. https://standards.ieee.org/ieee/1800/6700/ https://sci-...
Definition Format.h:3594
@ LK_C
Should be used for C.
Definition Format.h:3570
@ LK_None
Do not use.
Definition Format.h:3568
@ LK_Proto
Should be used for Protocol Buffers (https://developers.google.com/protocol-buffers/).
Definition Format.h:3585
@ Other
Other implicit parameter.
std::vector< std::string > VariableTemplates
A vector of non-keyword identifiers that should be interpreted as variable template names.
Definition Format.h:5574
SortUsingDeclarationsOptions SortUsingDeclarations
Controls if and how clang-format will sort using declarations.
Definition Format.h:4758
unsigned PenaltyIndentedWhitespace
Penalty for each character of whitespace indentation (counted relative to leading non-whitespace colu...
Definition Format.h:4070
static FormatStyleSet BuildStyleSetFromConfiguration(const FormatStyle &MainStyle, const std::vector< FormatStyle > &ConfigurationStyles)
NumericLiteralCaseStyle NumericLiteralCase
Capitalization style for numeric literals.
Definition Format.h:3841
JavaScriptQuoteStyle
Quotation styles for JavaScript strings. Does not affect template strings.
Definition Format.h:3433
@ JSQS_Double
Always use double quotes.
Definition Format.h:3451
@ JSQS_Leave
Leave string quotes as they are.
Definition Format.h:3439
@ JSQS_Single
Always use single quotes.
Definition Format.h:3445
SpaceBeforeParensStyle SpaceBeforeParens
Defines in which cases to put a space before opening parentheses.
Definition Format.h:4943
Diagnostic wrappers for TextAPI types for error reporting.
Represents the status of a formatting attempt.
Definition Format.h:6002
bool FormatComplete
A value of false means that any of the affected ranges were not formatted due to a non-recoverable sy...
Definition Format.h:6005
unsigned Line
If FormatComplete is false, Line records a one-based original line number at which a syntax error mig...
Definition Format.h:6010
Style for sorting and grouping C++ include directives.
IncludeBlocksStyle IncludeBlocks
Dependent on the value, multiple #include blocks can be sorted as one and divided based on category.
void Add(FormatStyle Style)
std::optional< FormatStyle > Get(LanguageKind Language) const
std::map< LanguageKind, FormatStyle > MapType
Definition Format.h:5861
Options regarding which empty lines are kept.
Definition Format.h:3486
bool AtStartOfBlock
Keep empty lines at start of a block.
Definition Format.h:3497
bool AtStartOfFile
Keep empty lines at start of file.
Definition Format.h:3499
bool AtEndOfFile
Keep empty lines at end of file.
Definition Format.h:3488
bool operator==(const KeepEmptyLinesStyle &R) const
Definition Format.h:3500
Separate control for each numeric literal component.
Definition Format.h:3798
bool operator==(const NumericLiteralCaseStyle &R) const
Definition Format.h:3829
bool operator!=(const NumericLiteralCaseStyle &R) const
Definition Format.h:3834
NumericLiteralComponentStyle ExponentLetter
Format floating point exponent separator letter case.
Definition Format.h:3805
NumericLiteralComponentStyle Suffix
Format suffix case. This option excludes case-sensitive reserved suffixes, such as min in C++.
Definition Format.h:3827
NumericLiteralComponentStyle Prefix
Format integer prefix case.
Definition Format.h:3819
NumericLiteralComponentStyle HexDigit
Format hexadecimal digit case.
Definition Format.h:3812
See documentation of RawStringFormats.
Definition Format.h:4187
std::string CanonicalDelimiter
The canonical delimiter for this language.
Definition Format.h:4195
std::vector< std::string > Delimiters
A list of raw string delimiters that match this language.
Definition Format.h:4191
std::vector< std::string > EnclosingFunctions
A list of enclosing function names that match this language.
Definition Format.h:4193
bool operator==(const RawStringFormat &Other) const
Definition Format.h:4200
std::string BasedOnStyle
The style name on which this raw string format is based on. If not specified, the raw string format i...
Definition Format.h:4199
LanguageKind Language
The language of this raw string.
Definition Format.h:4189
Includes sorting options.
Definition Format.h:4654
bool operator!=(const SortIncludesOptions &R) const
Definition Format.h:4683
bool IgnoreCase
Whether or not includes are sorted in a case-insensitive fashion. (CaseSensitive and CaseInsensitive ...
Definition Format.h:4669
bool IgnoreExtension
When sorting includes in each block, only take file extensions into account if two includes compare e...
Definition Format.h:4678
bool operator==(const SortIncludesOptions &R) const
Definition Format.h:4679
bool Enabled
If true, includes are sorted based on the other suboptions below. (Never is deprecated by Enabled: fa...
Definition Format.h:4657
Precise control over the spacing before parentheses.
Definition Format.h:4953
bool AfterFunctionDefinitionName
If true, put a space between function definition name and opening parentheses.
Definition Format.h:4981
bool AfterIfMacros
If true, put space between if macros and opening parentheses.
Definition Format.h:4988
bool AfterForeachMacros
If true, put space between foreach macros and opening parentheses.
Definition Format.h:4967
bool AfterFunctionDeclarationName
If true, put a space between function declaration name and opening parentheses.
Definition Format.h:4974
bool operator==(const SpaceBeforeParensCustom &Other) const
Definition Format.h:5048
bool AfterControlStatements
If true, put space between control statement keywords (for/if/while...) and opening parentheses.
Definition Format.h:4960
bool BeforeNonEmptyParentheses
If true, put a space before opening parentheses only if the parentheses are not empty.
Definition Format.h:5038
bool AfterPlacementOperator
If true, put a space between operator new/delete and opening parenthesis.
Definition Format.h:5011
bool AfterRequiresInExpression
If true, put space between requires keyword in a requires expression and opening parentheses.
Definition Format.h:5030
bool AfterNot
If true, put a space between alternative operator not and the opening parenthesis.
Definition Format.h:4995
bool AfterRequiresInClause
If true, put space between requires keyword in a requires clause and opening parentheses,...
Definition Format.h:5020
SpaceBeforeParensCustom()
Definition Format.h:5040
bool AfterOverloadedOperator
If true, put a space between operator overloading and opening parentheses.
Definition Format.h:5003
Precise control over the spacing in parentheses.
Definition Format.h:5291
bool Other
Put a space in parentheses not covered by preceding options.
Definition Format.h:5334
bool InCStyleCasts
Put a space in C style casts.
Definition Format.h:5317
bool operator!=(const SpacesInParensCustom &R) const
Definition Format.h:5354
SpacesInParensCustom()
Definition Format.h:5336
bool InConditionalStatements
Put a space in parentheses only inside conditional statements (for/if/while/switch....
Definition Format.h:5310
bool InEmptyParentheses
Insert a space in empty parentheses, i.e. ().
Definition Format.h:5328
bool ExceptDoubleParentheses
Override any of the following options to prevent addition of space when both opening and closing pare...
Definition Format.h:5302
SpacesInParensCustom(bool ExceptDoubleParentheses, bool InConditionalStatements, bool InCStyleCasts, bool InEmptyParentheses, bool Other)
Definition Format.h:5340
bool operator==(const SpacesInParensCustom &R) const
Definition Format.h:5348