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%.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@41948 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/AST/ASTContext.cpp b/AST/ASTContext.cpp
index da07fbd..87f68fe 100644
--- a/AST/ASTContext.cpp
+++ b/AST/ASTContext.cpp
@@ -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);
}
diff --git a/Sema/SemaDecl.cpp b/Sema/SemaDecl.cpp
index 1a808f8..9300b9c 100644
--- a/Sema/SemaDecl.cpp
+++ b/Sema/SemaDecl.cpp
@@ -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");
diff --git a/include/clang/AST/Decl.h b/include/clang/AST/Decl.h
index a3096a4..2431597 100644
--- a/include/clang/AST/Decl.h
+++ b/include/clang/AST/Decl.h
@@ -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