From 0446e7cfae9fb33c367dceaac17fe40391f21e7c Mon Sep 17 00:00:00 2001 From: Peter Collingbourne Date: Mon, 14 Mar 2016 18:41:59 +0000 Subject: CodeGen: Mark functions used in vtables as unnamed_addr. This marks virtual function declarations, as well as runtime library functions __cxa_pure_virtual, __cxa_deleted_virtual and _purecall, as unnamed_addr. This will allow us to correctly form relative references to them from vtables in the relative vtable ABI. Differential Revision: http://reviews.llvm.org/D18071 llvm-svn: 263464 --- clang/lib/CodeGen/CodeGenModule.cpp | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) (limited to 'clang/lib/CodeGen/CodeGenModule.cpp') diff --git a/clang/lib/CodeGen/CodeGenModule.cpp b/clang/lib/CodeGen/CodeGenModule.cpp index fad31995ed5..73cf47c69ab 100644 --- a/clang/lib/CodeGen/CodeGenModule.cpp +++ b/clang/lib/CodeGen/CodeGenModule.cpp @@ -906,12 +906,6 @@ void CodeGenModule::SetLLVMFunctionAttributesForDefinition(const Decl *D, F->removeFnAttr(llvm::Attribute::InlineHint); } - if (isa(D) || isa(D)) - F->setUnnamedAddr(true); - else if (const auto *MD = dyn_cast(D)) - if (MD->isVirtual()) - F->setUnnamedAddr(true); - unsigned alignment = D->getMaxAlignment() / Context.getCharWidth(); if (alignment) F->setAlignment(alignment); @@ -1079,6 +1073,12 @@ void CodeGenModule::SetFunctionAttributes(GlobalDecl GD, llvm::Function *F, F->addAttribute(llvm::AttributeSet::FunctionIndex, llvm::Attribute::NoBuiltin); + if (isa(FD) || isa(FD)) + F->setUnnamedAddr(true); + else if (const auto *MD = dyn_cast(FD)) + if (MD->isVirtual()) + F->setUnnamedAddr(true); + CreateFunctionBitSetEntry(FD, F); } -- cgit v1.2.3