[llvm-branch-commits] [llvm-branch] r134597 - /llvm/branches/type-system-rewrite/lib/Bitcode/Reader/BitcodeReader.cpp

Chris Lattner sabre at nondot.org
Wed Jul 6 21:47:00 PDT 2011


Author: lattner
Date: Wed Jul  6 23:47:00 2011
New Revision: 134597

URL: http://llvm.org/viewvc/llvm-project?rev=134597&view=rev
Log:
read the type symbol table from LLVM 2.9 bitcode files.  Only struct types keep their
name, but hey that's nice.

Modified:
    llvm/branches/type-system-rewrite/lib/Bitcode/Reader/BitcodeReader.cpp

Modified: llvm/branches/type-system-rewrite/lib/Bitcode/Reader/BitcodeReader.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/branches/type-system-rewrite/lib/Bitcode/Reader/BitcodeReader.cpp?rev=134597&r1=134596&r2=134597&view=diff
==============================================================================
--- llvm/branches/type-system-rewrite/lib/Bitcode/Reader/BitcodeReader.cpp (original)
+++ llvm/branches/type-system-rewrite/lib/Bitcode/Reader/BitcodeReader.cpp Wed Jul  6 23:47:00 2011
@@ -877,14 +877,7 @@
 
 
 bool BitcodeReader::ParseOldTypeSymbolTable() {
-  // Just skip the old type symbol table entirely.
-  Stream.ReadSubBlockID();
-  if (Stream.SkipBlock())
-    return Error("Malformed block record");
-  return false;
-  
-#if 0
-  if (Stream.EnterSubBlock(bitc::TYPE_SYMTAB_BLOCK_ID))
+  if (Stream.EnterSubBlock(bitc::TYPE_SYMTAB_BLOCK_ID_OLD))
     return Error("Malformed block record");
 
   SmallVector<uint64_t, 64> Record;
@@ -924,12 +917,14 @@
       if (TypeID >= TypeList.size())
         return Error("Invalid Type ID in TST_ENTRY record");
 
-      TheModule->addTypeName(TypeName, TypeList[TypeID].get());
+      // Only apply the type name to a struct type with no name.
+      if (StructType *STy = dyn_cast<StructType>(TypeList[TypeID]))
+        if (!STy->isAnonymous() && !STy->hasName())
+          STy->setName(TypeName);
       TypeName.clear();
       break;
     }
   }
-#endif
 }
 
 bool BitcodeReader::ParseValueSymbolTable() {





More information about the llvm-branch-commits mailing list