r260241 - Revert "Avoid forcing emission of delayed dllexported classes on template instantiation"

Reid Kleckner via cfe-commits cfe-commits at lists.llvm.org
Tue Feb 9 09:48:27 PST 2016


Author: rnk
Date: Tue Feb  9 11:48:27 2016
New Revision: 260241

URL: http://llvm.org/viewvc/llvm-project?rev=260241&view=rev
Log:
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.

Modified:
    cfe/trunk/lib/Sema/SemaTemplateInstantiate.cpp
    cfe/trunk/test/CodeGenCXX/dllexport.cpp

Modified: cfe/trunk/lib/Sema/SemaTemplateInstantiate.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/SemaTemplateInstantiate.cpp?rev=260241&r1=260240&r2=260241&view=diff
==============================================================================
--- cfe/trunk/lib/Sema/SemaTemplateInstantiate.cpp (original)
+++ cfe/trunk/lib/Sema/SemaTemplateInstantiate.cpp Tue Feb  9 11:48:27 2016
@@ -1949,13 +1949,6 @@ Sema::InstantiateClass(SourceLocation Po
   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 Po
   // 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(),

Modified: cfe/trunk/test/CodeGenCXX/dllexport.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/CodeGenCXX/dllexport.cpp?rev=260241&r1=260240&r2=260241&view=diff
==============================================================================
--- cfe/trunk/test/CodeGenCXX/dllexport.cpp (original)
+++ cfe/trunk/test/CodeGenCXX/dllexport.cpp Tue Feb  9 11:48:27 2016
@@ -777,17 +777,6 @@ struct __declspec(dllexport) Baz {
 // M32-DAG: define weak_odr dllexport x86_thiscallcc dereferenceable(1) %"struct.InClassInits::Baz"* @"\01??4Baz at InClassInits@@QAEAAU01 at ABU01@@Z"
 }
 
-// We had an issue where instantiating A would force emission of B's delayed
-// exported methods.
-namespace pr26490 {
-template <typename T> struct A { };
-struct __declspec(dllexport) B {
-  B(int = 0) {}
-  A<int> m_fn1() {}
-};
-// M32-DAG: define weak_odr dllexport x86_thiscallcc void @"\01??_FB at pr26490@@QAEXXZ"
-}
-
 
 //===----------------------------------------------------------------------===//
 // Classes with template base classes




More information about the cfe-commits mailing list