[llvm-branch-commits] [llvm-branch] r134499 - /llvm/branches/type-system-rewrite/lib/Linker/LinkModules.cpp

Chris Lattner sabre at nondot.org
Wed Jul 6 10:17:17 PDT 2011


Author: lattner
Date: Wed Jul  6 12:17:17 2011
New Revision: 134499

URL: http://llvm.org/viewvc/llvm-project?rev=134499&view=rev
Log:
fix crash on Linker/2003-08-28-TypeResolvesGlobal.ll

Modified:
    llvm/branches/type-system-rewrite/lib/Linker/LinkModules.cpp

Modified: llvm/branches/type-system-rewrite/lib/Linker/LinkModules.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/branches/type-system-rewrite/lib/Linker/LinkModules.cpp?rev=134499&r1=134498&r2=134499&view=diff
==============================================================================
--- llvm/branches/type-system-rewrite/lib/Linker/LinkModules.cpp (original)
+++ llvm/branches/type-system-rewrite/lib/Linker/LinkModules.cpp Wed Jul  6 12:17:17 2011
@@ -288,6 +288,12 @@
   // and is not required for the prettiness of the linked module, we just skip
   // it and always rebuild a type here.
   StructType *STy = cast<StructType>(Ty);
+  
+  // If the type is opaque, we can just use it directly.  Otherwise we create a
+  // new type and resolve its body later.
+  if (STy->isOpaque())
+    return *Entry = STy;
+  
   DefinitionsToResolve.push_back(STy);
   return *Entry = StructType::createNamed(STy->getContext(), "");
 }





More information about the llvm-branch-commits mailing list