[llvm-commits] [llvm] r170041 - in /llvm/trunk: include/llvm/MC/MCAssembler.h include/llvm/MC/MCContext.h include/llvm/MC/MCObjectStreamer.h include/llvm/MC/MCStreamer.h lib/CodeGen/AsmPrinter/AsmPrinter.cpp lib/CodeGen/MachineModuleInfo.cpp lib/MC/MCAssembler.cpp lib/MC/MCContext.cpp lib/MC/MCObjectStreamer.cpp lib/MC/MCStreamer.cpp

Chandler Carruth chandlerc at google.com
Wed Dec 12 15:32:10 PST 2012


On Dec 12, 2012 3:27 PM, "Pedro Artigas" <partigas at apple.com> wrote:
>
> Reset is not virtual in any way, so I believe it is ok to call it in the
destructor.

Oh doh... I looked at the wrong reset. Sorry about that....

 It frees some memory (ideally it would not, it would clear the maps but I
do not know if that has the same behavior, if so I can change it) which
would leak otherwise.

Not sure either without looking closer... anyways sorry for noise

>
> On Dec 12, 2012, at 3:19 PM, Chandler Carruth <chandlerc at google.com>
wrote:
>
>> On Wed, Dec 12, 2012 at 2:59 PM, Pedro Artigas <partigas at apple.com>
wrote:
>>>
>>>  MCContext::~MCContext() {
>>>
>>> -  if (AutoInitializationFinalization)
>>> -    doFinalization();
>>> +  if (AutoReset)
>>> +    reset();
>>
>>
>> I don't think this does what you want it to... This is a virtual
function, and so it seems like a bad idea:
http://www.artima.com/cppsource/nevercall.html
>>
>> That said, I don't think we need the functionality of MCContext's reset
in the destructor -- won't the normal destructor do what you want anyways?
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20121212/6db0a324/attachment.html>


More information about the llvm-commits mailing list