@@ -428,8 +428,8 @@ namespace {
428
428
}
429
429
430
430
void printRec (Decl *D) { D->dump (OS, Indent + 2 ); }
431
- void printRec (Expr *E) { E->print (OS, Indent + 2 ); }
432
- void printRec (Stmt *S, const ASTContext &Ctx) { S->print (OS, &Ctx, Indent + 2 ); }
431
+ void printRec (Expr *E) { E->dump (OS, Indent + 2 ); }
432
+ void printRec (Stmt *S, const ASTContext &Ctx) { S->dump (OS, &Ctx, Indent + 2 ); }
433
433
void printRec (TypeRepr *T);
434
434
void printRec (const Pattern *P) {
435
435
PrintPattern (OS, Indent+2 ).visit (const_cast <Pattern *>(P));
@@ -556,8 +556,8 @@ namespace {
556
556
}
557
557
558
558
void printRec (Decl *D) { PrintDecl (OS, Indent + 2 ).visit (D); }
559
- void printRec (Expr *E) { E->print (OS, Indent+2 ); }
560
- void printRec (Stmt *S, const ASTContext &Ctx) { S->print (OS, &Ctx, Indent+2 ); }
559
+ void printRec (Expr *E) { E->dump (OS, Indent+2 ); }
560
+ void printRec (Stmt *S, const ASTContext &Ctx) { S->dump (OS, &Ctx, Indent+2 ); }
561
561
void printRec (Pattern *P) { PrintPattern (OS, Indent+2 ).visit (P); }
562
562
void printRec (TypeRepr *T);
563
563
@@ -1385,7 +1385,7 @@ void Pattern::dump() const {
1385
1385
// ===----------------------------------------------------------------------===//
1386
1386
1387
1387
namespace {
1388
- // / PrintStmt - Visitor implementation of Expr::print .
1388
+ // / PrintStmt - Visitor implementation of Stmt::dump .
1389
1389
class PrintStmt : public StmtVisitor <PrintStmt> {
1390
1390
public:
1391
1391
raw_ostream &OS;
@@ -1406,7 +1406,7 @@ class PrintStmt : public StmtVisitor<PrintStmt> {
1406
1406
}
1407
1407
1408
1408
void printRec (Decl *D) { D->dump (OS, Indent + 2 ); }
1409
- void printRec (Expr *E) { E->print (OS, Indent + 2 ); }
1409
+ void printRec (Expr *E) { E->dump (OS, Indent + 2 ); }
1410
1410
void printRec (const Pattern *P) {
1411
1411
PrintPattern (OS, Indent+2 ).visit (const_cast <Pattern *>(P));
1412
1412
}
@@ -1630,7 +1630,7 @@ class PrintStmt : public StmtVisitor<PrintStmt> {
1630
1630
}
1631
1631
if (auto *Guard = LabelItem.getGuardExpr ()) {
1632
1632
OS << ' \n ' ;
1633
- Guard->print (OS, Indent+4 );
1633
+ Guard->dump (OS, Indent+4 );
1634
1634
}
1635
1635
PrintWithColorRAII (OS, ParenthesisColor) << ' )' ;
1636
1636
}
@@ -1679,11 +1679,11 @@ class PrintStmt : public StmtVisitor<PrintStmt> {
1679
1679
} // end anonymous namespace
1680
1680
1681
1681
void Stmt::dump () const {
1682
- print (llvm::errs ());
1682
+ dump (llvm::errs ());
1683
1683
llvm::errs () << ' \n ' ;
1684
1684
}
1685
1685
1686
- void Stmt::print (raw_ostream &OS, const ASTContext *Ctx, unsigned Indent) const {
1686
+ void Stmt::dump (raw_ostream &OS, const ASTContext *Ctx, unsigned Indent) const {
1687
1687
PrintStmt (OS, Ctx, Indent).visit (const_cast <Stmt*>(this ));
1688
1688
}
1689
1689
@@ -1692,7 +1692,7 @@ void Stmt::print(raw_ostream &OS, const ASTContext *Ctx, unsigned Indent) const
1692
1692
// ===----------------------------------------------------------------------===//
1693
1693
1694
1694
namespace {
1695
- // / PrintExpr - Visitor implementation of Expr::print .
1695
+ // / PrintExpr - Visitor implementation of Expr::dump .
1696
1696
class PrintExpr : public ExprVisitor <PrintExpr> {
1697
1697
public:
1698
1698
raw_ostream &OS;
@@ -1730,7 +1730,7 @@ class PrintExpr : public ExprVisitor<PrintExpr> {
1730
1730
// / FIXME: This should use ExprWalker to print children.
1731
1731
1732
1732
void printRec (Decl *D) { D->dump (OS, Indent + 2 ); }
1733
- void printRec (Stmt *S, const ASTContext &Ctx) { S->print (OS, &Ctx, Indent + 2 ); }
1733
+ void printRec (Stmt *S, const ASTContext &Ctx) { S->dump (OS, &Ctx, Indent + 2 ); }
1734
1734
void printRec (const Pattern *P) {
1735
1735
PrintPattern (OS, Indent+2 ).visit (const_cast <Pattern *>(P));
1736
1736
}
@@ -2594,7 +2594,7 @@ class PrintExpr : public ExprVisitor<PrintExpr> {
2594
2594
OS << " subscript " ;
2595
2595
printDeclRef (component.getDeclRef ());
2596
2596
OS << ' \n ' ;
2597
- component.getIndexExpr ()->print (OS, Indent + 4 );
2597
+ component.getIndexExpr ()->dump (OS, Indent + 4 );
2598
2598
OS.indent (Indent + 4 );
2599
2599
break ;
2600
2600
@@ -2607,7 +2607,7 @@ class PrintExpr : public ExprVisitor<PrintExpr> {
2607
2607
case KeyPathExpr::Component::Kind::UnresolvedSubscript:
2608
2608
OS << " unresolved_subscript" ;
2609
2609
OS << ' \n ' ;
2610
- component.getIndexExpr ()->print (OS, Indent + 4 );
2610
+ component.getIndexExpr ()->dump (OS, Indent + 4 );
2611
2611
OS.indent (Indent + 4 );
2612
2612
break ;
2613
2613
case KeyPathExpr::Component::Kind::Identity:
@@ -2648,61 +2648,32 @@ class PrintExpr : public ExprVisitor<PrintExpr> {
2648
2648
2649
2649
} // end anonymous namespace
2650
2650
2651
- void Expr::dump (
2652
- raw_ostream &OS, llvm::function_ref<Type(const Expr *)> getTypeOfExpr,
2653
- llvm::function_ref<Type(const TypeLoc &)> getTypeOfTypeLoc) const {
2654
- if (auto ty = getTypeOfExpr (this )) {
2655
- llvm::SaveAndRestore<bool > X (
2656
- ty->getASTContext ().LangOpts .DebugConstraintSolver , true );
2657
- print (OS, getTypeOfExpr, getTypeOfTypeLoc);
2658
- } else {
2659
- print (OS, getTypeOfExpr, getTypeOfTypeLoc);
2660
- }
2661
- OS << ' \n ' ;
2662
- }
2663
-
2664
- void Expr::dump (raw_ostream &OS) const {
2665
- if (auto ty = getType ()) {
2666
- llvm::SaveAndRestore<bool > X (ty->getASTContext ().LangOpts .
2667
- DebugConstraintSolver, true );
2668
- print (OS);
2669
- } else {
2670
- print (OS);
2671
- }
2672
- OS << ' \n ' ;
2673
- }
2674
-
2675
2651
void Expr::dump () const {
2676
2652
dump (llvm::errs ());
2653
+ llvm::errs () << " \n " ;
2677
2654
}
2678
2655
2679
- void Expr::dump (
2680
- llvm::function_ref<Type(const Expr *)> getTypeOfExpr,
2681
- llvm::function_ref<Type(const TypeLoc &)> getTypeOfTypeLoc) const {
2682
- dump (llvm::errs (), getTypeOfExpr, getTypeOfTypeLoc);
2683
- }
2684
-
2685
- void Expr::print (raw_ostream &OS,
2656
+ void Expr::dump (raw_ostream &OS,
2686
2657
llvm::function_ref<Type(const Expr *)> getTypeOfExpr,
2687
2658
llvm::function_ref<Type(const TypeLoc &)> getTypeOfTypeLoc,
2688
2659
unsigned Indent) const {
2689
2660
PrintExpr (OS, getTypeOfExpr, getTypeOfTypeLoc, Indent)
2690
2661
.visit (const_cast <Expr *>(this ));
2691
2662
}
2692
2663
2693
- void Expr::print (raw_ostream &OS, unsigned Indent) const {
2664
+ void Expr::dump (raw_ostream &OS, unsigned Indent) const {
2694
2665
auto getTypeOfExpr = [](const Expr *E) -> Type { return E->getType (); };
2695
2666
auto getTypeOfTypeLoc = [](const TypeLoc &TL) -> Type {
2696
2667
return TL.getType ();
2697
2668
};
2698
- print (OS, getTypeOfExpr, getTypeOfTypeLoc, Indent);
2669
+ dump (OS, getTypeOfExpr, getTypeOfTypeLoc, Indent);
2699
2670
}
2700
2671
2701
2672
void Expr::print (ASTPrinter &Printer, const PrintOptions &Opts) const {
2702
2673
// FIXME: Fully use the ASTPrinter.
2703
2674
llvm::SmallString<128 > Str;
2704
2675
llvm::raw_svector_ostream OS (Str);
2705
- print (OS);
2676
+ dump (OS);
2706
2677
Printer << OS.str ();
2707
2678
}
2708
2679
@@ -2724,7 +2695,7 @@ class PrintTypeRepr : public TypeReprVisitor<PrintTypeRepr> {
2724
2695
}
2725
2696
2726
2697
void printRec (Decl *D) { D->dump (OS, Indent + 2 ); }
2727
- void printRec (Expr *E) { E->print (OS, Indent + 2 ); }
2698
+ void printRec (Expr *E) { E->dump (OS, Indent + 2 ); }
2728
2699
void printRec (TypeRepr *T) { PrintTypeRepr (OS, Indent + 2 ).visit (T); }
2729
2700
2730
2701
raw_ostream &printCommon (const char *Name) {
0 commit comments