[cfe-commits] r61007 - /cfe/trunk/lib/AST/DeclarationName.cpp
Chris Lattner
clattner at apple.com
Sun Dec 14 12:59:58 PST 2008
On Dec 14, 2008, at 9:27 AM, Nuno Lopes wrote:
> Author: nlopes
> Date: Sun Dec 14 11:27:25 2008
> New Revision: 61007
>
> URL: http://llvm.org/viewvc/llvm-project?rev=61007&view=rev
> Log:
> fix leakage of CXXSpecialName objects in DeclarationNameTable
Thanks Nuno! Please don't call set->end() every time through the loop
though. :) Something like this should work:
for (llvm::FoldingSetIterator<CXXSpecialName> I = set->begin(), E =
set->end(); I != E; ++I)
..
>
>
> Modified:
> cfe/trunk/lib/AST/DeclarationName.cpp
>
> Modified: cfe/trunk/lib/AST/DeclarationName.cpp
> URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/AST/DeclarationName.cpp?rev=61007&r1=61006&r2=61007&view=diff
>
> =
> =
> =
> =
> =
> =
> =
> =
> ======================================================================
> --- cfe/trunk/lib/AST/DeclarationName.cpp (original)
> +++ cfe/trunk/lib/AST/DeclarationName.cpp Sun Dec 14 11:27:25 2008
> @@ -259,7 +259,16 @@
> }
>
> DeclarationNameTable::~DeclarationNameTable() {
> - delete
> static_cast<llvm::FoldingSet<CXXSpecialName>*>(CXXSpecialNamesImpl);
> + llvm::FoldingSet<CXXSpecialName> *set =
> +
> static_cast<llvm::FoldingSet<CXXSpecialName>*>(CXXSpecialNamesImpl);
> + llvm::FoldingSetIterator<CXXSpecialName> it = set->begin();
> +
> + while (it != set->end()) {
> + CXXSpecialName *n = &*it++;
> + delete n;
> + }
> +
> + delete set;
> delete [] CXXOperatorNames;
> }
>
>
>
> _______________________________________________
> cfe-commits mailing list
> cfe-commits at cs.uiuc.edu
> http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits
More information about the cfe-commits
mailing list