diff --git a/src/Type.cc b/src/Type.cc index 5377b602de..4d638901d9 100644 --- a/src/Type.cc +++ b/src/Type.cc @@ -1132,26 +1132,16 @@ private: class RecordType::CreationInitsOptimizer : public detail::TraversalCallback { public: - detail::TraversalCode PreID(const detail::ID* id) override - { - if ( const auto& t = id->GetType() ) - HANDLE_TC_TYPE_POST(t->Traverse(this)); - - return detail::TC_CONTINUE; - } - - detail::TraversalCode PreType(const Type* t) override + 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 ) - { - auto* rt = const_cast(t->AsRecordType()); - OptimizeCreationInits(rt); - } + OptimizeCreationInits(t->AsRecordType()); return detail::TC_CONTINUE; } @@ -1176,7 +1166,7 @@ private: } // Endless recursion avoidance. - std::unordered_set analyzed_types; + std::unordered_set analyzed_types; }; RecordType::RecordType(type_decl_list* arg_types) : Type(TYPE_RECORD)