Remove FileVarDecl and BlockVarDecl. They are replaced by VarDecl::isBlockVarDecl() and VarDecl::isFileVarDecl().

This is a fairly mechanical/large change. As a result, I avoided making any changes/simplifications that weren't directly related. I did break two Analysis tests. I also have a couple FIXME's in UninitializedValues.cpp. Ted, can you take a look? If the bug isn't obvious, I am happy to dig in and fix it (since I broke it).


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@49748 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/lib/AST/Decl.cpp b/lib/AST/Decl.cpp
index ac1a593..cee7dda 100644
--- a/lib/AST/Decl.cpp
+++ b/lib/AST/Decl.cpp
@@ -24,8 +24,7 @@
 
 // temporary statistics gathering
 static unsigned nFuncs = 0;
-static unsigned nBlockVars = 0;
-static unsigned nFileVars = 0;
+static unsigned nVars = 0;
 static unsigned nParmVars = 0;
 static unsigned nSUC = 0;
 static unsigned nEnumConst = 0;
@@ -59,8 +58,7 @@
   default: assert(0 && "Unknown decl kind!");
   case Typedef:             return "Typedef";
   case Function:            return "Function";
-  case BlockVar:            return "BlockVar";
-  case FileVar:             return "FileVar";
+  case Var:                 return "Var";
   case ParmVar:             return "ParmVar";
   case EnumConstant:        return "EnumConstant";
   case ObjCInterface:       return "ObjCInterface";
@@ -84,17 +82,14 @@
 void Decl::PrintStats() {
   fprintf(stderr, "*** Decl Stats:\n");
   fprintf(stderr, "  %d decls total.\n", 
-          int(nFuncs+nBlockVars+nFileVars+nParmVars+nFieldDecls+nSUC+
+          int(nFuncs+nVars+nParmVars+nFieldDecls+nSUC+
               nEnumDecls+nEnumConst+nTypedef+nInterfaceDecls+nClassDecls+
               nMethodDecls+nProtocolDecls+nCategoryDecls+nIvarDecls));
   fprintf(stderr, "    %d function decls, %d each (%d bytes)\n", 
           nFuncs, (int)sizeof(FunctionDecl), int(nFuncs*sizeof(FunctionDecl)));
-  fprintf(stderr, "    %d block variable decls, %d each (%d bytes)\n", 
-          nBlockVars, (int)sizeof(BlockVarDecl), 
-          int(nBlockVars*sizeof(BlockVarDecl)));
-  fprintf(stderr, "    %d file variable decls, %d each (%d bytes)\n", 
-          nFileVars, (int)sizeof(FileVarDecl), 
-          int(nFileVars*sizeof(FileVarDecl)));
+  fprintf(stderr, "    %d variable decls, %d each (%d bytes)\n", 
+          nVars, (int)sizeof(VarDecl), 
+          int(nVars*sizeof(VarDecl)));
   fprintf(stderr, "    %d parameter variable decls, %d each (%d bytes)\n", 
           nParmVars, (int)sizeof(ParmVarDecl),
           int(nParmVars*sizeof(ParmVarDecl)));
@@ -152,8 +147,8 @@
           int(nObjCPropertyDecl*sizeof(ObjCPropertyDecl)));
   
   fprintf(stderr, "Total bytes = %d\n", 
-          int(nFuncs*sizeof(FunctionDecl)+nBlockVars*sizeof(BlockVarDecl)+
-              nFileVars*sizeof(FileVarDecl)+nParmVars*sizeof(ParmVarDecl)+
+          int(nFuncs*sizeof(FunctionDecl)+
+              nVars*sizeof(VarDecl)+nParmVars*sizeof(ParmVarDecl)+
               nFieldDecls*sizeof(FieldDecl)+nSUC*sizeof(RecordDecl)+
               nEnumDecls*sizeof(EnumDecl)+nEnumConst*sizeof(EnumConstantDecl)+
               nTypedef*sizeof(TypedefDecl)+
@@ -177,8 +172,7 @@
   switch (k) {
   case Typedef:             nTypedef++; break;
   case Function:            nFuncs++; break;
-  case BlockVar:            nBlockVars++; break;
-  case FileVar:             nFileVars++; break;
+  case Var:                 nVars++; break;
   case ParmVar:             nParmVars++; break;
   case EnumConstant:        nEnumConst++; break;
   case Field:               nFieldDecls++; break;
@@ -204,23 +198,15 @@
 // Decl Allocation/Deallocation Method Implementations
 //===----------------------------------------------------------------------===//
 
-BlockVarDecl *BlockVarDecl::Create(ASTContext &C, DeclContext *CD,
-                                   SourceLocation L,
-                                   IdentifierInfo *Id, QualType T,
-                                   StorageClass S, ScopedDecl *PrevDecl) {
-  void *Mem = C.getAllocator().Allocate<BlockVarDecl>();
-  return new (Mem) BlockVarDecl(CD, L, Id, T, S, PrevDecl);
+VarDecl *VarDecl::Create(ASTContext &C, DeclContext *CD,
+                         SourceLocation L,
+                         IdentifierInfo *Id, QualType T,
+                         StorageClass S, ScopedDecl *PrevDecl) {
+  void *Mem = C.getAllocator().Allocate<VarDecl>();
+  return new (Mem) VarDecl(Var, CD, L, Id, T, S, PrevDecl);
 }
 
 
-FileVarDecl *FileVarDecl::Create(ASTContext &C, DeclContext *CD,
-                                 SourceLocation L, IdentifierInfo *Id,
-                                 QualType T, StorageClass S,
-                                 ScopedDecl *PrevDecl) {
-  void *Mem = C.getAllocator().Allocate<FileVarDecl>();
-  return new (Mem) FileVarDecl(CD, L, Id, T, S, PrevDecl);
-}
-
 ParmVarDecl *ParmVarDecl::Create(ASTContext &C, DeclContext *CD,
                                  SourceLocation L, IdentifierInfo *Id,
                                  QualType T, StorageClass S,
@@ -347,8 +333,7 @@
   CASE(Enum);
   CASE(EnumConstant);
   CASE(Function);
-  CASE(BlockVar);
-  CASE(FileVar);
+  CASE(Var);
   CASE(ParmVar);
   CASE(ObjCInterface);
   CASE(ObjCCompatibleAlias);