[cfe-commits] r170478 - in /cfe/trunk/tools/libclang: CXComment.cpp SimpleFormatContext.h
jahanian
fjahanian at apple.com
Tue Dec 18 16:26:18 PST 2012
On Dec 18, 2012, at 4:10 PM, Jordan Rose <jordan_rose at apple.com> wrote:
>
>> if (!SFC) {
>> SFC = new SimpleFormatContext(Context.getLangOpts());
>> TU->FormatContext = SFC;
>> - }
>> - else if ((TU->FormatInMemoryUniqueId % 10) == 0) {
>> + } else if ((TU->FormatInMemoryUniqueId % 10) == 0) {
>> + // Delete after some number of iterators, so the buffers don't grow
>> + // too large.
>> delete SFC;
>> SFC = new SimpleFormatContext(Context.getLangOpts());
>
> Hate to drag this out, but why not use an OwningPtr here? A little safer against future refactoring that misses a delete.
I a not sure I can use OwningPtr here. I am managing allocation and deletion of the object
after a number of usages myself. This does;t fit the usage for OwningPtr as I understand it.
- Fariborz
More information about the cfe-commits
mailing list