Index: llvm/tools/llvm-ar/llvm-ar.cpp =================================================================== --- llvm/tools/llvm-ar/llvm-ar.cpp +++ llvm/tools/llvm-ar/llvm-ar.cpp @@ -770,7 +770,7 @@ } static void runMRIScript(const MemoryBuffer &Ref) { - enum class MRICommand { AddLib, AddMod, Create, Save, End, Invalid }; + enum class MRICommand { AddLib, AddMod, Create, Delete, Save, End, Invalid }; bool Saved = false; std::vector NewMembers; @@ -788,6 +788,7 @@ .Case("addlib", MRICommand::AddLib) .Case("addmod", MRICommand::AddMod) .Case("create", MRICommand::Create) + .Case("delete", MRICommand::Delete) .Case("save", MRICommand::Save) .Case("end", MRICommand::End) .Default(MRICommand::Invalid); @@ -822,6 +823,9 @@ fail("File already saved"); ArchiveName = Rest; break; + case MRICommand::Delete: + Members.push_back(Rest); + break; case MRICommand::Save: Saved = true; break; @@ -833,8 +837,11 @@ } // Nothing to do if not saved. - if (Saved) + if (Saved) { performOperation(ReplaceOrInsert, &NewMembers); + if (!Members.empty()) + performOperation(Delete, nullptr); + } exit(0); }