[llvm] r222930 - Fix a few memory leaks in CodeGenRegBank.
David Blaikie
dblaikie at gmail.com
Wed Dec 3 12:09:24 PST 2014
On Fri, Nov 28, 2014 at 12:30 PM, Craig Topper <craig.topper at gmail.com>
wrote:
> Author: ctopper
> Date: Fri Nov 28 14:30:39 2014
> New Revision: 222930
>
> URL: http://llvm.org/viewvc/llvm-project?rev=222930&view=rev
> Log:
> Fix a few memory leaks in CodeGenRegBank.
>
> Modified:
> llvm/trunk/utils/TableGen/CodeGenRegisters.cpp
> llvm/trunk/utils/TableGen/CodeGenRegisters.h
>
> Modified: llvm/trunk/utils/TableGen/CodeGenRegisters.cpp
> URL:
> http://llvm.org/viewvc/llvm-project/llvm/trunk/utils/TableGen/CodeGenRegisters.cpp?rev=222930&r1=222929&r2=222930&view=diff
>
> ==============================================================================
> --- llvm/trunk/utils/TableGen/CodeGenRegisters.cpp (original)
> +++ llvm/trunk/utils/TableGen/CodeGenRegisters.cpp Fri Nov 28 14:30:39 2014
> @@ -1012,6 +1012,12 @@ CodeGenRegBank::CodeGenRegBank(RecordKee
> CodeGenRegisterClass::computeSubClasses(*this);
> }
>
> +CodeGenRegBank::~CodeGenRegBank() {
> + DeleteContainerPointers(SubRegIndices);
> + DeleteContainerPointers(Registers);
> + DeleteContainerPointers(RegClasses);
>
I've been trying to eliminate uses of DeleteContainer* functions in favor
of unique_ptr, etc - or value semantics.
In this case I was able to mostly use value semantics in r222950
(SubRegIndices - though I accidentally, temporarily, reintroduced the
memory leak with a preceeding cleanup in r222949) r222958 (Registers), and
r223261 (RegClasses)
Hope those look good/useful. The last one was the trickiest and most
questionable, I suspect.
> +}
> +
> // Create a synthetic CodeGenSubRegIndex without a corresponding Record.
> CodeGenSubRegIndex*
> CodeGenRegBank::createSubRegIndex(StringRef Name, StringRef Namespace) {
>
> Modified: llvm/trunk/utils/TableGen/CodeGenRegisters.h
> URL:
> http://llvm.org/viewvc/llvm-project/llvm/trunk/utils/TableGen/CodeGenRegisters.h?rev=222930&r1=222929&r2=222930&view=diff
>
> ==============================================================================
> --- llvm/trunk/utils/TableGen/CodeGenRegisters.h (original)
> +++ llvm/trunk/utils/TableGen/CodeGenRegisters.h Fri Nov 28 14:30:39 2014
> @@ -521,6 +521,7 @@ namespace llvm {
>
> public:
> CodeGenRegBank(RecordKeeper&);
> + ~CodeGenRegBank();
>
> SetTheory &getSets() { return Sets; }
>
>
>
> _______________________________________________
> llvm-commits mailing list
> llvm-commits at cs.uiuc.edu
> http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20141203/451ee162/attachment.html>
More information about the llvm-commits
mailing list