[Lldb-commits] [PATCH] D113519: [lldb] [gdb-server] Fix fill_clamp to handle signed src types

Michał Górny via Phabricator via lldb-commits lldb-commits at lists.llvm.org
Tue Nov 9 23:53:16 PST 2021


mgorny marked an inline comment as done.
mgorny added inline comments.


================
Comment at: lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationServerCommon.cpp:776
+  constexpr auto T_max = std::numeric_limits<typename T::value_type>::max();
+  dest = src >= 0 && static_cast<UU>(src) <= T_max ? src : fallback;
 }
----------------
labath wrote:
> `T` will always be unsigned here, right? May not hurt to add a `static_assert` for that, mainly to avoid people wondering if this logic is correct...
Yes, and that makes the logic much simpler. I'll add the assert. Thanks!


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

https://reviews.llvm.org/D113519



More information about the lldb-commits mailing list