[llvm-commits] [dragonegg] r90839 - /dragonegg/trunk/llvm-backend.cpp

Duncan Sands baldrick at free.fr
Mon Dec 7 22:39:48 PST 2009


Author: baldrick
Date: Tue Dec  8 00:39:48 2009
New Revision: 90839

URL: http://llvm.org/viewvc/llvm-project?rev=90839&view=rev
Log:
Look up the ultimate transparent alias when handling weakrefs.  Not clear if this
is really needed, but it matches do_assemble_alias better.

Modified:
    dragonegg/trunk/llvm-backend.cpp

Modified: dragonegg/trunk/llvm-backend.cpp
URL: http://llvm.org/viewvc/llvm-project/dragonegg/trunk/llvm-backend.cpp?rev=90839&r1=90838&r2=90839&view=diff

==============================================================================
--- dragonegg/trunk/llvm-backend.cpp (original)
+++ dragonegg/trunk/llvm-backend.cpp Tue Dec  8 00:39:48 2009
@@ -1639,6 +1639,10 @@
   GlobalValue *V = cast<GlobalValue>(DECL_LLVM(decl));
 
   GlobalValue *Aliasee;
+  bool weakref = lookup_attribute ("weakref", DECL_ATTRIBUTES (decl));
+  if (weakref)
+    while (IDENTIFIER_TRANSPARENT_ALIAS(target))
+      target = TREE_CHAIN (target);
 
   if (TREE_CODE(target) == IDENTIFIER_NODE) {
     // This is something insane. Probably only LTHUNKs can be here
@@ -1659,7 +1663,7 @@
     }
 
     if (!Aliasee) {
-      if (lookup_attribute ("weakref", DECL_ATTRIBUTES (decl))) {
+      if (weakref) {
         if (GlobalVariable *GV = dyn_cast<GlobalVariable>(V))
           Aliasee = new GlobalVariable(*TheModule, GV->getType(),
                                        GV->isConstant(),





More information about the llvm-commits mailing list