diff options
author | Reid Kleckner <rnk@google.com> | 2019-04-29 21:32:05 +0000 |
---|---|---|
committer | Reid Kleckner <rnk@google.com> | 2019-04-29 21:32:05 +0000 |
commit | fbebf8caed44af2049f8f1ebe470c76c03ec780b (patch) | |
tree | e258a17988a40db64124016c85bd5eeb94865041 | |
parent | 8e6b618dacf4ea1f54007bb2aecdedac400d323d (diff) |
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
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@359507 91177308-0d34-0410-b5e6-96231b3b80d8
-rw-r--r-- | lib/Sema/SemaTemplateInstantiate.cpp | 15 |
1 files changed, 7 insertions, 8 deletions
diff --git a/lib/Sema/SemaTemplateInstantiate.cpp b/lib/Sema/SemaTemplateInstantiate.cpp index a7be1ea7c8..03822e2c78 100644 --- a/lib/Sema/SemaTemplateInstantiate.cpp +++ b/lib/Sema/SemaTemplateInstantiate.cpp @@ -2684,15 +2684,14 @@ Sema::InstantiateClassMembers(SourceLocation PointOfInstantiation, == 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; } |