summaryrefslogtreecommitdiffstats
path: root/clang/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
commit683fe4fc4c72703ed1c4ba4c8af7667b148d802c (patch)
treef69a1e53ab0ed04d16055a8c3aee3ced2f095a26 /clang/lib/CodeGen/CodeGenModule.cpp
parent3fef72f0ba99f01b67fc75b8409bdb6d442bd1e6 (diff)
downloadbcm5719-llvm-683fe4fc4c72703ed1c4ba4c8af7667b148d802c.tar.gz
bcm5719-llvm-683fe4fc4c72703ed1c4ba4c8af7667b148d802c.zip
If a method is virtual and the class key function is in another file, emit the method as available_externally.
Fixes PR6747 llvm-svn: 101757
Diffstat (limited to 'clang/lib/CodeGen/CodeGenModule.cpp')
-rw-r--r--clang/lib/CodeGen/CodeGenModule.cpp9
1 files changed, 8 insertions, 1 deletions
diff --git a/clang/lib/CodeGen/CodeGenModule.cpp b/clang/lib/CodeGen/CodeGenModule.cpp
index ab2f1c7aa2e..035e57fd0b2 100644
--- a/clang/lib/CodeGen/CodeGenModule.cpp
+++ b/clang/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;
}
OpenPOWER on IntegriCloud