summaryrefslogtreecommitdiffstats
path: root/clang/lib/AST/ASTContext.cpp
diff options
context:
space:
mode:
authorDouglas Gregor <dgregor@apple.com>2010-02-08 22:59:26 +0000
committerDouglas Gregor <dgregor@apple.com>2010-02-08 22:59:26 +0000
commitf85bee621b1c118bbd693d7b4277f2f490a78ec1 (patch)
tree8efa6f3eacdee00b7234be01940c2e453b2900ef /clang/lib/AST/ASTContext.cpp
parent3d33fab7fc3d7d30631bca3376a8c2d6f598110e (diff)
downloadbcm5719-llvm-f85bee621b1c118bbd693d7b4277f2f490a78ec1.tar.gz
bcm5719-llvm-f85bee621b1c118bbd693d7b4277f2f490a78ec1.zip
Eliminate a pointer of storage in each ObjCInterfaceType and
ObjCObjectPointerType AST node by allocating the list of protocols after the type node itself. No functionality change. llvm-svn: 95597
Diffstat (limited to 'clang/lib/AST/ASTContext.cpp')
-rw-r--r--clang/lib/AST/ASTContext.cpp22
1 files changed, 15 insertions, 7 deletions
diff --git a/clang/lib/AST/ASTContext.cpp b/clang/lib/AST/ASTContext.cpp
index 386a5f3c7bd..c9d85c84f96 100644
--- a/clang/lib/AST/ASTContext.cpp
+++ b/clang/lib/AST/ASTContext.cpp
@@ -2163,10 +2163,14 @@ QualType ASTContext::getObjCObjectPointerType(QualType InterfaceT,
ObjCObjectPointerTypes.FindNodeOrInsertPos(ID, InsertPos);
}
- // No Match;
- ObjCObjectPointerType *QType = new (*this, TypeAlignment)
- ObjCObjectPointerType(*this, Canonical, InterfaceT, Protocols,
- NumProtocols);
+ // No match.
+ unsigned Size = sizeof(ObjCObjectPointerType)
+ + NumProtocols * sizeof(ObjCProtocolDecl *);
+ void *Mem = Allocate(Size, TypeAlignment);
+ ObjCObjectPointerType *QType = new (Mem) ObjCObjectPointerType(Canonical,
+ InterfaceT,
+ Protocols,
+ NumProtocols);
Types.push_back(QType);
ObjCObjectPointerTypes.InsertNode(QType, InsertPos);
@@ -2199,9 +2203,13 @@ QualType ASTContext::getObjCInterfaceType(const ObjCInterfaceDecl *Decl,
ObjCInterfaceTypes.FindNodeOrInsertPos(ID, InsertPos);
}
- ObjCInterfaceType *QType = new (*this, TypeAlignment)
- ObjCInterfaceType(*this, Canonical, const_cast<ObjCInterfaceDecl*>(Decl),
- Protocols, NumProtocols);
+ unsigned Size = sizeof(ObjCInterfaceType)
+ + NumProtocols * sizeof(ObjCProtocolDecl *);
+ void *Mem = Allocate(Size, TypeAlignment);
+ ObjCInterfaceType *QType = new (Mem) ObjCInterfaceType(Canonical,
+ const_cast<ObjCInterfaceDecl*>(Decl),
+ Protocols,
+ NumProtocols);
Types.push_back(QType);
ObjCInterfaceTypes.InsertNode(QType, InsertPos);
OpenPOWER on IntegriCloud