[Lldb-commits] [lldb] [LLDB] Add more helper functions to ValueObject class. (PR #87197)

via lldb-commits lldb-commits at lists.llvm.org
Wed Jun 5 13:58:01 PDT 2024


================
@@ -3138,13 +3141,13 @@ lldb::ValueObjectSP ValueObject::CastToBasicType(CompilerType type) {
     val_byte_size = temp.value();
 
   if (is_pointer) {
-    if (type.IsBoolean() && type_byte_size < val_byte_size) {
+    if (!type.IsBoolean() && type_byte_size < val_byte_size) {
----------------
jimingham wrote:

The `!` here seems right, but still this logic is odd.  

With this code, if I pass 32 bit float (on a 64 bit pointers system), the error I'll get is that it's too small.  OTOH, if I pass a 64 bit float, I'll get "must be integer".  That's confusing.  If you aren't planning to take anything but integers, it seems like you should check that first, then check the size.

https://github.com/llvm/llvm-project/pull/87197


More information about the lldb-commits mailing list