================
@@ -127,6 +127,87 @@ Interpreter::UnaryConversion(lldb::ValueObjectSP valobj,
uint32_t location) {
return valobj;
}
+static size_t IntegerConversionRank(CompilerType type) {
+ switch (type.GetCanonicalType().GetBasicTypeEnumeration()) {
+ case lldb::eBasicTypeBool:
+ return 1;
+ case lldb::eBasicTypeChar:
+ case lldb::eBasicTypeSignedChar:
+ case lldb::eBasicTypeUnsignedChar:
+ return 2;
+ case lldb::eBasicTypeShort:
+ case lldb::eBasicTypeUnsignedShort:
+ return 3;
+ case lldb::eBasicTypeInt:
+ case lldb::eBasicTypeUnsignedInt:
+ return 4;
+ case lldb::eBasicTypeLong:
+ case lldb::eBasicTypeUnsignedLong:
+ return 5;
+ case lldb::eBasicTypeLongLong:
+ case lldb::eBasicTypeUnsignedLongLong:
+ return 6;
+ case lldb::eBasicTypeInt128:
+ case lldb::eBasicTypeUnsignedInt128:
+ return 7;
+ default:
+ break;
+ }
+ return 0;
+}
+
+llvm::Expected<CompilerType>
+Interpreter::ArithmeticConversion(lldb::ValueObjectSP &lhs,
+ lldb::ValueObjectSP &rhs, uint32_t location)
{
+ // Apply unary conversion for both operands.
+ auto lhs_or_err = UnaryConversion(lhs, location);
+ if (!lhs_or_err)
+ return lhs_or_err.takeError();
+ lhs = *lhs_or_err;
+ auto rhs_or_err = UnaryConversion(rhs, location);
+ if (!rhs_or_err)
+ return rhs_or_err.takeError();
+ rhs = *rhs_or_err;
+
+ CompilerType lhs_type = lhs->GetCompilerType();
+ CompilerType rhs_type = rhs->GetCompilerType();
+
+ if (lhs_type.CompareTypes(rhs_type))
----------------
Michael137 wrote:
I.e., if the two types are equal, no need for conversion?
https://github.com/llvm/llvm-project/pull/177208
_______________________________________________
lldb-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits