aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorFariborz Jahanian <fjahanian@apple.com>2007-10-16 20:52:13 +0000
committerFariborz Jahanian <fjahanian@apple.com>2007-10-16 20:52:13 +0000
commitf24d95acc1201c04b57981eb5dbada4004466881 (patch)
tree049e44cba3452a08525d549c7a691d0a9ad155f3
parentb62f6813406a03bf8a371c4e46c9fad51d102121 (diff)
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
-rw-r--r--AST/StmtDumper.cpp5
-rw-r--r--AST/StmtPrinter.cpp10
-rw-r--r--Parse/ParseObjc.cpp4
3 files changed, 12 insertions, 7 deletions
diff --git a/AST/StmtDumper.cpp b/AST/StmtDumper.cpp
index bd5c615321..c2a93a6f0f 100644
--- a/AST/StmtDumper.cpp
+++ b/AST/StmtDumper.cpp
@@ -416,7 +416,10 @@ void StmtDumper::VisitObjCSelectorExpr(ObjCSelectorExpr *Node) {
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 783368ef77..2db46f4e0c 100644
--- a/AST/StmtPrinter.cpp
+++ b/AST/StmtPrinter.cpp
@@ -627,7 +627,10 @@ void StmtPrinter::VisitObjCSelectorExpr(ObjCSelectorExpr *Node) {
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 @@ void StmtPrinter::VisitObjCMessageExpr(ObjCMessageExpr *Mess) {
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));
}
}
diff --git a/Parse/ParseObjc.cpp b/Parse/ParseObjc.cpp
index 2747254171..5412a6f570 100644
--- a/Parse/ParseObjc.cpp
+++ b/Parse/ParseObjc.cpp
@@ -1327,8 +1327,6 @@ Parser::ExprResult Parser::ParseObjCSelectorExpression()
Diag(Tok, diag::err_expected_ident); // missing selector name.
return 0;
}
- if (!SelIdent)
- SelIdent = &PP.getIdentifierTable().get("");
KeyIdents.push_back(SelIdent);
if (Tok.isNot(tok::r_paren))
while (1) {
@@ -1342,8 +1340,6 @@ Parser::ExprResult Parser::ParseObjCSelectorExpression()
// Check for another keyword selector.
SourceLocation Loc;
SelIdent = ParseObjCSelector(Loc);
- if (!SelIdent)
- SelIdent = &PP.getIdentifierTable().get("");
KeyIdents.push_back(SelIdent);
if (!SelIdent && Tok.isNot(tok::colon))
break;