[cfe-commits] r50583 - /cfe/trunk/lib/AST/StmtPrinter.cpp
Ted Kremenek
kremenek at apple.com
Fri May 2 10:32:38 PDT 2008
Author: kremenek
Date: Fri May 2 12:32:38 2008
New Revision: 50583
URL: http://llvm.org/viewvc/llvm-project?rev=50583&view=rev
Log:
Bug fix in StmtPrinter to handle pretty-printing ObjCMessageExprs involving variadic methods (also did some cosmetic cleanups in the printing output).
Modified:
cfe/trunk/lib/AST/StmtPrinter.cpp
Modified: cfe/trunk/lib/AST/StmtPrinter.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/AST/StmtPrinter.cpp?rev=50583&r1=50582&r2=50583&view=diff
==============================================================================
--- cfe/trunk/lib/AST/StmtPrinter.cpp (original)
+++ cfe/trunk/lib/AST/StmtPrinter.cpp Fri May 2 12:32:38 2008
@@ -822,15 +822,21 @@
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));
}
}
More information about the cfe-commits
mailing list