]> granicus.if.org Git - clang/commitdiff
Fix problem dumping/printing method names with null selector.
authorFariborz Jahanian <fjahanian@apple.com>
Tue, 16 Oct 2007 20:52:13 +0000 (20:52 +0000)
committerFariborz Jahanian <fjahanian@apple.com>
Tue, 16 Oct 2007 20:52:13 +0000 (20:52 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@43039 91177308-0d34-0410-b5e6-96231b3b80d8

AST/StmtDumper.cpp
AST/StmtPrinter.cpp
Parse/ParseObjc.cpp

index bd5c615321a13d0aa6e74577551118cc6891285a..c2a93a6f0f1068cfbee0cbac381a68532fb7dd1e 100644 (file)
@@ -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, ":");
   }
 }
 
index 783368ef775609b735e9c35dc9b55c86881430ac..2db46f4e0cb2a695a92afc69211e3f98e593ca17 100644 (file)
@@ -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));
     }
   }
index 274725417161d5ee208572af27b4d46cec68f152..5412a6f570b6ad684cdf4a29170a68a7d0a00a5a 100644 (file)
@@ -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;