[lldb] Rewrite Scalar::Promote
authorPavel Labath <pavel@labath.sk>
Fri, 26 Jun 2020 09:32:22 +0000 (11:32 +0200)
committerPavel Labath <pavel@labath.sk>
Fri, 26 Jun 2020 09:46:47 +0000 (11:46 +0200)
commitce275d3030a9dfcf9c55c81b88ae1b2c88f1828f
tree66b5402c0723b44f471150bc795c45140ffa7dca
parent0ccfe1b267af84360c1ab6b7e5a1366e1aa8ef7d
[lldb] Rewrite Scalar::Promote

This function was implementing c-like promotion rules by switching on
the both types. C promotion rules are complicated, but they are not
*that* complicated -- they basically boil down to:
- wider types trump narrower ones
- unsigned trump signed
- floating point trumps integral

With a couple of helper functions, we can rewrite the function in terms
of these rules and greatly reduce the size and complexity of this
function.
lldb/source/Utility/Scalar.cpp