Add unnamed_addr to constructors and destructors.
llvm-svn: 123197
diff --git a/clang/lib/CodeGen/CodeGenModule.cpp b/clang/lib/CodeGen/CodeGenModule.cpp
index f582238..5d549c9 100644
--- a/clang/lib/CodeGen/CodeGenModule.cpp
+++ b/clang/lib/CodeGen/CodeGenModule.cpp
@@ -433,6 +433,9 @@
if (D->hasAttr<NoInlineAttr>())
F->addFnAttr(llvm::Attribute::NoInline);
+ if (isa<CXXConstructorDecl>(D) || isa<CXXDestructorDecl>(D))
+ F->setUnnamedAddr(true);
+
if (Features.getStackProtectorMode() == LangOptions::SSPOn)
F->addFnAttr(llvm::Attribute::StackProtect);
else if (Features.getStackProtectorMode() == LangOptions::SSPReq)