r267186 - Fix a bug involving deferred decl emission and PCH

Reid Kleckner via cfe-commits cfe-commits at lists.llvm.org
Mon Apr 25 13:04:48 PDT 2016


On Fri, Apr 22, 2016 at 1:58 PM, Richard Smith <richard at metafoo.co.uk>
wrote:
>
> This seems like a fragile thing to rely on. What about template
> instantiation performed at end of TU? (I /think/ that case is currently
> fine because all the kinds of template we instantiate ultimately do result
> in a call to HandleTopLevelDecl or some other ASTConsumer callback, but I
> don't really like relying on that.)
>
> Could we trigger processing of any remaining deferred declarations in
> HandleTranslationUnit?
>

We could, but we already have this assert in the destructor:
      // There should normally not be any leftover inline method
definitions.
      assert(DeferredInlineMethodDefinitions.empty() ||
             Diags.hasErrorOccurred());

If we ever break the invariant that HandleTopLevelDecl will be called some
time after deferring a decl, we will find out about it eventually.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20160425/0082de85/attachment.html>


More information about the cfe-commits mailing list