diff options
author | Anton Korobeynikov <asl@math.spbu.ru> | 2008-03-10 22:36:53 +0000 |
---|---|---|
committer | Anton Korobeynikov <asl@math.spbu.ru> | 2008-03-10 22:36:53 +0000 |
commit | 510fc32d15830cd529be2adee39fd756abaa87ad (patch) | |
tree | cedba5ce6756104ad58982f4440b4a7d4c88b410 /llvm | |
parent | d5160da577854bb398e1e89e40a757a72e0753c1 (diff) | |
download | bcm5719-llvm-510fc32d15830cd529be2adee39fd756abaa87ad.tar.gz bcm5719-llvm-510fc32d15830cd529be2adee39fd756abaa87ad.zip |
Add sanity checks
llvm-svn: 48184
Diffstat (limited to 'llvm')
-rw-r--r-- | llvm/lib/Linker/LinkModules.cpp | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/llvm/lib/Linker/LinkModules.cpp b/llvm/lib/Linker/LinkModules.cpp index 53fce4893fd..3d6e52602b1 100644 --- a/llvm/lib/Linker/LinkModules.cpp +++ b/llvm/lib/Linker/LinkModules.cpp @@ -659,6 +659,11 @@ static bool LinkAlias(Module *Dest, const Module *Src, // The only allowed way is to link alias with external declaration. if (DGV->isDeclaration()) { + // But only if aliasee is global too... + if (!isa<GlobalVariable>(DAliasee)) + return Error(Err, "Global-Alias Collision on '" + SGA->getName() + + "': aliasee is not global variable"); + NewGA = new GlobalAlias(SGA->getType(), SGA->getLinkage(), SGA->getName(), DAliasee, Dest); CopyGVAttributes(NewGA, SGA); @@ -685,6 +690,11 @@ static bool LinkAlias(Module *Dest, const Module *Src, // The only allowed way is to link alias with external declaration. if (DF->isDeclaration()) { + // But only if aliasee is function too... + if (!isa<Function>(DAliasee)) + return Error(Err, "Function-Alias Collision on '" + SGA->getName() + + "': aliasee is not function"); + NewGA = new GlobalAlias(SGA->getType(), SGA->getLinkage(), SGA->getName(), DAliasee, Dest); CopyGVAttributes(NewGA, SGA); |