diff options
author | Ted Kremenek <kremenek@apple.com> | 2008-05-02 17:32:38 +0000 |
---|---|---|
committer | Ted Kremenek <kremenek@apple.com> | 2008-05-02 17:32:38 +0000 |
commit | c29efd829a638fff380284f43c79355b98e2a2ab (patch) | |
tree | 61537ab9d23a71a5c1a1b22a837e536a406a858d | |
parent | 623f83fb713886fa01c2a9b12de2f85c3c0e5b82 (diff) |
Bug fix in StmtPrinter to handle pretty-printing ObjCMessageExprs involving variadic methods (also did some cosmetic cleanups in the printing output).
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@50583 91177308-0d34-0410-b5e6-96231b3b80d8
-rw-r--r-- | lib/AST/StmtPrinter.cpp | 16 |
1 files changed, 11 insertions, 5 deletions
diff --git a/lib/AST/StmtPrinter.cpp b/lib/AST/StmtPrinter.cpp index f838633171..bd6d0d44bf 100644 --- a/lib/AST/StmtPrinter.cpp +++ b/lib/AST/StmtPrinter.cpp @@ -822,15 +822,21 @@ void StmtPrinter::VisitObjCMessageExpr(ObjCMessageExpr *Mess) { Expr *receiver = Mess->getReceiver(); if (receiver) PrintExpr(receiver); else OS << Mess->getClassName()->getName(); + OS << ' '; Selector selector = Mess->getSelector(); if (selector.isUnarySelector()) { - OS << " " << selector.getIdentifierInfoForSlot(0)->getName(); + OS << selector.getIdentifierInfoForSlot(0)->getName(); } else { for (unsigned i = 0, e = Mess->getNumArgs(); i != e; ++i) { - if (selector.getIdentifierInfoForSlot(i)) - OS << selector.getIdentifierInfoForSlot(i)->getName() << ":"; - else - OS << ":"; + if (i < selector.getNumArgs()) { + if (i > 0) OS << ' '; + if (selector.getIdentifierInfoForSlot(i)) + OS << selector.getIdentifierInfoForSlot(i)->getName() << ":"; + else + OS << ":"; + } + else OS << ", "; // Handle variadic methods. + PrintExpr(Mess->getArg(i)); } } |