aboutsummaryrefslogtreecommitdiff
path: root/lib/AST/Decl.cpp
diff options
context:
space:
mode:
authorSteve Naroff <snaroff@apple.com>2008-04-15 22:42:06 +0000
committerSteve Naroff <snaroff@apple.com>2008-04-15 22:42:06 +0000
commit248a753f6b670692523c99afaeb8fe98f7ae3ca7 (patch)
treef51ae4f62f1bdefaf28f672616ec7eaf4ff67f9a /lib/AST/Decl.cpp
parent4b0f81323b518429203051bbcd4864bbf4b000a9 (diff)
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
Diffstat (limited to 'lib/AST/Decl.cpp')
-rw-r--r--lib/AST/Decl.cpp47
1 files changed, 16 insertions, 31 deletions
diff --git a/lib/AST/Decl.cpp b/lib/AST/Decl.cpp
index ac1a593e6f..cee7ddad02 100644
--- a/lib/AST/Decl.cpp
+++ b/lib/AST/Decl.cpp
@@ -24,8 +24,7 @@ using namespace clang;
// 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 @@ const char *Decl::getDeclKindName() const {
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 @@ bool Decl::CollectingStats(bool Enable) {
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 @@ void Decl::PrintStats() {
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 @@ void Decl::addDeclKind(Kind k) {
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 @@ void Decl::addDeclKind(Kind k) {
// 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 @@ void Decl::Destroy(ASTContext& C) const {
CASE(Enum);
CASE(EnumConstant);
CASE(Function);
- CASE(BlockVar);
- CASE(FileVar);
+ CASE(Var);
CASE(ParmVar);
CASE(ObjCInterface);
CASE(ObjCCompatibleAlias);