diff options
author | John McCall <rjmccall@apple.com> | 2010-05-25 04:30:21 +0000 |
---|---|---|
committer | John McCall <rjmccall@apple.com> | 2010-05-25 04:30:21 +0000 |
commit | 8b2423361648c39a7d8a3c5e8129e12006deac32 (patch) | |
tree | 8113ac1969dd99513a97a8c1d09d5aa00de67642 /lib/CodeGen/CGCXX.cpp | |
parent | 45806fe5b89de739af95bea2e0d1a5822d53ae9b (diff) |
If a function definition has any sort of weak linkage, its static local
variables should have that linkage. Otherwise, its static local
variables should have internal linkage. To avoid computing this excessively,
set a function's linkage before we emit code for it.
Previously we were assigning weak linkage to the static variables of
static inline functions in C++, with predictably terrible results. This
fixes that and also gives better linkage than 'weak' when merging is required.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@104581 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/CodeGen/CGCXX.cpp')
-rw-r--r-- | lib/CodeGen/CGCXX.cpp | 2 |
1 files changed, 2 insertions, 0 deletions
diff --git a/lib/CodeGen/CGCXX.cpp b/lib/CodeGen/CGCXX.cpp index 74cf1134d5..85222fe9db 100644 --- a/lib/CodeGen/CGCXX.cpp +++ b/lib/CodeGen/CGCXX.cpp @@ -206,6 +206,7 @@ void CodeGenModule::EmitCXXConstructor(const CXXConstructorDecl *D, return; llvm::Function *Fn = cast<llvm::Function>(GetAddrOfCXXConstructor(D, Type)); + setFunctionLinkage(D, Fn); CodeGenFunction(*this).GenerateCode(GlobalDecl(D, Type), Fn); @@ -269,6 +270,7 @@ void CodeGenModule::EmitCXXDestructor(const CXXDestructorDecl *D, return; llvm::Function *Fn = cast<llvm::Function>(GetAddrOfCXXDestructor(D, Type)); + setFunctionLinkage(D, Fn); CodeGenFunction(*this).GenerateCode(GlobalDecl(D, Type), Fn); |