[cfe-commits] r55170 - /cfe/trunk/Driver/ASTConsumers.cpp
Chris Lattner
sabre at nondot.org
Thu Aug 21 23:59:16 PDT 2008
Author: lattner
Date: Fri Aug 22 01:59:15 2008
New Revision: 55170
URL: http://llvm.org/viewvc/llvm-project?rev=55170&view=rev
Log:
improve pretty printing of objc method declaration,
patch contributed by Benjamin Stiglitz!
Modified:
cfe/trunk/Driver/ASTConsumers.cpp
Modified: cfe/trunk/Driver/ASTConsumers.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/Driver/ASTConsumers.cpp?rev=55170&r1=55169&r2=55170&view=diff
==============================================================================
--- cfe/trunk/Driver/ASTConsumers.cpp (original)
+++ cfe/trunk/Driver/ASTConsumers.cpp Fri Aug 22 01:59:15 2008
@@ -193,15 +193,26 @@
else
Out << "\n+ ";
if (!OMD->getResultType().isNull())
- Out << '(' << OMD->getResultType().getAsString() << ") ";
- // FIXME: just print original selector name!
- Out << OMD->getSelector().getName();
+ Out << '(' << OMD->getResultType().getAsString() << ")";
+ std::string name = OMD->getSelector().getName();
+ std::string::size_type pos, lastPos = 0;
for (unsigned i = 0, e = OMD->getNumParams(); i != e; ++i) {
ParmVarDecl *PDecl = OMD->getParamDecl(i);
// FIXME: selector is missing here!
- Out << " :(" << PDecl->getType().getAsString() << ") " << PDecl->getName();
+ pos = name.find_first_of(":", lastPos);
+ Out << " " << name.substr(lastPos, pos - lastPos);
+ Out << ":(" << PDecl->getType().getAsString() << ")" << PDecl->getName();
+ lastPos = pos + 1;
}
+
+ if (OMD->getNumParams() == 0)
+ Out << " " << name;
+
+ if (OMD->isVariadic())
+ Out << ", ...";
+
+ Out << ";";
}
void DeclPrinter::PrintObjCImplementationDecl(ObjCImplementationDecl *OID) {
More information about the cfe-commits
mailing list