[all-commits] [llvm/llvm-project] 0bab7b: [lldb] Encode `bool` as unsigned int

Andy Hippo via All-commits all-commits at lists.llvm.org
Wed May 19 06:33:15 PDT 2021


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: 0bab7b26f4d9dc4cb8f6c2877ad4a2c388c41c65
      https://github.com/llvm/llvm-project/commit/0bab7b26f4d9dc4cb8f6c2877ad4a2c388c41c65
  Author: Andy Yankovsky <weratt at gmail.com>
  Date:   2021-05-19 (Wed, 19 May 2021)

  Changed paths:
    M lldb/source/Plugins/TypeSystem/Clang/TypeSystemClang.cpp
    M lldb/test/API/lang/cpp/bitfields/TestCppBitfields.py
    M lldb/test/API/lang/cpp/bitfields/main.cpp

  Log Message:
  -----------
  [lldb] Encode `bool` as unsigned int

`bool` is considered to be unsigned according to `std::is_unsigned<bool>::value` (and `Type::GetTypeInfo`). Encoding it as signed int works fine for normal variables and fields, but breaks when reading the values of boolean bitfields. If the field is declared as `bool b : 1` and has a value of `0b1`, the call to `SBValue::GetValueAsSigned()` will return `-1`.

Reviewed By: teemperor

Differential Revision: https://reviews.llvm.org/D102685




More information about the All-commits mailing list