[llvm] r253311 - Add MemoryBufferRef(MemoryBuffer&) constructor.
Duncan P. N. Exon Smith via llvm-commits
llvm-commits at lists.llvm.org
Tue Nov 17 10:11:57 PST 2015
> On 2015-Nov-16, at 21:11, Rafael Espindola via llvm-commits <llvm-commits at lists.llvm.org> wrote:
>
> Author: rafael
> Date: Mon Nov 16 23:11:44 2015
> New Revision: 253311
>
> URL: http://llvm.org/viewvc/llvm-project?rev=253311&view=rev
> Log:
> Add MemoryBufferRef(MemoryBuffer&) constructor.
>
> patch by Jonathan Anderson!
>
> Modified:
> llvm/trunk/include/llvm/Support/MemoryBuffer.h
> llvm/trunk/unittests/Support/MemoryBufferTest.cpp
>
> Modified: llvm/trunk/include/llvm/Support/MemoryBuffer.h
> URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/Support/MemoryBuffer.h?rev=253311&r1=253310&r2=253311&view=diff
> ==============================================================================
> --- llvm/trunk/include/llvm/Support/MemoryBuffer.h (original)
> +++ llvm/trunk/include/llvm/Support/MemoryBuffer.h Mon Nov 16 23:11:44 2015
> @@ -152,6 +152,8 @@ class MemoryBufferRef {
>
> public:
> MemoryBufferRef() {}
> + MemoryBufferRef(MemoryBuffer& Buffer)
> + : Buffer(Buffer.getBuffer()), Identifier(Buffer.getBufferIdentifier()) {}
> MemoryBufferRef(StringRef Buffer, StringRef Identifier)
> : Buffer(Buffer), Identifier(Identifier) {}
>
>
> Modified: llvm/trunk/unittests/Support/MemoryBufferTest.cpp
> URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/unittests/Support/MemoryBufferTest.cpp?rev=253311&r1=253310&r2=253311&view=diff
> ==============================================================================
> --- llvm/trunk/unittests/Support/MemoryBufferTest.cpp (original)
> +++ llvm/trunk/unittests/Support/MemoryBufferTest.cpp Mon Nov 16 23:11:44 2015
> @@ -170,6 +170,15 @@ TEST_F(MemoryBufferTest, getOpenFileReop
> }
>
>
> +TEST_F(MemoryBufferTest, reference) {
> + OwningBuffer MB(MemoryBuffer::getMemBuffer(data));
> + MemoryBufferRef MBR(*MB);
> +
> + EXPECT_EQ(MB->getBufferStart(), MBR.getBufferStart());
> + EXPECT_EQ(MB->getBufferIdentifier(), MBR.getBufferIdentifier());
> +}
> +
> +
Why are there two blank lines between tests in this file? Seems
like a strange style (I assume clang-format disagrees).
> TEST_F(MemoryBufferTest, slice) {
> // Create a file that is six pages long with different data on each page.
> int FD;
>
>
> _______________________________________________
> llvm-commits mailing list
> llvm-commits at lists.llvm.org
> http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-commits
More information about the llvm-commits
mailing list