[PATCH] D40606: [Support/TarWriter] - Don't allow TarWriter to add the same file more than once.

Rafael Avila de Espindola via llvm-commits llvm-commits at lists.llvm.org
Fri Dec 1 09:24:47 PST 2017


George Rimar via Phabricator <reviews at reviews.llvm.org> writes:

> +  size_t SingleFileTarSize;
> +  {
> +    Expected<std::unique_ptr<TarWriter>> TarOrErr = TarWriter::create(Path, "");
> +    EXPECT_TRUE((bool)TarOrErr);
> +    std::unique_ptr<TarWriter> Tar = std::move(*TarOrErr);
> +    Tar->append("FooPath", "foo");
> +    Tar.reset();
> +
> +    ErrorOr<std::unique_ptr<MemoryBuffer>> MBOrErr =
> +        MemoryBuffer::getFile(Path);
> +    EXPECT_TRUE((bool)MBOrErr);
> +    SingleFileTarSize = (*MBOrErr)->getBufferSize();

You can use status(..).getSize();

LGTM with that.

Cheers,
Rafael


More information about the llvm-commits mailing list