diff options
author | Reid Kleckner <rnk@google.com> | 2016-02-09 02:51:17 +0000 |
---|---|---|
committer | Reid Kleckner <rnk@google.com> | 2016-02-09 02:51:17 +0000 |
commit | f5f2f5f15953e68ba1b1c5feff0908feab833b33 (patch) | |
tree | 3cdff950fee6b5e8109312e9279105686cddc948 /clang/lib/Sema/SemaTemplateInstantiate.cpp | |
parent | ca2edc7ad5ebeceb8eae8c20a8455d6db248ad74 (diff) | |
download | bcm5719-llvm-f5f2f5f15953e68ba1b1c5feff0908feab833b33.tar.gz bcm5719-llvm-f5f2f5f15953e68ba1b1c5feff0908feab833b33.zip |
Avoid forcing emission of delayed dllexported classes on template instantiation
Fixes PR26490
llvm-svn: 260194
Diffstat (limited to 'clang/lib/Sema/SemaTemplateInstantiate.cpp')
-rw-r--r-- | clang/lib/Sema/SemaTemplateInstantiate.cpp | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/clang/lib/Sema/SemaTemplateInstantiate.cpp b/clang/lib/Sema/SemaTemplateInstantiate.cpp index 56858bcc7e6..db3f47fd916 100644 --- a/clang/lib/Sema/SemaTemplateInstantiate.cpp +++ b/clang/lib/Sema/SemaTemplateInstantiate.cpp @@ -1949,6 +1949,13 @@ 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); @@ -2034,6 +2041,9 @@ 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(), |