diff --git a/llvm/lib/Target/CBackend/Writer.cpp b/llvm/lib/Target/CBackend/Writer.cpp index 491b3484119a..4284dcc8c0dd 100644 --- a/llvm/lib/Target/CBackend/Writer.cpp +++ b/llvm/lib/Target/CBackend/Writer.cpp @@ -226,7 +226,7 @@ bool CBackendNameAllUsedStructs::run(Module &M) { // If this is not used, remove it from the symbol table. std::set::iterator UTI = UT.find(STy); if (UTI == UT.end()) - MST.remove(I->first, (Type*)I->second); + MST.remove(I); else UT.erase(UTI); } @@ -239,7 +239,7 @@ bool CBackendNameAllUsedStructs::run(Module &M) { for (std::set::const_iterator I = UT.begin(), E = UT.end(); I != E; ++I) if (const StructType *ST = dyn_cast(*I)) { - ((Value*)ST)->setName("unnamed", &MST); + const_cast(ST)->setName("unnamed", &MST); Changed = true; } return Changed;