[PATCH] D56688: Make CompilerType::getBitSize() / getByteSize() return an optional result. (NFC)

Zachary Turner via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Jan 15 11:11:43 PST 2019


zturner added inline comments.


================
Comment at: include/lldb/Target/ProcessStructReader.h:70
     }
-    size_t total_size = struct_type.GetByteSize(nullptr);
-    lldb::DataBufferSP buffer_sp(new DataBufferHeap(total_size, 0));
+    auto total_size = struct_type.GetByteSize(nullptr);
+    if (!total_size)
----------------
zturner wrote:
> I think we shouldn't use `auto` here, although this is a minor nit and I don't feel strongly.
I actually changed my mind here.  I didn't feel strongly at first because I thought this was a `uint64_t`.  As I read through more of the patch, I realized it was an `Optional<uint64_t>`, which totally changes the semantics.  So now I do feel more strongly


Repository:
  rL LLVM

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

https://reviews.llvm.org/D56688





More information about the llvm-commits mailing list