r267186 - Fix a bug involving deferred decl emission and PCH

Richard Smith via cfe-commits cfe-commits at lists.llvm.org
Mon Apr 25 13:16:37 PDT 2016


On Mon, Apr 25, 2016 at 1:04 PM, Reid Kleckner <rnk at google.com> wrote:

> 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.
>

OK. This seems like a fairly arbitrary thing to have in the ASTConsumer
contract, but in practice it does seem like it ought to hold.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20160425/389fa8d9/attachment.html>


More information about the cfe-commits mailing list