r267186 - Fix a bug involving deferred decl emission and PCH

Reid Kleckner via cfe-commits cfe-commits at lists.llvm.org
Fri Apr 22 12:59:50 PDT 2016


On Fri, Apr 22, 2016 at 12:29 PM, Richard Smith <richard at metafoo.co.uk>
wrote:

> On Fri, Apr 22, 2016 at 11:46 AM, Reid Kleckner via cfe-commits <
> cfe-commits at lists.llvm.org> wrote:
>
>> Author: rnk
>> Date: Fri Apr 22 13:46:33 2016
>> New Revision: 267186
>>
>> URL: http://llvm.org/viewvc/llvm-project?rev=267186&view=rev
>> Log:
>> Fix a bug involving deferred decl emission and PCH
>>
>> For various reasons, involving dllexport and class linkage compuations,
>> we have to wait until after the semicolon after a class declaration to
>> emit inline methods. These are "deferred" decls. Before this change,
>> finishing the tag decl would trigger us to deserialize some PCH so that
>> we could make a "pretty" IR-level type. Deserializing the PCH triggered
>> calls to HandleTopLevelDecl, which, when done, checked the deferred decl
>> list, and emitted some dllexported decls that weren't ready.
>>
>> Avoid this re-entrancy. Deferred decls should not get emitted when a tag
>> is finished, they should only be emitted after a real top level decl in
>> the main file.
>>
>
> What if there is no subsequent top-level decl after such a call? It seems
> like the deferred decls won't be emitted at all in that case. Is that
> acceptable?
>

I think what happens is that we finish the tag declaration, and then call
HandleTopLevelDecl on it directly, and that is supposed to flush the
deferred methods.

I can't think of any ways to create a C++ tag definition in a way that
doesn't create a top level decl.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20160422/b5c9b70d/attachment-0001.html>


More information about the cfe-commits mailing list