[llvm-commits] [dragonegg] r142680 - in /dragonegg/branches/release_30: ./ src/Backend.cpp

Bill Wendling isanbard at gmail.com
Fri Oct 21 13:27:13 PDT 2011


Author: void
Date: Fri Oct 21 15:27:13 2011
New Revision: 142680

URL: http://llvm.org/viewvc/llvm-project?rev=142680&view=rev
Log:
Merging r142651:
------------------------------------------------------------------------
r142651 | baldrick | 2011-10-21 08:11:51 -0700 (Fri, 21 Oct 2011) | 4 lines

Functions can collide with global aliases as well as global values.  Update
this ancient code (which probably predates support for aliases in LLVM...)
Fixes PR11182.

------------------------------------------------------------------------

Modified:
    dragonegg/branches/release_30/   (props changed)
    dragonegg/branches/release_30/src/Backend.cpp

Propchange: dragonegg/branches/release_30/
------------------------------------------------------------------------------
--- svn:mergeinfo (original)
+++ svn:mergeinfo Fri Oct 21 15:27:13 2011
@@ -1 +1 @@
-/dragonegg/trunk:142351,142575
+/dragonegg/trunk:142351,142575,142651

Modified: dragonegg/branches/release_30/src/Backend.cpp
URL: http://llvm.org/viewvc/llvm-project/dragonegg/branches/release_30/src/Backend.cpp?rev=142680&r1=142679&r2=142680&view=diff
==============================================================================
--- dragonegg/branches/release_30/src/Backend.cpp (original)
+++ dragonegg/branches/release_30/src/Backend.cpp Fri Oct 21 15:27:13 2011
@@ -1115,8 +1115,9 @@
       // in the symbol table.  If this happens, the old one must be a forward
       // decl, just replace it with a cast of the new one.
       if (FnEntry->getName() != Name) {
-        GlobalVariable *G = TheModule->getGlobalVariable(Name, true);
-        assert(G && G->isDeclaration() && "A global turned into a function?");
+        GlobalValue *G = TheModule->getNamedValue(Name);
+        assert(G && (G->isDeclaration() || G->isWeakForLinker()) &&
+               "A global turned into a function?");
 
         // Replace any uses of "G" with uses of FnEntry.
         Constant *GInNewType = TheFolder->CreateBitCast(FnEntry, G->getType());





More information about the llvm-commits mailing list