diff options
Diffstat (limited to 'clang/lib/AST/VTableBuilder.cpp')
-rw-r--r-- | clang/lib/AST/VTableBuilder.cpp | 13 |
1 files changed, 7 insertions, 6 deletions
diff --git a/clang/lib/AST/VTableBuilder.cpp b/clang/lib/AST/VTableBuilder.cpp index 640fbf47aea..e43acc4de78 100644 --- a/clang/lib/AST/VTableBuilder.cpp +++ b/clang/lib/AST/VTableBuilder.cpp @@ -2545,13 +2545,14 @@ public: MostDerivedClassLayout(Context.getASTRecordLayout(MostDerivedClass)), WhichVFPtr(*Which), Overriders(MostDerivedClass, CharUnits(), MostDerivedClass) { - // Provide the RTTI component if RTTIData is enabled. If the vftable would - // be available externally, we should not provide the RTTI componenent. It - // is currently impossible to get available externally vftables with either - // dllimport or extern template instantiations, but eventually we may add a - // flag to support additional devirtualization that needs this. + // Only include the RTTI component if we know that we will provide a + // definition of the vftable. We always provide the definition of + // dllimported classes. if (Context.getLangOpts().RTTIData) - HasRTTIComponent = true; + if (MostDerivedClass->hasAttr<DLLImportAttr>() || + MostDerivedClass->getTemplateSpecializationKind() != + TSK_ExplicitInstantiationDeclaration) + HasRTTIComponent = true; LayoutVFTable(); |