]> granicus.if.org Git - clang/commitdiff
Now that the dust has settled on the Decl refactoring, I noticed FieldDecl didn't...
authorSteve Naroff <snaroff@apple.com>
Fri, 14 Sep 2007 02:20:46 +0000 (02:20 +0000)
committerSteve Naroff <snaroff@apple.com>
Fri, 14 Sep 2007 02:20:46 +0000 (02:20 +0000)
Removing both slots (NextDeclarator/Next) end up reducing the size of fields/ivars by 40%.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@41948 91177308-0d34-0410-b5e6-96231b3b80d8

AST/ASTContext.cpp
Sema/SemaDecl.cpp
include/clang/AST/Decl.h

index da07fbd61bd0bb32665ea92f1c1ce5359c8e692c..87f68fed247477b97bb02bb1248f7b3a29d5bf0c 100644 (file)
@@ -791,7 +791,7 @@ QualType ASTContext::getCFConstantStringType() {
     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);
   }
index 1a808f87b4c27810b7a273051edf7a0dea8dee50..9300b9cd813fe697ef0f900f02b35b113cf90394 100644 (file)
@@ -1081,9 +1081,9 @@ Sema::DeclTy *Sema::ParseField(Scope *S, DeclTy *TagDecl,
   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");
     
index a3096a423341c8583a6cb7e5436593b03c0973bf..2431597e825671ddf3b8236d82b08e1bcfeb8b19 100644 (file)
@@ -323,32 +323,19 @@ class FieldDecl : public Decl {
   
   /// 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 @@ public:
 
 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