From 4b279a033b901e8835d5d35d475713b7550a8a12 Mon Sep 17 00:00:00 2001 From: Peter Collingbourne Date: Tue, 8 Feb 2011 21:17:54 +0000 Subject: [PATCH] StmtPrinter: factor out arg printing code to PrintCallArgs llvm-svn: 125114 --- clang/lib/AST/StmtPrinter.cpp | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/clang/lib/AST/StmtPrinter.cpp b/clang/lib/AST/StmtPrinter.cpp index 201115c7eb96..2ed2c92750e6 100644 --- a/clang/lib/AST/StmtPrinter.cpp +++ b/clang/lib/AST/StmtPrinter.cpp @@ -65,6 +65,7 @@ namespace { void PrintRawDeclStmt(DeclStmt *S); void PrintRawIfStmt(IfStmt *If); void PrintRawCXXCatchStmt(CXXCatchStmt *Catch); + void PrintCallArgs(CallExpr *E); void PrintExpr(Expr *E) { if (E) @@ -725,9 +726,7 @@ void StmtPrinter::VisitArraySubscriptExpr(ArraySubscriptExpr *Node) { OS << "]"; } -void StmtPrinter::VisitCallExpr(CallExpr *Call) { - PrintExpr(Call->getCallee()); - OS << "("; +void StmtPrinter::PrintCallArgs(CallExpr *Call) { for (unsigned i = 0, e = Call->getNumArgs(); i != e; ++i) { if (isa(Call->getArg(i))) { // Don't print any defaulted arguments @@ -737,6 +736,12 @@ void StmtPrinter::VisitCallExpr(CallExpr *Call) { if (i) OS << ", "; PrintExpr(Call->getArg(i)); } +} + +void StmtPrinter::VisitCallExpr(CallExpr *Call) { + PrintExpr(Call->getCallee()); + OS << "("; + PrintCallArgs(Call); OS << ")"; } void StmtPrinter::VisitMemberExpr(MemberExpr *Node) {