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 | 0a67e053fc7ccb6c0639de021f0c47140f8e722d (patch) | |
tree | e45fee5abf300e70fe297476dd54ae2e04d78aa3 /lib/Linker | |
parent | 552ccce86a66c19691c71036c269cf85724a79d4 (diff) | |
download | external_llvm-0a67e053fc7ccb6c0639de021f0c47140f8e722d.zip external_llvm-0a67e053fc7ccb6c0639de021f0c47140f8e722d.tar.gz external_llvm-0a67e053fc7ccb6c0639de021f0c47140f8e722d.tar.bz2 |
Add sanity checks
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@48184 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Linker')
-rw-r--r-- | lib/Linker/LinkModules.cpp | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/lib/Linker/LinkModules.cpp b/lib/Linker/LinkModules.cpp index 53fce48..3d6e526 100644 --- a/lib/Linker/LinkModules.cpp +++ b/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); |