Type: CreationInitsOptimizer: PreTypedef() is not prone to endless recursion

This commit is contained in:
Arne Welzel 2024-08-15 12:18:30 +02:00
parent 8755be7dab
commit 853f9bfea3

View file

@ -969,11 +969,6 @@ class RecordType::CreationInitsOptimizer : public detail::TraversalCallback {
public:
detail::TraversalCode PreTypedef(const detail::ID* id) override {
const auto& t = id->GetType();
if ( analyzed_types.count(t) > 0 )
return detail::TC_ABORTSTMT;
analyzed_types.emplace(t);
if ( t->Tag() == TYPE_RECORD )
OptimizeCreationInits(t->AsRecordType());
@ -995,9 +990,6 @@ private:
// Discard remaining elements.
rt->creation_inits.resize(i);
}
// Endless recursion avoidance.
std::unordered_set<TypePtr> analyzed_types;
};
RecordType::RecordType(type_decl_list* arg_types) : Type(TYPE_RECORD) {