[PATCH] D137820: [MemoryBuffer] Allow optionally specifying desired buffer alignment

David Blaikie via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Fri Nov 11 15:51:42 PST 2022


dblaikie accepted this revision.
dblaikie added a comment.
This revision is now accepted and ready to land.

If you've got a use for it, this seems fine to me.



================
Comment at: llvm/unittests/Support/MemoryBufferTest.cpp:232-233
+    Align Alignment(AlignmentValue);
+    OwningBuffer AlignedBuffer(
+        WritableMemoryBuffer::getNewUninitMemBuffer(0, "", Alignment));
+    EXPECT_TRUE(isAddrAligned(Alignment, AlignedBuffer->getBufferStart()));
----------------
Prefer `=` over `()` when both are valid - makes it easier to read because it limits the code to only implicit ctors (so, as a reader, I don't worry that the function is returning a raw pointer & this is taking ownership - and want to go check that the raw pointer is really conferring ownership, etc)


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D137820/new/

https://reviews.llvm.org/D137820



More information about the llvm-commits mailing list