[llvm-branch-commits] [cfe-branch] r195623 - Merging r195556:

Bill Wendling isanbard at gmail.com
Sun Nov 24 23:42:53 PST 2013


Author: void
Date: Mon Nov 25 01:42:52 2013
New Revision: 195623

URL: http://llvm.org/viewvc/llvm-project?rev=195623&view=rev
Log:
Merging r195556:
------------------------------------------------------------------------
r195556 | akirtzidis | 2013-11-23 10:41:35 -0800 (Sat, 23 Nov 2013) | 3 lines

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

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

Modified:
    cfe/branches/release_34/   (props changed)
    cfe/branches/release_34/include/clang/Basic/DiagnosticSemaKinds.td
    cfe/branches/release_34/lib/CodeGen/CodeGenModule.cpp

Propchange: cfe/branches/release_34/
------------------------------------------------------------------------------
--- svn:mergeinfo (original)
+++ svn:mergeinfo Mon Nov 25 01:42:52 2013
@@ -1,4 +1,4 @@
 /cfe/branches/type-system-rewrite:134693-134817
-/cfe/trunk:195126,195128,195135-195136,195146,195149,195154,195158,195163,195168,195174,195268,195283,195326,195329,195367,195384,195501,195547,195558
+/cfe/trunk:195126,195128,195135-195136,195146,195149,195154,195158,195163,195168,195174,195268,195283,195326,195329,195367,195384,195501,195547,195556,195558
 /cfe/trunk/test:170344
 /cfe/trunk/test/SemaTemplate:126920

Modified: cfe/branches/release_34/include/clang/Basic/DiagnosticSemaKinds.td
URL: http://llvm.org/viewvc/llvm-project/cfe/branches/release_34/include/clang/Basic/DiagnosticSemaKinds.td?rev=195623&r1=195622&r2=195623&view=diff
==============================================================================
--- cfe/branches/release_34/include/clang/Basic/DiagnosticSemaKinds.td (original)
+++ cfe/branches/release_34/include/clang/Basic/DiagnosticSemaKinds.td Mon Nov 25 01:42:52 2013
@@ -2030,6 +2030,8 @@ def err_alias_not_supported_on_darwin :
   "only weak aliases are supported on darwin">;
 def err_alias_to_undefined : Error<
   "alias must point to a defined variable or function">;
+def err_duplicate_mangled_name : Error<
+  "definition with same mangled name as another definition">;
 def err_cyclic_alias : Error<
   "alias definition is part of a cycle">;
 def warn_attribute_wrong_decl_type : Warning<

Modified: cfe/branches/release_34/lib/CodeGen/CodeGenModule.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/branches/release_34/lib/CodeGen/CodeGenModule.cpp?rev=195623&r1=195622&r2=195623&view=diff
==============================================================================
--- cfe/branches/release_34/lib/CodeGen/CodeGenModule.cpp (original)
+++ cfe/branches/release_34/lib/CodeGen/CodeGenModule.cpp Mon Nov 25 01:42:52 2013
@@ -2095,6 +2095,10 @@ void CodeGenModule::EmitGlobalFunctionDe
     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);





More information about the llvm-branch-commits mailing list