Open Quuxplusone opened 14 years ago
Attached PR6747.patch
(1257 bytes, text/plain): proposed patch
Attached PR6747.patch
(1988 bytes, text/plain): updated patch
Attached PR6747.patch
(1992 bytes, text/plain): rebased patch
(In reply to comment #3)
> Created an attachment (id=4663) [details]
> rebased patch
--- a/lib/CodeGen/CodeGenModule.cpp
+++ b/lib/CodeGen/CodeGenModule.cpp
@@ -314,7 +314,15 @@ GetLinkageForFunction(ASTContext &Context, const
FunctionDecl *FD,
if (FD->getTemplateSpecializationKind()
== TSK_ExplicitInstantiationDeclaration)
return CodeGenModule::GVA_C99Inline;
-
+
+ if (const CXXMethodDecl *MD = dyn_cast<CXXMethodDecl>(FD)) {
+ const CXXRecordDecl *RD = MD->getParent();
+ if (RD->isDynamicClass() &&
+ MD->isVirtual() &&
+ CodeGenVTables::isKeyFunctionInAnotherTU(Context, RD))
+ return CodeGenModule::GVA_C99Inline;
+ }
The RD->isDynamicClass() check is redundant.
Otherwise, this patch looks good. Thanks!
Fixed in 101757.
We've had to remove this optimization in r103741; see the comment in that commit. We can revisit this optimization later.
PR6747.patch
(1257 bytes, text/plain)PR6747.patch
(1988 bytes, text/plain)PR6747.patch
(1992 bytes, text/plain)