[Lldb-commits] [PATCH] D39733: Simplify NativeProcessProtocol::GetArchitecture/GetByteOrder

Greg Clayton via Phabricator via lldb-commits lldb-commits at lists.llvm.org
Tue Nov 7 15:06:04 PST 2017


clayborg requested changes to this revision.
clayborg added a comment.
This revision now requires changes to proceed.

Looks fine. Seems like you should use your a const reference in a few places and this will be good to go?



================
Comment at: source/Plugins/Process/Linux/NativeRegisterContextLinux_mips64.cpp:1036
   if (error.Success()) {
-    lldb_private::ArchSpec arch;
-    if (m_thread.GetProcess().GetArchitecture(arch)) {
-      void *target_address = ((uint8_t *)&regs) + offset +
-                             4 * (arch.GetMachine() == llvm::Triple::mips);
-      value.SetUInt(*(uint32_t *)target_address, size);
-    } else
-      error.SetErrorString("failed to get architecture");
+    lldb_private::ArchSpec arch = m_thread.GetProcess().GetArchitecture();
+    void *target_address = ((uint8_t *)&regs) + offset +
----------------
Avoid a copy here by using a const reference?


================
Comment at: source/Plugins/Process/NetBSD/NativeThreadNetBSD.cpp:147
 
-  ArchSpec target_arch;
-  if (!m_process.GetArchitecture(target_arch))
-    return NativeRegisterContextSP();
+  ArchSpec target_arch = m_process.GetArchitecture();
 
----------------
Void a copy here and use a const reference?


https://reviews.llvm.org/D39733





More information about the lldb-commits mailing list