aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--lib/Linker/LinkModules.cpp9
1 files changed, 4 insertions, 5 deletions
diff --git a/lib/Linker/LinkModules.cpp b/lib/Linker/LinkModules.cpp
index 3d6e526..32c4990 100644
--- a/lib/Linker/LinkModules.cpp
+++ b/lib/Linker/LinkModules.cpp
@@ -1087,11 +1087,10 @@ static bool LinkAppendingVars(Module *M,
static bool ResolveAliases(Module *Dest) {
for (Module::alias_iterator I = Dest->alias_begin(), E = Dest->alias_end();
- I != E; ++I) {
- GlobalValue* GV = const_cast<GlobalValue*>(I->getAliasedGlobal());
- if (!GV->isDeclaration())
- I->replaceAllUsesWith(GV);
- }
+ I != E; ++I)
+ if (const GlobalValue *GV = I->resolveAliasedGlobal())
+ if (!GV->isDeclaration())
+ I->replaceAllUsesWith(const_cast<GlobalValue*>(GV));
return false;
}