diff options
author | Argyrios Kyrtzidis <akyrtzi@gmail.com> | 2010-08-28 09:06:06 +0000 |
---|---|---|
committer | Argyrios Kyrtzidis <akyrtzi@gmail.com> | 2010-08-28 09:06:06 +0000 |
commit | 43b205796f4ab57d6175e858f4508f15ee4fcba2 (patch) | |
tree | a16ebcaa61ddf49cebfe0dcfbbecf727211f9301 /clang/lib/Sema/SemaDecl.cpp | |
parent | 1177ff17404eb88809d8b396922b3b4a7832a6d7 (diff) | |
download | bcm5719-llvm-43b205796f4ab57d6175e858f4508f15ee4fcba2.tar.gz bcm5719-llvm-43b205796f4ab57d6175e858f4508f15ee4fcba2.zip |
Fix the memory leak of FloatingLiteral/IntegerLiteral.
For large floats/integers, APFloat/APInt will allocate memory from the heap to represent these numbers.
Unfortunately, when we use a BumpPtrAllocator to allocate IntegerLiteral/FloatingLiteral nodes the memory associated with
the APFloat/APInt values will never get freed.
I introduce the class 'APNumericStorage' which uses ASTContext's allocator for memory allocation and is used internally by FloatingLiteral/IntegerLiteral.
Fixes rdar://7637185
llvm-svn: 112361
Diffstat (limited to 'clang/lib/Sema/SemaDecl.cpp')
-rw-r--r-- | clang/lib/Sema/SemaDecl.cpp | 3 |
1 files changed, 1 insertions, 2 deletions
diff --git a/clang/lib/Sema/SemaDecl.cpp b/clang/lib/Sema/SemaDecl.cpp index 26d49419174..6f8d9a92797 100644 --- a/clang/lib/Sema/SemaDecl.cpp +++ b/clang/lib/Sema/SemaDecl.cpp @@ -6480,8 +6480,7 @@ void Sema::ActOnLastBitfield(SourceLocation DeclLoc, Decl *EnclosingDecl, } // All conditions are met. Add a new bitfield to the tail end of ivars. llvm::APInt Zero(Context.getTypeSize(Context.CharTy), 0); - Expr * BW = - new (Context) IntegerLiteral(Zero, Context.CharTy, DeclLoc); + Expr * BW = IntegerLiteral::Create(Context, Zero, Context.CharTy, DeclLoc); Ivar = ObjCIvarDecl::Create(Context, cast<ObjCContainerDecl>(EnclosingDecl), DeclLoc, 0, |