Fix the big regression that has been killing the nightly tester these last
authorChris Lattner <sabre@nondot.org>
Fri, 28 May 2004 05:47:27 +0000 (05:47 +0000)
committerChris Lattner <sabre@nondot.org>
Fri, 28 May 2004 05:47:27 +0000 (05:47 +0000)
few days.  Apparently the old symbol table used to auto rename collisions in
the type symbol table and the new one does not.  It doesn't really make sense
for the new one to do so, so we just make the client do it.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@13877 91177308-0d34-0410-b5e6-96231b3b80d8

lib/Target/CBackend/CBackend.cpp
lib/Target/CBackend/Writer.cpp

index 4284dcc8c0ddd27387edf0264ce55b6e07be9875..b73a4e40cd852181704cb38df1eae02cd661e1d3 100644 (file)
@@ -236,10 +236,12 @@ bool CBackendNameAllUsedStructs::run(Module &M) {
   // structure types.
   //
   bool Changed = false;
+  unsigned RenameCounter = 0;
   for (std::set<const Type *>::const_iterator I = UT.begin(), E = UT.end();
        I != E; ++I)
     if (const StructType *ST = dyn_cast<StructType>(*I)) {
-      const_cast<StructType*>(ST)->setName("unnamed", &MST);
+      while (M.addTypeName("unnamed"+utostr(RenameCounter), ST))
+        ++RenameCounter;
       Changed = true;
     }
   return Changed;
index 4284dcc8c0ddd27387edf0264ce55b6e07be9875..b73a4e40cd852181704cb38df1eae02cd661e1d3 100644 (file)
@@ -236,10 +236,12 @@ bool CBackendNameAllUsedStructs::run(Module &M) {
   // structure types.
   //
   bool Changed = false;
+  unsigned RenameCounter = 0;
   for (std::set<const Type *>::const_iterator I = UT.begin(), E = UT.end();
        I != E; ++I)
     if (const StructType *ST = dyn_cast<StructType>(*I)) {
-      const_cast<StructType*>(ST)->setName("unnamed", &MST);
+      while (M.addTypeName("unnamed"+utostr(RenameCounter), ST))
+        ++RenameCounter;
       Changed = true;
     }
   return Changed;