[cfe-dev] Tooling vs -fdelayed-template-parsing WAS: Clang-cl.exe and the VC++ preprocessor
Reid Kleckner
rnk at google.com
Sun Aug 3 13:41:28 PDT 2014
On Sun, Aug 3, 2014 at 10:30 AM, Kim Gräsman <kim.grasman at gmail.com> wrote:
> Hi Reid,
>
> On Fri, Aug 1, 2014 at 8:31 PM, Reid Kleckner <rnk at google.com> wrote:
>
>>
>>> Are we stuck here? Or is there a workaround for visiting template bodies
>>> even under -fdelayed-template-parsing?
>>>
>>
>> Hypothetically you could record every late parsed function decl
>> (FD->isLateTemplateParsed()) and call LateTemplateParser on it at the end
>> of the TU. This would get you the uninstantiated template AST, which is
>> what you want. I make no guarantees, though. :)
>>
>
> This seems to work surprisingly well :-)
>
> After having run the entire RAV cycle on the translation unit I invoke
> LateTemplateParser on all collected FunctionDecls. Then I need to RAV all
> these decls again to collect uses, but it seems to work.
>
> I'm guessing this introduces a risk for double-visiting FunctionDecls that
> _do_ become instantiated; can I somehow check the FDs before forcefully
> instantiating them? Not that I think it makes a big difference, it just
> seems hygienic not to late-parse and revisit stuff that's already been
> recorded.
>
I think parsing a late parsed function body has the side effect of making
it not late parsed, so it should never be visited twice.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-dev/attachments/20140803/b69f0460/attachment.html>
More information about the cfe-dev
mailing list