[all-commits] [llvm/llvm-project] 67cdb8: [lldb/Utility] Simplify and generalize Scalar class

Pavel Labath via All-commits all-commits at lists.llvm.org
Mon Aug 17 02:16:12 PDT 2020


  Branch: refs/heads/master
  Home:   https://github.com/llvm/llvm-project
  Commit: 67cdb899c6b3ec231f35ca17a00023758ef127ba
      https://github.com/llvm/llvm-project/commit/67cdb899c6b3ec231f35ca17a00023758ef127ba
  Author: Pavel Labath <pavel at labath.sk>
  Date:   2020-08-17 (Mon, 17 Aug 2020)

  Changed paths:
    M lldb/include/lldb/Utility/Scalar.h
    M lldb/source/Utility/Scalar.cpp
    M lldb/unittests/Utility/ScalarTest.cpp

  Log Message:
  -----------
  [lldb/Utility] Simplify and generalize Scalar class

The class contains an enum listing all host integer types as well as
some non-host types. This setup is a remnant of a time when this class
was actually implemented in terms of host integer types. Now that we are
using llvm::APInt, they are mostly useless and mean that each function
needs to enumerate all of these cases even though it treats most of them
identically.

I only leave e_sint and e_uint to denote the integer signedness, but I
want to remove that in a follow-up as well.

Removing these cases simplifies most of these functions, with the only
exception being PromoteToMaxType, which can no longer rely on a simple
enum comparison to determine what needs to be promoted.

This also makes the class ready to work with arbitrary integer sizes, so
it does not need to be modified when someone needs to add a larger
integer size.

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




More information about the All-commits mailing list