From f405dd62ecd67d8d4d389620d7c3949af0707bdc Mon Sep 17 00:00:00 2001 From: Argyrios Kyrtzidis Date: Sat, 23 Nov 2013 18:41:35 +0000 Subject: [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 --- clang/lib/CodeGen/CodeGenModule.cpp | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'clang/lib/CodeGen/CodeGenModule.cpp') diff --git a/clang/lib/CodeGen/CodeGenModule.cpp b/clang/lib/CodeGen/CodeGenModule.cpp index 8240f8d..2acb2ec 100644 --- a/clang/lib/CodeGen/CodeGenModule.cpp +++ b/clang/lib/CodeGen/CodeGenModule.cpp @@ -2100,6 +2100,10 @@ void CodeGenModule::EmitGlobalFunctionDefinition(GlobalDecl GD) { Entry = CE->getOperand(0); } + if (!cast(Entry)->isDeclaration()) { + getDiags().Report(D->getLocation(), diag::err_duplicate_mangled_name); + return; + } if (cast(Entry)->getType()->getElementType() != Ty) { llvm::GlobalValue *OldFn = cast(Entry); -- cgit v1.1