Author: rnk Date: Mon Apr 29 14:32:05 2019 New Revision: 359507 URL: http://llvm.org/viewvc/llvm-project?rev=359507&view=rev Log: Simplify exclusion of nested classes from extern template instantiation, NFC
Summary: This simplifies three checks for MS ABI, Win Itanium, or Win GNU to just "is Windows". The question remains, however, if this is really the correct thing to do. We could, for example, only not consider inner classes to be externally available if the outer class has a dllexport annotation. However, I will leave that as future work. Reviewers: hans, mstorsjo Subscribers: cfe-commits Tags: #clang Differential Revision: https://reviews.llvm.org/D61278 Modified: cfe/trunk/lib/Sema/SemaTemplateInstantiate.cpp Modified: cfe/trunk/lib/Sema/SemaTemplateInstantiate.cpp URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/SemaTemplateInstantiate.cpp?rev=359507&r1=359506&r2=359507&view=diff ============================================================================== --- cfe/trunk/lib/Sema/SemaTemplateInstantiate.cpp (original) +++ cfe/trunk/lib/Sema/SemaTemplateInstantiate.cpp Mon Apr 29 14:32:05 2019 @@ -2684,15 +2684,14 @@ Sema::InstantiateClassMembers(SourceLoca == TSK_ExplicitSpecialization) continue; - if ((Context.getTargetInfo().getCXXABI().isMicrosoft() || - Context.getTargetInfo().getTriple().isWindowsItaniumEnvironment() || - Context.getTargetInfo().getTriple().isWindowsGNUEnvironment()) && + if (Context.getTargetInfo().getTriple().isOSWindows() && TSK == TSK_ExplicitInstantiationDeclaration) { - // In MSVC and Windows Itanium mode, explicit instantiation decl of the - // outer class doesn't affect the inner class. - // In GNU mode, inner classes aren't dllexported. Don't let the - // instantiation cover the inner class, to avoid undefined references - // to inner classes that weren't exported. + // On Windows, explicit instantiation decl of the outer class doesn't + // affect the inner class. Typically extern template declarations are + // used in combination with dll import/export annotations, but those + // are not propagated from the outer class templates to inner classes. + // Therefore, do not instantiate inner classes on this platform, so + // that users don't end up with undefined symbols during linking. continue; } _______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits