From: Reid Kleckner Date: Tue, 9 Feb 2016 17:48:27 +0000 (+0000) Subject: Revert "Avoid forcing emission of delayed dllexported classes on template instantiation" X-Git-Tag: llvmorg-3.9.0-rc1~14719 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=d809be40d2012fc0abcd466764fb258256ec440a;p=platform%2Fupstream%2Fllvm.git Revert "Avoid forcing emission of delayed dllexported classes on template instantiation" This reverts commit r260194. It caused PR26549. There's probably a better way to do this also. llvm-svn: 260241 --- diff --git a/clang/lib/Sema/SemaTemplateInstantiate.cpp b/clang/lib/Sema/SemaTemplateInstantiate.cpp index db3f47f..56858bc 100644 --- a/clang/lib/Sema/SemaTemplateInstantiate.cpp +++ b/clang/lib/Sema/SemaTemplateInstantiate.cpp @@ -1949,13 +1949,6 @@ Sema::InstantiateClass(SourceLocation PointOfInstantiation, bool MergeWithParentScope = !Instantiation->isDefinedOutsideFunctionOrMethod(); LocalInstantiationScope Scope(*this, MergeWithParentScope); - // All dllexported classes created during instantiation should be fully - // emitted after instantiation completes. We may not be ready to emit any - // delayed classes already on the stack, so save them away and put them back - // later. - decltype(DelayedDllExportClasses) ExportedClasses; - std::swap(ExportedClasses, DelayedDllExportClasses); - // Pull attributes from the pattern onto the instantiation. InstantiateAttrs(TemplateArgs, Pattern, Instantiation); @@ -2041,9 +2034,6 @@ Sema::InstantiateClass(SourceLocation PointOfInstantiation, // default arg exprs for default constructors if necessary now. ActOnFinishCXXNonNestedClass(Instantiation); - // Put back the delayed exported classes that we moved out of the way. - std::swap(ExportedClasses, DelayedDllExportClasses); - // Instantiate late parsed attributes, and attach them to their decls. // See Sema::InstantiateAttrs for (LateInstantiatedAttrVec::iterator I = LateAttrs.begin(), diff --git a/clang/test/CodeGenCXX/dllexport.cpp b/clang/test/CodeGenCXX/dllexport.cpp index 04007e8..1412ad8 100644 --- a/clang/test/CodeGenCXX/dllexport.cpp +++ b/clang/test/CodeGenCXX/dllexport.cpp @@ -777,17 +777,6 @@ struct __declspec(dllexport) Baz { // M32-DAG: define weak_odr dllexport x86_thiscallcc dereferenceable(1) %"struct.InClassInits::Baz"* @"\01??4Baz@InClassInits@@QAEAAU01@ABU01@@Z" } -// We had an issue where instantiating A would force emission of B's delayed -// exported methods. -namespace pr26490 { -template struct A { }; -struct __declspec(dllexport) B { - B(int = 0) {} - A m_fn1() {} -}; -// M32-DAG: define weak_odr dllexport x86_thiscallcc void @"\01??_FB@pr26490@@QAEXXZ" -} - //===----------------------------------------------------------------------===// // Classes with template base classes