mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2024-11-04 06:09:05 +00:00
Add sanity checks
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@48184 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
parent
b8cdaf7099
commit
ed61c0bc76
@ -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);
|
||||
|
Loading…
Reference in New Issue
Block a user