================
@@ -5043,8 +5046,27 @@ static void ParseEnums(
LLDB_LOG(log,
"ProcessGDBRemote::ParseEnums Found enum type \"{0}\"",
id);
- registers_enum_types.insert_or_assign(
- id, std::make_unique<RegisterTypeEnum>(id, enumerators));
+ auto enum_type =
+ std::make_unique<RegisterTypeEnum>(id, enumerators);
+ const RegisterTypeEnum *enum_type_ptr = enum_type.get();
+ auto [it, inserted] =
+ feature_register_types.try_emplace(id, enum_type_ptr);
+ if (inserted) {
+ owned_register_types.push_back(std::move(enum_type));
+ } else if (llvm::isa<RegisterTypeEnum>(it->second)) {
+ // Preserve the existing behavior where the last valid enum with
+ // a repeated ID wins. All enums are parsed before flags, so no
+ // fields can reference the enum being replaced yet. The earlier
+ // object remains owned; only the feature lookup is updated.
----------------
DavidSpickett wrote:
> The earlier object remains owned
This is fine and will get solved if/when we move to parsing each element as we
find it rather than parsing all of one element type each time.
https://github.com/llvm/llvm-project/pull/216384
_______________________________________________
lldb-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits