From 9d1af97d02e9a0b985e940e950ed659b812c5f3f Mon Sep 17 00:00:00 2001 From: Chris Lattner Date: Fri, 28 May 2004 05:47:27 +0000 Subject: [PATCH] Fix the big regression that has been killing the nightly tester these last 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 | 4 +++- lib/Target/CBackend/Writer.cpp | 4 +++- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/lib/Target/CBackend/CBackend.cpp b/lib/Target/CBackend/CBackend.cpp index 4284dcc8c0d..b73a4e40cd8 100644 --- a/lib/Target/CBackend/CBackend.cpp +++ b/lib/Target/CBackend/CBackend.cpp @@ -236,10 +236,12 @@ bool CBackendNameAllUsedStructs::run(Module &M) { // structure types. // bool Changed = false; + unsigned RenameCounter = 0; for (std::set::const_iterator I = UT.begin(), E = UT.end(); I != E; ++I) if (const StructType *ST = dyn_cast(*I)) { - const_cast(ST)->setName("unnamed", &MST); + while (M.addTypeName("unnamed"+utostr(RenameCounter), ST)) + ++RenameCounter; Changed = true; } return Changed; diff --git a/lib/Target/CBackend/Writer.cpp b/lib/Target/CBackend/Writer.cpp index 4284dcc8c0d..b73a4e40cd8 100644 --- a/lib/Target/CBackend/Writer.cpp +++ b/lib/Target/CBackend/Writer.cpp @@ -236,10 +236,12 @@ bool CBackendNameAllUsedStructs::run(Module &M) { // structure types. // bool Changed = false; + unsigned RenameCounter = 0; for (std::set::const_iterator I = UT.begin(), E = UT.end(); I != E; ++I) if (const StructType *ST = dyn_cast(*I)) { - const_cast(ST)->setName("unnamed", &MST); + while (M.addTypeName("unnamed"+utostr(RenameCounter), ST)) + ++RenameCounter; Changed = true; } return Changed; -- 2.34.1