From 683fe4fc4c72703ed1c4ba4c8af7667b148d802c Mon Sep 17 00:00:00 2001 From: Rafael Espindola Date: Mon, 19 Apr 2010 00:44:22 +0000 Subject: 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 --- clang/lib/CodeGen/CodeGenModule.cpp | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) (limited to 'clang/lib/CodeGen/CodeGenModule.cpp') diff --git a/clang/lib/CodeGen/CodeGenModule.cpp b/clang/lib/CodeGen/CodeGenModule.cpp index ab2f1c7a..035e57f 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(FD)) { + const CXXRecordDecl *RD = MD->getParent(); + if (MD->isVirtual() && + CodeGenVTables::isKeyFunctionInAnotherTU(Context, RD)) + return CodeGenModule::GVA_C99Inline; + } + return CodeGenModule::GVA_CXXInline; } -- cgit v1.1