[CodeGen] If there is a function definition with duplicate mangled name, emit an error instead of asserting.

rdar://15522601 & http://llvm.org/PR18031

llvm-svn: 195556
This commit is contained in:
Argyrios Kyrtzidis
2013-11-23 18:41:35 +00:00
parent 84c47a1074
commit f405dd62ec
2 changed files with 6 additions and 0 deletions

View File

@@ -2100,6 +2100,10 @@ void CodeGenModule::EmitGlobalFunctionDefinition(GlobalDecl GD) {
Entry = CE->getOperand(0);
}
if (!cast<llvm::GlobalValue>(Entry)->isDeclaration()) {
getDiags().Report(D->getLocation(), diag::err_duplicate_mangled_name);
return;
}
if (cast<llvm::GlobalValue>(Entry)->getType()->getElementType() != Ty) {
llvm::GlobalValue *OldFn = cast<llvm::GlobalValue>(Entry);