This was already the intention of DelayedDllExportClasses, but this test case would break it:
template<typename> struct Tmpl {}; struct Outer { struct Inner { __declspec(dllexport) Inner() = default; unsigned int x = 0; }; Tmpl<Inner> y; };
ActOnFinishCXXNonNestedClass() would get called when the instantiation of Templ<Inner> is finished, even though the compiler is still not finished with Outer, causing the compile fail.
This hooks into Sema::{Push,Pop}ParsingClass() to avoid calling ActOnFinishCXXNonNestedClass() for template instantiations while a class is being parsed.
This was the cleanest solution I could come up with :-)
This function doesn't use its argument. Can you remove it so that is clear that we don't need to track this somewhere else?