diff options
author | Argyrios Kyrtzidis <akyrtzi@gmail.com> | 2013-11-23 18:41:35 +0000 |
---|---|---|
committer | Argyrios Kyrtzidis <akyrtzi@gmail.com> | 2013-11-23 18:41:35 +0000 |
commit | 95056960417abcbbf81d95d1bad54ac020d8ba87 (patch) | |
tree | cf35bb13fd3f3394bacf02295c37a57224d921ce /lib/CodeGen/CodeGenModule.cpp | |
parent | 95390ce9e9f1ba4e618dd32a672b4f802e698c05 (diff) | |
download | clang-95056960417abcbbf81d95d1bad54ac020d8ba87.tar.gz clang-95056960417abcbbf81d95d1bad54ac020d8ba87.tar.bz2 clang-95056960417abcbbf81d95d1bad54ac020d8ba87.tar.xz |
[CodeGen] If there is a function definition with duplicate mangled name, emit an error instead of asserting.
rdar://15522601 & http://llvm.org/PR18031
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@195556 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/CodeGen/CodeGenModule.cpp')
-rw-r--r-- | lib/CodeGen/CodeGenModule.cpp | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/lib/CodeGen/CodeGenModule.cpp b/lib/CodeGen/CodeGenModule.cpp index 8240f8d38c..2acb2ec1e8 100644 --- a/lib/CodeGen/CodeGenModule.cpp +++ b/lib/CodeGen/CodeGenModule.cpp @@ -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); |