mirror of
https://github.com/zeek/zeek.git
synced 2025-10-02 06:38:20 +00:00
Type: CreationInitsOptimizer: PreTypedef() is not prone to endless recursion
This commit is contained in:
parent
8755be7dab
commit
853f9bfea3
1 changed files with 0 additions and 8 deletions
|
@ -969,11 +969,6 @@ class RecordType::CreationInitsOptimizer : public detail::TraversalCallback {
|
||||||
public:
|
public:
|
||||||
detail::TraversalCode PreTypedef(const detail::ID* id) override {
|
detail::TraversalCode PreTypedef(const detail::ID* id) override {
|
||||||
const auto& t = id->GetType();
|
const auto& t = id->GetType();
|
||||||
if ( analyzed_types.count(t) > 0 )
|
|
||||||
return detail::TC_ABORTSTMT;
|
|
||||||
|
|
||||||
analyzed_types.emplace(t);
|
|
||||||
|
|
||||||
if ( t->Tag() == TYPE_RECORD )
|
if ( t->Tag() == TYPE_RECORD )
|
||||||
OptimizeCreationInits(t->AsRecordType());
|
OptimizeCreationInits(t->AsRecordType());
|
||||||
|
|
||||||
|
@ -995,9 +990,6 @@ private:
|
||||||
// Discard remaining elements.
|
// Discard remaining elements.
|
||||||
rt->creation_inits.resize(i);
|
rt->creation_inits.resize(i);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Endless recursion avoidance.
|
|
||||||
std::unordered_set<TypePtr> analyzed_types;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
RecordType::RecordType(type_decl_list* arg_types) : Type(TYPE_RECORD) {
|
RecordType::RecordType(type_decl_list* arg_types) : Type(TYPE_RECORD) {
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue