Rietveld Code Review Tool
Help | Bug tracker | Discussion group | Source code | Sign in
(22)

Issue 164084: Fix memory leak in LLVM (Closed)

Can't Edit
Can't Publish+Mail
Start Review
Created:
16 years, 7 months ago by Collin Winter
Modified:
16 years, 6 months ago
Reviewers:
Jeffrey Yasskin
CC:
unladen-swallow_googlegroups.com
Base URL:
http://unladen-swallow.googlecode.com/svn/trunk/Util/llvm/
Visibility:
Public.

Description

Fix the memory leak observed by the heapchecker. All LLVM and Clang tests pass. Sent upstream as http://codereview.appspot.com/180073.

Patch Set 1 #

Patch Set 2 : Add missing test file #

Total comments: 12

Patch Set 3 : Address jyasskin's comments #

Patch Set 4 : Fix 80 col violation #

Total comments: 4

Patch Set 5 : Address jyasskin's comments #

Unified diffs Side-by-side diffs Delta from patch set Stats (+60 lines, -3 lines) Patch
M include/llvm/DerivedTypes.h View 1 2 1 chunk +1 line, -3 lines 0 comments Download
M lib/VMCore/LLVMContextImpl.h View 1 2 3 3 chunks +11 lines, -0 lines 0 comments Download
M lib/VMCore/Type.cpp View 1 2 3 4 2 chunks +17 lines, -0 lines 0 comments Download
A unittests/VMCore/DerivedTypesTest.cpp View 1 chunk +31 lines, -0 lines 0 comments Download

Messages

Total messages: 5
Collin Winter
PTAL
16 years, 7 months ago (2009-12-03 23:20:38 UTC) #1
Jeffrey Yasskin
http://codereview.appspot.com/164084/diff/6/8 File include/llvm/Type.h (right): http://codereview.appspot.com/164084/diff/6/8#newcode127 include/llvm/Type.h:127: virtual void destroy() const; // const is a lie, ...
16 years, 7 months ago (2009-12-04 02:55:01 UTC) #2
Collin Winter
PTAL http://codereview.appspot.com/164084/diff/6/8 File include/llvm/Type.h (right): http://codereview.appspot.com/164084/diff/6/8#newcode127 include/llvm/Type.h:127: virtual void destroy() const; // const is a ...
16 years, 6 months ago (2009-12-15 19:24:12 UTC) #3
Jeffrey Yasskin
LGTM except for the nits below. Feel free to send upstream after fixing them. http://codereview.appspot.com/164084/diff/4005/5008 ...
16 years, 6 months ago (2009-12-15 20:42:38 UTC) #4
Collin Winter
16 years, 6 months ago (2009-12-16 19:26:09 UTC) #5
Sending upstream

http://codereview.appspot.com/164084/diff/4005/5008
File lib/VMCore/Type.cpp (right):

http://codereview.appspot.com/164084/diff/4005/5008#newcode83
lib/VMCore/Type.cpp:83: else if (isa<OpaqueType>(this)) {
On 2009/12/15 20:42:38, Jeffrey Yasskin wrote:
> LLVM elses go on the same line as the '}'.

Done.

http://codereview.appspot.com/164084/diff/4005/5008#newcode85
lib/VMCore/Type.cpp:85: pImpl->OpaqueTypes.erase(static_cast<const OpaqueType
*>(this));
On 2009/12/15 20:42:38, Jeffrey Yasskin wrote:
> Instead of static_cast, you always want to use cast<> for LLVM types. And
then,
> since you have both isa<> and cast<>, you want to replace it with dyn_cast<>:
> 
> } else if (const OpaqueType *opaque_this = dyn_cast<OpaqueType>(this)) {
>   LLVMontextImpl *pImpl = this->getContext().pImpl;
>   pImpl->OpaqueTypes.erase(opaque_this);
> }

Done.
Sign in to reply to this message.

Powered by Google App Engine
RSS Feeds Recent Issues | This issue
This is Rietveld f62528b