diff options
author | Rafael Espindola <rafael.espindola@gmail.com> | 2014-11-25 04:43:59 +0000 |
---|---|---|
committer | Rafael Espindola <rafael.espindola@gmail.com> | 2014-11-25 04:43:59 +0000 |
commit | e96d7eb8bd8ea0fca104d9efdfb094a32e40fcf9 (patch) | |
tree | dbc7af9d116d7c774c803649d2d93b40fe32841d /llvm/lib/Linker | |
parent | d2a13a2ec6224e85b77d58652c7714d280ab02e9 (diff) | |
download | bcm5719-llvm-e96d7eb8bd8ea0fca104d9efdfb094a32e40fcf9.tar.gz bcm5719-llvm-e96d7eb8bd8ea0fca104d9efdfb094a32e40fcf9.zip |
Link the type of aliases.
They are not more or less "well typed" than GlobalVariables.
llvm-svn: 222725
Diffstat (limited to 'llvm/lib/Linker')
-rw-r--r-- | llvm/lib/Linker/LinkModules.cpp | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/llvm/lib/Linker/LinkModules.cpp b/llvm/lib/Linker/LinkModules.cpp index 9664e3f5618..a8dc324daa2 100644 --- a/llvm/lib/Linker/LinkModules.cpp +++ b/llvm/lib/Linker/LinkModules.cpp @@ -786,6 +786,11 @@ void ModuleLinker::computeTypeMapping() { TypeMap.addTypeMapping(DGV->getType(), SGV.getType()); } + for (GlobalValue &SGV : SrcM->aliases()) { + if (GlobalValue *DGV = getLinkedToGlobal(&SGV)) + TypeMap.addTypeMapping(DGV->getType(), SGV.getType()); + } + // Incorporate types by name, scanning all the types in the source module. // At this point, the destination module may have a type "%foo = { i32 }" for // example. When the source module got loaded into the same LLVMContext, if @@ -829,8 +834,6 @@ void ModuleLinker::computeTypeMapping() { TypeMap.addTypeMapping(DST, ST); } - // Don't bother incorporating aliases, they aren't generally typed well. - // Now that we have discovered all of the type equivalences, get a body for // any 'opaque' types in the dest module that are now resolved. TypeMap.linkDefinedTypeBodies(); |