summaryrefslogtreecommitdiffstats
path: root/clang/lib/CodeGen/CodeGenModule.cpp
diff options
context:
space:
mode:
authorRichard Smith <richard-llvm@metafoo.co.uk>2012-09-28 22:46:07 +0000
committerRichard Smith <richard-llvm@metafoo.co.uk>2012-09-28 22:46:07 +0000
commitb555a767baf4a1058bc6e4e05acbbee9e55d0e26 (patch)
treef6da57e020a88e2bfcb717104ec4692ca21a9642 /clang/lib/CodeGen/CodeGenModule.cpp
parent538fe8f35b26b925e21a4329599c188d48264f0d (diff)
downloadbcm5719-llvm-b555a767baf4a1058bc6e4e05acbbee9e55d0e26.tar.gz
bcm5719-llvm-b555a767baf4a1058bc6e4e05acbbee9e55d0e26.zip
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
Diffstat (limited to 'clang/lib/CodeGen/CodeGenModule.cpp')
-rw-r--r--clang/lib/CodeGen/CodeGenModule.cpp4
1 files changed, 4 insertions, 0 deletions
diff --git a/clang/lib/CodeGen/CodeGenModule.cpp b/clang/lib/CodeGen/CodeGenModule.cpp
index 164031a5038..d09c1c32606 100644
--- a/clang/lib/CodeGen/CodeGenModule.cpp
+++ b/clang/lib/CodeGen/CodeGenModule.cpp
@@ -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)
OpenPOWER on IntegriCloud