================
@@ -127,6 +127,151 @@ Interpreter::UnaryConversion(lldb::ValueObjectSP valobj,
uint32_t location) {
return valobj;
}
+/// Basic types with a lower rank are converted to the basic type
+/// with a higher rank.
+static size_t ConversionRank(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;
+ case lldb::eBasicTypeHalf:
+ return 8;
+ case lldb::eBasicTypeFloat:
+ return 9;
+ case lldb::eBasicTypeDouble:
+ return 10;
+ case lldb::eBasicTypeLongDouble:
+ return 11;
+ default:
+ break;
+ }
+ return 0;
+}
+
+static lldb::BasicType BasicTypeToUnsigned(lldb::BasicType basic_type) {
+ switch (basic_type) {
+ case lldb::eBasicTypeChar:
+ case lldb::eBasicTypeSignedChar:
+ return lldb::eBasicTypeUnsignedChar;
+ case lldb::eBasicTypeShort:
+ return lldb::eBasicTypeUnsignedShort;
+ case lldb::eBasicTypeInt:
+ return lldb::eBasicTypeUnsignedInt;
+ case lldb::eBasicTypeLong:
+ return lldb::eBasicTypeUnsignedLong;
+ case lldb::eBasicTypeLongLong:
+ return lldb::eBasicTypeUnsignedLongLong;
+ case lldb::eBasicTypeInt128:
+ return lldb::eBasicTypeUnsignedInt128;
+ default:
+ return basic_type;
+ }
+}
+
+llvm::Expected<CompilerType>
+Interpreter::PromoteSignedInteger(CompilerType &lhs_type,
+ CompilerType &rhs_type) {
+ // This expects that Rank(lhs_type) < Rank(rhs_type).
----------------
Michael137 wrote:
Probably better to move this comment to the header docs
https://github.com/llvm/llvm-project/pull/177208
_______________________________________________
lldb-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits