================
@@ -410,3 +409,91 @@ bool formatters::LibStdcppVariantSummaryProvider(
stream << " Active Type = " << active_type.GetDisplayTypeName() << " ";
return true;
}
+
+static std::optional<int64_t>
+LibStdcppExtractOrderingValue(ValueObject &valobj) {
+ lldb::ValueObjectSP value_sp = valobj.GetChildMemberWithName("_M_value");
+ if (!value_sp)
+ return std::nullopt;
+ bool success;
+ int64_t value = value_sp->GetValueAsSigned(0, &success);
+ if (!success)
+ return std::nullopt;
+ return value;
+}
+
+bool lldb_private::formatters::LibStdcppPartialOrderingSummaryProvider(
+ ValueObject &valobj, Stream &stream, const TypeSummaryOptions &options) {
+ std::optional<int64_t> value = LibStdcppExtractOrderingValue(valobj);
+ if (!value) {
+ stream << "Summary Unavailable";
+ return true;
+ }
+ switch (*value) {
+ case -1:
+ stream << "less";
+ break;
+ case 0:
+ stream << "equivalent";
+ break;
+ case 1:
+ stream << "greater";
+ break;
+ case -128:
+ case 2:
+ stream << "unordered";
+ break;
+ default:
+ stream << "Invalid partial ordering value";
----------------
da-viper wrote:
makes more sense to leave it unformatted if we do not know the case. incase the
value changes ?. applies to others.
https://github.com/llvm/llvm-project/pull/174195
_______________________________________________
lldb-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits