[llvm-commits] [dragonegg] r142651 - /dragonegg/trunk/src/Backend.cpp

Duncan Sands baldrick at free.fr
Fri Oct 21 08:11:51 PDT 2011


Author: baldrick
Date: Fri Oct 21 10:11:51 2011
New Revision: 142651

URL: http://llvm.org/viewvc/llvm-project?rev=142651&view=rev
Log:
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/trunk/src/Backend.cpp

Modified: dragonegg/trunk/src/Backend.cpp
URL: http://llvm.org/viewvc/llvm-project/dragonegg/trunk/src/Backend.cpp?rev=142651&r1=142650&r2=142651&view=diff
==============================================================================
--- dragonegg/trunk/src/Backend.cpp (original)
+++ dragonegg/trunk/src/Backend.cpp Fri Oct 21 10:11:51 2011
@@ -1117,8 +1117,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