aboutsummaryrefslogtreecommitdiff
path: root/lib/CodeGen/CodeGenModule.cpp
diff options
context:
space:
mode:
authorRafael Espindola <rafael.espindola@gmail.com>2010-04-19 00:44:22 +0000
committerRafael Espindola <rafael.espindola@gmail.com>2010-04-19 00:44:22 +0000
commitb8cab18e8562994b87f8d7c06f8c122beb712677 (patch)
tree7b44393cd19437a44d1fdba36fcdd640eafb6ad8 /lib/CodeGen/CodeGenModule.cpp
parent65ad5a42cca954e070428dcc499b62393aa7a6d3 (diff)
If a method is virtual and the class key function is in another file, emit the method as available_externally.
Fixes PR6747 git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@101757 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/CodeGen/CodeGenModule.cpp')
-rw-r--r--lib/CodeGen/CodeGenModule.cpp9
1 files changed, 8 insertions, 1 deletions
diff --git a/lib/CodeGen/CodeGenModule.cpp b/lib/CodeGen/CodeGenModule.cpp
index ab2f1c7aa2..035e57fd0b 100644
--- a/lib/CodeGen/CodeGenModule.cpp
+++ b/lib/CodeGen/CodeGenModule.cpp
@@ -314,7 +314,14 @@ 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 (MD->isVirtual() &&
+ CodeGenVTables::isKeyFunctionInAnotherTU(Context, RD))
+ return CodeGenModule::GVA_C99Inline;
+ }
+
return CodeGenModule::GVA_CXXInline;
}