Fix problem dumping/printing method names with null selector.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@43039 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/AST/StmtDumper.cpp b/AST/StmtDumper.cpp
index bd5c615..c2a93a6 100644
--- a/AST/StmtDumper.cpp
+++ b/AST/StmtDumper.cpp
@@ -416,7 +416,10 @@
fprintf(F, "%s", selector.getIdentifierInfoForSlot(0)->getName());
else {
for (unsigned i = 0, e = Node->getNumArgs(); i != e; ++i)
- fprintf(F, "%s:", selector.getIdentifierInfoForSlot(i)->getName());
+ if (selector.getIdentifierInfoForSlot(i))
+ fprintf(F, "%s:", selector.getIdentifierInfoForSlot(i)->getName());
+ else
+ fprintf(F, ":");
}
}
diff --git a/AST/StmtPrinter.cpp b/AST/StmtPrinter.cpp
index 783368e..2db46f4 100644
--- a/AST/StmtPrinter.cpp
+++ b/AST/StmtPrinter.cpp
@@ -627,7 +627,10 @@
OS << " " << selector.getIdentifierInfoForSlot(0)->getName();
else {
for (unsigned i = 0, e = Node->getNumArgs(); i != e; ++i)
- OS << selector.getIdentifierInfoForSlot(i)->getName() << ":";
+ if (selector.getIdentifierInfoForSlot(i))
+ OS << selector.getIdentifierInfoForSlot(i)->getName() << ":";
+ else
+ OS << ":";
}
OS << ")";
}
@@ -642,7 +645,10 @@
OS << " " << selector.getIdentifierInfoForSlot(0)->getName();
} else {
for (unsigned i = 0, e = Mess->getNumArgs(); i != e; ++i) {
- OS << " " << selector.getIdentifierInfoForSlot(i)->getName() << ":";
+ if (selector.getIdentifierInfoForSlot(i))
+ OS << selector.getIdentifierInfoForSlot(i)->getName() << ":";
+ else
+ OS << ":";
PrintExpr(Mess->getArg(i));
}
}