summaryrefslogtreecommitdiffstats
path: root/clang/lib/AST/ASTContext.cpp
diff options
context:
space:
mode:
authorTed Kremenek <kremenek@apple.com>2010-01-21 19:22:34 +0000
committerTed Kremenek <kremenek@apple.com>2010-01-21 19:22:34 +0000
commit819e87379129179b8fef072f81a49cbc752ee58a (patch)
treefa287c6e9ed882828d4fa97da798fa191e9db238 /clang/lib/AST/ASTContext.cpp
parent2067816b3ad167a9a6003f9447f9a86a24596739 (diff)
downloadbcm5719-llvm-819e87379129179b8fef072f81a49cbc752ee58a.tar.gz
bcm5719-llvm-819e87379129179b8fef072f81a49cbc752ee58a.zip
Allocate the 'Protocols' array in ObjCInterfaceType and
ObjCObjectPointerType using the allocator associated with ASTContext. Not only does this fix a memory leak, but it also makes these arrays BumpPtrAllocated (in the typical case). llvm-svn: 94090
Diffstat (limited to 'clang/lib/AST/ASTContext.cpp')
-rw-r--r--clang/lib/AST/ASTContext.cpp5
1 files changed, 3 insertions, 2 deletions
diff --git a/clang/lib/AST/ASTContext.cpp b/clang/lib/AST/ASTContext.cpp
index f8fc626457a..c1bc70989d4 100644
--- a/clang/lib/AST/ASTContext.cpp
+++ b/clang/lib/AST/ASTContext.cpp
@@ -2127,7 +2127,8 @@ QualType ASTContext::getObjCObjectPointerType(QualType InterfaceT,
// No Match;
ObjCObjectPointerType *QType = new (*this, TypeAlignment)
- ObjCObjectPointerType(Canonical, InterfaceT, Protocols, NumProtocols);
+ ObjCObjectPointerType(*this, Canonical, InterfaceT, Protocols,
+ NumProtocols);
Types.push_back(QType);
ObjCObjectPointerTypes.InsertNode(QType, InsertPos);
@@ -2161,7 +2162,7 @@ QualType ASTContext::getObjCInterfaceType(const ObjCInterfaceDecl *Decl,
}
ObjCInterfaceType *QType = new (*this, TypeAlignment)
- ObjCInterfaceType(Canonical, const_cast<ObjCInterfaceDecl*>(Decl),
+ ObjCInterfaceType(*this, Canonical, const_cast<ObjCInterfaceDecl*>(Decl),
Protocols, NumProtocols);
Types.push_back(QType);
OpenPOWER on IntegriCloud