Fix a bug involving deferred decl emission and PCH
authorReid Kleckner <rnk@google.com>
Fri, 22 Apr 2016 18:46:33 +0000 (18:46 +0000)
committerReid Kleckner <rnk@google.com>
Fri, 22 Apr 2016 18:46:33 +0000 (18:46 +0000)
commitea53dba78b5064052793fe9a8bec4a2649fb3e4f
treebe8be11ed6f01ed6234698dd28e737047f60fea8
parent658d9dbe56b78e9d8d5a768b2e68ff86cab2b39d
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.

llvm-svn: 267186
clang/lib/CodeGen/ModuleBuilder.cpp
clang/test/PCH/Inputs/pr27445.h [new file with mode: 0644]
clang/test/PCH/pr27445.cpp [new file with mode: 0644]