[cfe-dev] [Patch] Make ParseAST() take ASTContext and TU params

Alexei Svitkine alexei.svitkine at gmail.com
Mon Jan 26 11:29:03 PST 2009


Here's an updated patch that also removes the comment about the
FreeMemory param which no longer exists.

-Alexei

On Sat, Jan 24, 2009 at 2:51 PM, Alexei Svitkine
<alexei.svitkine at gmail.com> wrote:
> You are right. Here's a revised patch.
>
> -Alexei
>
> On Sat, Jan 24, 2009 at 11:19 AM, Sebastian Redl
> <sebastian.redl at getdesigned.at> wrote:
>> Alexei Svitkine wrote:
>>> Hi,
>>>
>>> Attached is a patch to make ParseAST() take ASTContext and
>>> TranslationUnit as parameters, as suggested by Steve Naroff.
>>>
>>
>> The double negative in the code confuses me somewhat, but isn't this
>> condition the wrong way round?
>>
>>> +    if (!DisableFree) {
>>> +      Context = new ASTContext(PP.getLangOptions(),
>>> PP.getSourceManager(),
>>> +                               PP.getTargetInfo(),
>>> +                               PP.getIdentifierTable(),
>>> PP.getSelectorTable());
>>> +      TU = new TranslationUnit(*Context);
>>> +    }
>>> +    ParseAST(PP, Consumer.get(), Context, TU, Stats);
>>
>> Previously, if DisableFree was true, FreeMemory was false, and ParseAST
>> didn't free the objects.
>> Now, if DisableFree is true, the driver doesn't allocate objects, so
>> ParseAST does and will free them.
>>
>> Sebastian
>>
>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: ParseAST3.diff
Type: application/octet-stream
Size: 3570 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-dev/attachments/20090126/a9541b4c/attachment.obj>


More information about the cfe-dev mailing list