This is an archive of the discontinued LLVM Phabricator instance.

[lldb] Fix a 32 bit warning in ScriptedProcessInterface
ClosedPublic

Authored by DavidSpickett on Mar 15 2023, 3:36 AM.

Details

Summary

../llvm-project/lldb/include/lldb/Interpreter/ScriptedProcessInterface.h:61:12:
warning: implicit conversion from 'unsigned long long' to 'size_t' (aka 'unsigned int')
changes value from 18446744073709551615 to 4294967295 [-Wconstant-conversion]
../llvm-project/lldb/source/Plugins/Process/scripted/ScriptedProcess.cpp:275:39:
warning: result of comparison of constant 18446744073709551615 with expression
of type 'size_t' (aka 'unsigned int') is always false [-Wtautological-constant-out-of-range-compare]

This happens because size_t on 32 bit is 32 bit, but LLDB_INVALID_OFFSET is
UINT64_MAX. Return lldb::offset_t instead, which is 64 bit everywhere.

DoWriteMemory still returns size_t but this is because every other
Process derived thing does that. As long as the failure check works I think
it should be fine.

Diff Detail

Event Timeline

DavidSpickett created this revision.Mar 15 2023, 3:36 AM
Herald added a project: Restricted Project. · View Herald TranscriptMar 15 2023, 3:36 AM
DavidSpickett requested review of this revision.Mar 15 2023, 3:36 AM
Herald added a project: Restricted Project. · View Herald TranscriptMar 15 2023, 3:36 AM

This is pretty trivial but asking for review since I have no experience using this (and am not using it on 32 bit, just want to silence the warning).

mib accepted this revision.Mar 21 2023, 8:02 AM

LGTM! Thanks!

This revision is now accepted and ready to land.Mar 21 2023, 8:02 AM