Remove SelectorTable/SelectorInfo, simply store all selectors in the central IdentifierTable.

Rationale:

We currently have a separate table to unique ObjC selectors. Since I don't need all the instance data in IdentifierInfo, I thought this would save space (and make more sense conceptually).

It turns out the cost of having duplicate entries for unary selectors (i.e. names without colons) outweighs the cost difference between the IdentifierInfo & SelectorInfo structures. Here is the data:

Two tables:

*** Selector/Identifier Stats:
# Selectors/Identifiers: 51635 
Bytes allocated:         1999824

One table:

*** Identifier Table Stats:
# Identifiers:   49500
Bytes allocated: 1990316




git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@42139 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/AST/ASTContext.cpp b/AST/ASTContext.cpp
index df0398c..6420f0f 100644
--- a/AST/ASTContext.cpp
+++ b/AST/ASTContext.cpp
@@ -104,9 +104,6 @@
     NumFunctionP*sizeof(FunctionTypeProto)+
     NumFunctionNP*sizeof(FunctionTypeNoProto)+
     NumTypeName*sizeof(TypedefType)+NumTagged*sizeof(TagType)));
-  
-  if (Selectors)
-    Selectors->PrintStats();
 }
 
 
@@ -809,11 +806,3 @@
   
   return getTagDeclType(CFConstantStringTypeDecl);
 }
-
-SelectorInfo &ASTContext::getSelectorInfo(const char *NameStart, 
-                                          const char *NameEnd) {
-  if (!Selectors) // create the table lazily
-    Selectors = new SelectorTable();
-  return Selectors->get(NameStart, NameEnd);
-}
-
diff --git a/AST/Expr.cpp b/AST/Expr.cpp
index 08773e8..e5a1282 100644
--- a/AST/Expr.cpp
+++ b/AST/Expr.cpp
@@ -858,7 +858,7 @@
 
 // constructor for unary messages.
 ObjCMessageExpr::ObjCMessageExpr(
-  IdentifierInfo *clsName, SelectorInfo &methName, QualType retType, 
+  IdentifierInfo *clsName, IdentifierInfo &methName, QualType retType, 
   SourceLocation LBrac, SourceLocation RBrac)
   : Expr(ObjCMessageExprClass, retType), Selector(methName) {
   ClassName = clsName;
@@ -867,7 +867,7 @@
 }
 
 ObjCMessageExpr::ObjCMessageExpr(
-  Expr *fn, SelectorInfo &methName, QualType retType, 
+  Expr *fn, IdentifierInfo &methName, QualType retType, 
   SourceLocation LBrac, SourceLocation RBrac)
   : Expr(ObjCMessageExprClass, retType), Selector(methName), ClassName(0) {
   SubExprs = new Expr*[1];
@@ -878,7 +878,7 @@
 
 // constructor for keyword messages.
 ObjCMessageExpr::ObjCMessageExpr(
-  Expr *fn, SelectorInfo &selInfo, ObjcKeywordMessage *keys, unsigned numargs, 
+  Expr *fn, IdentifierInfo &selInfo, ObjcKeywordMessage *keys, unsigned numargs, 
   QualType retType, SourceLocation LBrac, SourceLocation RBrac)
   : Expr(ObjCMessageExprClass, retType), Selector(selInfo), ClassName(0) {
   SubExprs = new Expr*[numargs+1];
@@ -890,7 +890,7 @@
 }
 
 ObjCMessageExpr::ObjCMessageExpr(
-  IdentifierInfo *clsName, SelectorInfo &selInfo, ObjcKeywordMessage *keys, 
+  IdentifierInfo *clsName, IdentifierInfo &selInfo, ObjcKeywordMessage *keys, 
   unsigned numargs, QualType retType, SourceLocation LBrac, SourceLocation RBrac)
   : Expr(ObjCMessageExprClass, retType), Selector(selInfo), ClassName(clsName) {
   SubExprs = new Expr*[numargs+1];