[Lldb-commits] [PATCH] D90325: [lldb][NFC] Refactor getUUID functionality

Pavel Labath via Phabricator via lldb-commits lldb-commits at lists.llvm.org
Fri Oct 30 08:09:06 PDT 2020


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

lgtm, modulo the comment.



================
Comment at: lldb/source/Plugins/Process/minidump/MinidumpParser.cpp:75
     }
-    if (pdb70_uuid->Age != 0)
-      return UUID::fromOptionalData(pdb70_uuid, sizeof(*pdb70_uuid));
-    return UUID::fromOptionalData(&pdb70_uuid->Uuid, sizeof(pdb70_uuid->Uuid));
+    UUID::CvRecordPdb70 debug_info = *pdb70_uuid;
+    return UUID::fromCvRecord(debug_info);
----------------
Once the reference is gone, you also don't need to make a copy here.


================
Comment at: lldb/source/Utility/UUID.cpp:38
 
+UUID UUID::fromData(const UUID::CvRecordPdb70 *debug_info, bool swapByteOrder) {
+  UUID::CvRecordPdb70 swapped;
----------------
labath wrote:
> You could just take the argument by value, and then byte-swap it in-place.
My previous comments were a bit confusing, but taking the argument by a mutable reference, was not what I intended. :(
I first wanted to use a const reference as that's better than a pointer, but then I realized that you're also making a copy, so it would be better if we just had the compiler do that. So you can just drop the reference now.

Sorry.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D90325



More information about the lldb-commits mailing list