PR13941: Mark all virtual functions as unnamed_addr. It's not possible to
observe their addresses (taking their address gives the vtable slot) so we are free to merge their definitions. llvm-svn: 164864
This commit is contained in:
@@ -588,6 +588,10 @@ void CodeGenModule::SetLLVMFunctionAttributesForDefinition(const Decl *D,
|
||||
if (isa<CXXConstructorDecl>(D) || isa<CXXDestructorDecl>(D))
|
||||
F->setUnnamedAddr(true);
|
||||
|
||||
if (const CXXMethodDecl *MD = dyn_cast<CXXMethodDecl>(D))
|
||||
if (MD->isVirtual())
|
||||
F->setUnnamedAddr(true);
|
||||
|
||||
if (LangOpts.getStackProtector() == LangOptions::SSPOn)
|
||||
F->addFnAttr(llvm::Attribute::StackProtect);
|
||||
else if (LangOpts.getStackProtector() == LangOptions::SSPReq)
|
||||
|
||||
Reference in New Issue
Block a user