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 | 7cb0220e535958756f0c36788b370aebc07aea1f (patch) | |
tree | 9ded153a937343d25326b31eee351dff293d63bf /clang/lib/CodeGen/CGVTables.cpp | |
parent | 26fdebcae9321029dd0a474f2f38d669eebe1133 (diff) | |
download | bcm5719-llvm-7cb0220e535958756f0c36788b370aebc07aea1f.tar.gz bcm5719-llvm-7cb0220e535958756f0c36788b370aebc07aea1f.zip |
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.
llvm-svn: 104581
Diffstat (limited to 'clang/lib/CodeGen/CGVTables.cpp')
-rw-r--r-- | clang/lib/CodeGen/CGVTables.cpp | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/clang/lib/CodeGen/CGVTables.cpp b/clang/lib/CodeGen/CGVTables.cpp index b66b9f84933..8bdd4588d4a 100644 --- a/clang/lib/CodeGen/CGVTables.cpp +++ b/clang/lib/CodeGen/CGVTables.cpp @@ -2723,7 +2723,7 @@ void CodeGenFunction::GenerateThunk(llvm::Function *Fn, GlobalDecl GD, CXXThisDecl->Destroy(getContext()); // Set the right linkage. - Fn->setLinkage(CGM.getFunctionLinkage(MD)); + CGM.setFunctionLinkage(MD, Fn); // Set the right visibility. CGM.setGlobalVisibility(Fn, MD); |