Use the dedicated TypeMapOverride item as the decl_id for MappedType.
This partially undoes the original CL that even added type map overrides, but I think it's for good cause. Now that we _have_ a decl, it makes sense to hang the type off of it in general. And in specific, this gives us a place to configure the mapped type. A followup CL will allow marking these as not `c_abi_compatible`, so that we don't get UB from round-tripping structs with blob fields.
However, this is not to say it's necessarily a clean CL. Note that we now need to _explicitly_ decide what to do with methods. Before this CL, they'd all get suppressed because their Self type wasn't present. Now that we generate an item ID for the self type, but it isn't a Record, this breaks how methods work a bit.
Actually, methods are mostly not visited (since we don't recursively visit the members of the record), but there's at least one circumstance where they are which I don't fully understand (it doesn't show up in the final product either way) - at any rate, the most flexible/reasonable thing to do is gracefully handle the incorrectly typed `this`.
(Rather than try anything fancy, I suppress them by replacing a panic with a result.)
This also ended up requiring a predecessor CL to get working with our existing tests.
BTW, as a final note, note that I straight up serialize the whole C++ type name as a string, the way we do for MappedType, but not the way we do for records etc. I wonder if that's wise? It made the logic a lot simpler!
PiperOrigin-RevId: 535736013
diff --git a/rs_bindings_from_cc/importer.cc b/rs_bindings_from_cc/importer.cc
index 4c6fa23..df5004a 100644
--- a/rs_bindings_from_cc/importer.cc
+++ b/rs_bindings_from_cc/importer.cc
@@ -763,8 +763,8 @@
// Qualifiers are handled separately in ConvertQualType().
std::string type_string = clang::QualType(type, 0).getAsString();
- CRUBIT_ASSIGN_OR_RETURN(auto override_type, GetTypeMapOverride(*type));
- if (override_type.has_value()) {
+ if (auto override_type = GetTypeMapOverride(*type);
+ override_type.has_value()) {
return *std::move(override_type);
} else if (type->isPointerType() || type->isLValueReferenceType() ||
type->isRValueReferenceType()) {