Skip to content

Commit 52db30e

Browse files
committed
[lldb] Fix compiler error in ValueObject tests
Fixes 0cbc498. error: non-constant-expression cannot be narrowed from type 'uint64_t' (aka 'unsigned long long') to 'size_t' (aka 'unsigned int') in initializer list [-Wc++11-narrowing] 71 | in_value.GetLocalBufferSize()}; | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~ Given this is test code, I think a static cast is fine here. Tiny risk that it's actually a symptom of a bug that would happen if you did 32-bit to 64-bit debugging. I expect you'd find a lot more bugs than that though.
1 parent 6424abc commit 52db30e

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

lldb/unittests/ValueObject/DynamicValueObjectLocalBuffer.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,7 @@ struct MockLanguageRuntime : public LanguageRuntime {
6868
class_type_or_name.SetCompilerType(int_type);
6969
local_buffer = {(uint8_t *)in_value.GetValue().GetScalar().ULongLong(
7070
LLDB_INVALID_ADDRESS),
71-
in_value.GetLocalBufferSize()};
71+
static_cast<size_t>(in_value.GetLocalBufferSize())};
7272
value_type = Value::ValueType::HostAddress;
7373

7474
return true;

0 commit comments

Comments
 (0)