[cfe-commits] r41948 - in /cfe/trunk: AST/ASTContext.cpp Sema/SemaDecl.cpp include/clang/AST/Decl.h

Steve Naroff snaroff at apple.com
Thu Sep 13 19:20:46 PDT 2007


Author: snaroff
Date: Thu Sep 13 21:20:46 2007
New Revision: 41948

URL: http://llvm.org/viewvc/llvm-project?rev=41948&view=rev
Log:

Now that the dust has settled on the Decl refactoring, I noticed FieldDecl didn't need NextDeclarator.  As a result, I'm removing it. 

Removing both slots (NextDeclarator/Next) end up reducing the size of fields/ivars by 40%.


Modified:
    cfe/trunk/AST/ASTContext.cpp
    cfe/trunk/Sema/SemaDecl.cpp
    cfe/trunk/include/clang/AST/Decl.h

Modified: cfe/trunk/AST/ASTContext.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/AST/ASTContext.cpp?rev=41948&r1=41947&r2=41948&view=diff

==============================================================================
--- cfe/trunk/AST/ASTContext.cpp (original)
+++ cfe/trunk/AST/ASTContext.cpp Thu Sep 13 21:20:46 2007
@@ -791,7 +791,7 @@
     FieldDecl *FieldDecls[4];
   
     for (unsigned i = 0; i < 4; ++i)
-      FieldDecls[i] = new FieldDecl(SourceLocation(), 0, FieldTypes[i], 0);
+      FieldDecls[i] = new FieldDecl(SourceLocation(), 0, FieldTypes[i]);
   
     CFConstantStringTypeDecl->defineBody(FieldDecls, 4);
   }

Modified: cfe/trunk/Sema/SemaDecl.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/Sema/SemaDecl.cpp?rev=41948&r1=41947&r2=41948&view=diff

==============================================================================
--- cfe/trunk/Sema/SemaDecl.cpp (original)
+++ cfe/trunk/Sema/SemaDecl.cpp Thu Sep 13 21:20:46 2007
@@ -1081,9 +1081,9 @@
   FieldDecl *NewFD;
   
   if (isa<RecordDecl>(static_cast<Decl *>(TagDecl)))
-    NewFD = new FieldDecl(Loc, II, T, 0);
+    NewFD = new FieldDecl(Loc, II, T);
   else if (isa<ObjcInterfaceDecl>(static_cast<Decl *>(TagDecl)))
-    NewFD = new ObjcIvarDecl(Loc, II, T, 0);
+    NewFD = new ObjcIvarDecl(Loc, II, T);
   else
     assert(0 && "Sema::ParseField(): Unknown TagDecl");
     

Modified: cfe/trunk/include/clang/AST/Decl.h
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/AST/Decl.h?rev=41948&r1=41947&r2=41948&view=diff

==============================================================================
--- cfe/trunk/include/clang/AST/Decl.h (original)
+++ cfe/trunk/include/clang/AST/Decl.h Thu Sep 13 21:20:46 2007
@@ -323,32 +323,19 @@
   
   /// Loc - The location that this decl.
   SourceLocation Loc;
-  
-  /// NextDeclarator - If this decl was part of a multi-declarator declaration,
-  /// such as "int X, Y, *Z;" this indicates Decl for the next declarator.
-  FieldDecl *NextDeclarator;
-  
+
   QualType DeclType;  
 public:
-  FieldDecl(SourceLocation L, IdentifierInfo *Id, QualType T, FieldDecl *PrevD)
-    : Decl(Field), Identifier(Id), Loc(L), NextDeclarator(PrevD), 
-      DeclType(T) {}
-  FieldDecl(Kind DK, SourceLocation L, IdentifierInfo *Id, QualType T, 
-            FieldDecl *PrevD) : Decl(DK), Identifier(Id), Loc(L), 
-            NextDeclarator(PrevD), DeclType(T) {}
+  FieldDecl(SourceLocation L, IdentifierInfo *Id, QualType T)
+    : Decl(Field), Identifier(Id), Loc(L), DeclType(T) {}
+  FieldDecl(Kind DK, SourceLocation L, IdentifierInfo *Id, QualType T) 
+    : Decl(DK), Identifier(Id), Loc(L), DeclType(T) {}
 
   IdentifierInfo *getIdentifier() const { return Identifier; }
   SourceLocation getLocation() const { return Loc; }
   void setLocation(SourceLocation L) { Loc = L; }
   const char *getName() const;
 
-  /// getNextDeclarator - If this decl was part of a multi-declarator
-  /// declaration, such as "int X, Y, *Z;" this returns the decl for the next
-  /// declarator.  Otherwise it returns null.
-  FieldDecl *getNextDeclarator() { return NextDeclarator; }
-  const FieldDecl *getNextDeclarator() const { return NextDeclarator; }
-  void setNextDeclarator(FieldDecl *N) { NextDeclarator = N; }
-
   QualType getType() const { return DeclType; }
   QualType getCanonicalType() const { return DeclType.getCanonicalType(); }
   
@@ -580,8 +567,8 @@
 
 class ObjcIvarDecl : public FieldDecl {
 public:
-  ObjcIvarDecl(SourceLocation L, IdentifierInfo *Id, QualType T,
-               FieldDecl *PrevDecl) : FieldDecl(ObjcIvar, L, Id, T, PrevDecl) {}
+  ObjcIvarDecl(SourceLocation L, IdentifierInfo *Id, QualType T) 
+    : FieldDecl(ObjcIvar, L, Id, T) {}
     
   enum AccessControl {
     None, Private, Protected, Public, Package





More information about the cfe-commits mailing list