@@ -512,7 +512,7 @@ class PrintBase {
512
512
513
513
printRec (arg.getExpr ());
514
514
printFoot ();
515
- }, " " );
515
+ });
516
516
}
517
517
518
518
void printRec (const ArgumentList *argList, StringRef label = " " ) {
@@ -586,7 +586,7 @@ class PrintBase {
586
586
SmallPtrSet<const ProtocolConformance *, 4 > Dumped;
587
587
dumpSubstitutionMapRec (map, OS, SubstitutionMap::DumpStyle::Full,
588
588
Indent, Dumped);
589
- }, " " );
589
+ });
590
590
}
591
591
592
592
void printRec (ProtocolConformanceRef conf, StringRef label = " " ) {
@@ -620,6 +620,13 @@ class PrintBase {
620
620
color);
621
621
}
622
622
623
+
624
+ // Print a field with a value.
625
+ template <typename Fn>
626
+ void printFlagRaw (Fn body, TerminalColor color = FieldLabelColor) {
627
+ printFieldRaw (body, " " , color);
628
+ }
629
+
623
630
// Print a single flag.
624
631
void printFlag (StringRef name, TerminalColor color = FieldLabelColor) {
625
632
printField (name, " " , color);
@@ -994,11 +1001,11 @@ class PrintBase {
994
1001
printFlag (attrs.hasAttribute <ObjCAttr>(), " @objc" );
995
1002
printFlag (attrs.hasAttribute <DynamicAttr>(), " dynamic" );
996
1003
if (auto *attr = attrs.getAttribute <DynamicReplacementAttr>()) {
997
- printFieldRaw ([&](raw_ostream &OS) {
1004
+ printFlagRaw ([&](raw_ostream &OS) {
998
1005
OS << " @_dynamicReplacement(for: \" " ;
999
1006
OS << attr->getReplacedFunctionName ();
1000
1007
OS << " \" )" ;
1001
- }, " " );
1008
+ });
1002
1009
}
1003
1010
auto lifetimeString = getDumpString (VD->getLifetimeAnnotation ());
1004
1011
if (!lifetimeString.empty ())
@@ -1214,9 +1221,9 @@ class PrintBase {
1214
1221
void printCommonAFD (AbstractFunctionDecl *D, const char *Type, StringRef Label) {
1215
1222
printCommon (D, Type, Label, FuncColor);
1216
1223
if (!D->getCaptureInfo ().isTrivial ()) {
1217
- printFieldRaw ([&](raw_ostream &OS) {
1224
+ printFlagRaw ([&](raw_ostream &OS) {
1218
1225
D->getCaptureInfo ().print (OS);
1219
- }, " " );
1226
+ });
1220
1227
}
1221
1228
1222
1229
printFlag (D->getAttrs ().hasAttribute <NonisolatedAttr>(), " nonisolated" ,
@@ -1250,7 +1257,7 @@ class PrintBase {
1250
1257
if (auto errorParamIndex = fac->completionHandlerErrorParamIndex ())
1251
1258
printField (*errorParamIndex, " error_param" );
1252
1259
printFoot ();
1253
- }, " " );
1260
+ });
1254
1261
}
1255
1262
1256
1263
if (auto fec = D->getForeignErrorConvention ()) {
@@ -1269,7 +1276,7 @@ class PrintBase {
1269
1276
if (wantResultType)
1270
1277
printField (fec->getResultType (), " resulttype" );
1271
1278
printFoot ();
1272
- }, " " );
1279
+ });
1273
1280
}
1274
1281
1275
1282
if (D->hasSingleExpressionBody ()) {
@@ -1335,7 +1342,7 @@ class PrintBase {
1335
1342
1336
1343
void visitIfConfigDecl (IfConfigDecl *ICD, StringRef label) {
1337
1344
printCommon (ICD, " if_config_decl" , label);
1338
- printRecRange (ICD->getClauses (), &ICD->getASTContext (), " " );
1345
+ printRecRange (ICD->getClauses (), &ICD->getASTContext (), " clauses " );
1339
1346
printFoot ();
1340
1347
}
1341
1348
@@ -1360,7 +1367,7 @@ class PrintBase {
1360
1367
for (auto &rel : rels)
1361
1368
printFlag (rel.Name .str ());
1362
1369
printFoot ();
1363
- }, " " );
1370
+ });
1364
1371
};
1365
1372
printRelationsRec (PGD->getHigherThan (), " higherThan" );
1366
1373
printRelationsRec (PGD->getLowerThan (), " lowerThan" );
@@ -1773,7 +1780,7 @@ class PrintStmt : public StmtVisitor<PrintStmt, void, StringRef>,
1773
1780
}
1774
1781
1775
1782
printFoot ();
1776
- }, " " );
1783
+ });
1777
1784
}
1778
1785
1779
1786
printRec (S->getBody ());
@@ -1805,17 +1812,10 @@ class PrintStmt : public StmtVisitor<PrintStmt, void, StringRef>,
1805
1812
1806
1813
void visitDoCatchStmt (DoCatchStmt *S, StringRef label) {
1807
1814
printCommon (S, " do_catch_stmt" , label);
1808
- printRec (S->getBody ());
1809
- visitCatches (S->getCatches ());
1815
+ printRec (S->getBody (), " body " );
1816
+ printRecRange (S->getCatches (), Ctx, " catch_stmts " );
1810
1817
printFoot ();
1811
1818
}
1812
- void visitCatches (ArrayRef<CaseStmt *> clauses) {
1813
- for (auto clause : clauses) {
1814
- printRecRaw ([&](StringRef label) {
1815
- visitCaseStmt (clause, label);
1816
- }, " " );
1817
- }
1818
- }
1819
1819
};
1820
1820
1821
1821
} // end anonymous namespace
@@ -2049,7 +2049,7 @@ class PrintExpr : public ExprVisitor<PrintExpr, void, StringRef>,
2049
2049
printHead (" candidate_decl" , DeclModifierColor, label);
2050
2050
printNameRaw ([&](raw_ostream &OS) { D->dumpRef (OS); });
2051
2051
printFoot ();
2052
- }, " " );
2052
+ });
2053
2053
}
2054
2054
}
2055
2055
@@ -2158,7 +2158,7 @@ class PrintExpr : public ExprVisitor<PrintExpr, void, StringRef>,
2158
2158
printRecRaw ([&](StringRef label) {
2159
2159
printHead (" <tuple element default value>" , ExprColor);
2160
2160
printFoot ();
2161
- }, " " );
2161
+ });
2162
2162
}
2163
2163
}
2164
2164
@@ -2852,11 +2852,11 @@ class PrintExpr : public ExprVisitor<PrintExpr, void, StringRef>,
2852
2852
printRec (args);
2853
2853
}
2854
2854
printFoot ();
2855
- }, " " );
2855
+ });
2856
2856
}
2857
2857
2858
2858
printFoot ();
2859
- }, " " );
2859
+ });
2860
2860
2861
2861
if (auto stringLiteral = E->getObjCStringLiteralExpr ()) {
2862
2862
printRec (stringLiteral, " objc_string_literal" );
@@ -3208,7 +3208,7 @@ class PrintTypeRepr : public TypeReprVisitor<PrintTypeRepr, void, StringRef>,
3208
3208
3209
3209
printRec (Field.getFieldType ());
3210
3210
printFoot ();
3211
- }, " " );
3211
+ });
3212
3212
}
3213
3213
3214
3214
printRecRange (T->getGenericArguments (), " generic_arguments" );
@@ -3749,7 +3749,7 @@ namespace {
3749
3749
printField (elt.getName ().str (), " name" );
3750
3750
printRec (elt.getType ());
3751
3751
printFoot ();
3752
- }, " " );
3752
+ });
3753
3753
}
3754
3754
3755
3755
printFoot ();
@@ -3932,7 +3932,7 @@ namespace {
3932
3932
printRec (param.getPlainType ());
3933
3933
3934
3934
printFoot ();
3935
- }, " " );
3935
+ });
3936
3936
}
3937
3937
printFoot ();
3938
3938
}, label);
@@ -3948,7 +3948,7 @@ namespace {
3948
3948
info.dump (OS, clangCtx);
3949
3949
});
3950
3950
printFoot ();
3951
- }, " " );
3951
+ });
3952
3952
}
3953
3953
}
3954
3954
0 commit comments