[PATCH] D43989: MRI delete command
Rafael Avila de Espindola via llvm-commits
llvm-commits at lists.llvm.org
Fri Mar 2 13:18:34 PST 2018
Dmitry Mikulin via Phabricator <reviews at reviews.llvm.org> writes:
> dmikulin updated this revision to Diff 136834.
> dmikulin added a comment.
>
> Changed the implementation to avoid writing the archive twice.
>
>
> https://reviews.llvm.org/D43989
>
> Files:
> llvm/test/tools/llvm-ar/mri-delete.test
> llvm/tools/llvm-ar/llvm-ar.cpp
>
>
> Index: llvm/tools/llvm-ar/llvm-ar.cpp
> ===================================================================
> --- llvm/tools/llvm-ar/llvm-ar.cpp
> +++ llvm/tools/llvm-ar/llvm-ar.cpp
> @@ -488,6 +488,17 @@
> Members[Pos] = std::move(*NMOrErr);
> }
>
> +static void deleteMember(std::vector<NewArchiveMember> &Members,
> + StringRef FileName) {
> + StringRef MemberName = sys::path::filename(FileName);
> + for (auto Member = Members.begin(); Member != Members.end();) {
> + if (Member->MemberName == MemberName)
> + Member = Members.erase(Member);
> + else
> + ++Member;
> + }
> +}
I think this is just llvm::erase_if, no?
Cheers,
Rafael
More information about the llvm-commits
mailing list