[cfe-dev] Tooling vs -fdelayed-template-parsing WAS: Clang-cl.exe and the VC++ preprocessor

Kim Gräsman kim.grasman at gmail.com
Sun Aug 3 10:30:36 PDT 2014

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

Many thanks!

- Kim
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-dev/attachments/20140803/d6ed9763/attachment.html>

More information about the cfe-dev mailing list