================
@@ -5043,8 +5046,20 @@ 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] = register_types.try_emplace(id,
enum_type_ptr);
+ if (inserted || llvm::isa<RegisterTypeEnum>(it->second)) {
----------------
barsolo2000 wrote:
You’re right. Replacing it is intentional: duplicate enum IDs use the last
valid definition. This is safe because enums are parsed before flags. I split
the cases and added a comment explaining it.
https://github.com/llvm/llvm-project/pull/216384
_______________________________________________
lldb-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits