diff options
author | Bill Wendling <isanbard@gmail.com> | 2010-10-06 07:03:52 +0000 |
---|---|---|
committer | Bill Wendling <isanbard@gmail.com> | 2010-10-06 07:03:52 +0000 |
commit | c7a012e581ad11b2464afa71f43e32fc79f143c9 (patch) | |
tree | bc18095aa32ba0d18a1861827ce637eecd766f21 /lib/Linker/LinkModules.cpp | |
parent | ed7713df195051c3f9a79dcc5a21252224727c66 (diff) |
Change RequiresMerge to RequiresUnique. It's a better description of what this
fix is trying to accomplish.
This code could still use some polishing.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@115759 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Linker/LinkModules.cpp')
-rw-r--r-- | lib/Linker/LinkModules.cpp | 15 |
1 files changed, 8 insertions, 7 deletions
diff --git a/lib/Linker/LinkModules.cpp b/lib/Linker/LinkModules.cpp index a05ef2b181..de443910a9 100644 --- a/lib/Linker/LinkModules.cpp +++ b/lib/Linker/LinkModules.cpp @@ -454,11 +454,12 @@ static void LinkNamedMDNodes(Module *Dest, Module *Src, } } -// RequiresMerge - Return true if the source global variable needs to be merged -// with the destination global variable. I.e., there shouldn't be a new global -// variable created in the destination Module, rather the initializers should be -// merged in an intelligent fashion. -static bool RequiresMerge(const GlobalVariable *SGV, const GlobalVariable *DGV){ +// RequiresUnique - Returns true if the global variable needs to be +// unique. I.e., there shouldn't be a new global variable created in the +// destination Module, rather the source variable's initializer needs to be +// identical to the destination variable's initializer. +static bool RequiresUnique(const GlobalVariable *SGV, + const GlobalVariable *DGV) { const StringRef SrcSec(SGV->getSection()); const StringRef DstSec(DGV->getSection()); @@ -492,7 +493,7 @@ static bool LinkGlobals(Module *Dest, const Module *Src, // be merged instead of replaced. if (SymTabGV) { const GlobalVariable *GV = dyn_cast<GlobalVariable>(SymTabGV); - if (GV && RequiresMerge(SGV, GV)) { + if (GV && RequiresUnique(SGV, GV)) { // Make sure to remember this mapping. ValueMap[SGV] = SymTabGV; continue; @@ -851,7 +852,7 @@ static bool LinkGlobalInits(Module *Dest, const Module *Src, // If dest is a global variable, check that initializers match. if (GlobalVariable *DGVar = dyn_cast<GlobalVariable>(DGV)) { if (DGVar->hasInitializer()) { - if (SGV->hasExternalLinkage() || RequiresMerge(SGV, DGVar)) { + if (SGV->hasExternalLinkage() || RequiresUnique(SGV, DGVar)) { if (DGVar->getInitializer() != SInit) return Error(Err, "Global Variable Collision on '" + SGV->getName() + |