[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

Pedro Artigas partigas at apple.com
Wed Dec 12 15:27:32 PST 2012


Reset is not virtual in any way, so I believe it is ok to call it in the destructor. 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.

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/9a4b0738/attachment.html>


More information about the llvm-commits mailing list