@@ -412,10 +412,16 @@ void ObjCProcessor::DefineObjCSymbol(
412412
413413 auto defineSymbol = [this ](Ref<Symbol> symbol, const Confidence<Ref<Type>>& type) {
414414 uint64_t symbolAddress = symbol->GetAddress ();
415- // Armv7/Thumb: This will rewrite the symbol's address.
416- // e.g. We pass in 0xc001, it will rewrite it to 0xc000 and create the function w/ the "thumb2" arch.
417415 if (Ref<Symbol> existingSymbol = m_data->GetSymbolByAddress (symbolAddress))
416+ {
417+ if (existingSymbol->IsAutoDefined () && existingSymbol->GetType () == symbol->GetType () && existingSymbol->GetRawNameRef () == symbol->GetRawNameRef ())
418+ return ;
419+
418420 m_data->UndefineAutoSymbol (existingSymbol);
421+ }
422+
423+ // Armv7/Thumb: This will rewrite the symbol's address.
424+ // e.g. We pass in 0xc001, it will rewrite it to 0xc000 and create the function w/ the "thumb2" arch.
419425 Ref<Platform> targetPlatform = m_data->GetDefaultPlatform ()->GetAssociatedPlatformByAddress (symbolAddress);
420426 if (symbol->GetType () == FunctionSymbol)
421427 {
@@ -1159,6 +1165,11 @@ void ObjCProcessor::GenerateClassTypes()
11591165{
11601166 for (auto & [_, cls] : m_classes)
11611167 {
1168+ QualifiedName classTypeName = cls.name ;
1169+ std::string classTypeId = Type::GenerateAutoTypeId (" objc" , classTypeName);
1170+ if (m_data->GetTypeById (classTypeId))
1171+ continue ;
1172+
11621173 QualifiedName typeName;
11631174 StructureBuilder classTypeBuilder;
11641175 bool failedToDecodeType = false ;
@@ -1191,8 +1202,6 @@ void ObjCProcessor::GenerateClassTypes()
11911202 if (failedToDecodeType)
11921203 continue ;
11931204 auto classTypeStruct = classTypeBuilder.Finalize ();
1194- QualifiedName classTypeName = cls.name ;
1195- std::string classTypeId = Type::GenerateAutoTypeId (" objc" , classTypeName);
11961205 Ref<Type> classType = Type::StructureType (classTypeStruct);
11971206 QualifiedName classQualName = m_data->DefineType (classTypeId, classTypeName, classType);
11981207 cls.associatedName = classTypeName;
0 commit comments