Avoid endless loop checking whether type is pointer.

From-SVN: r168221
This commit is contained in:
Ian Lance Taylor 2010-12-24 00:33:49 +00:00
parent 4cc3ef6139
commit 38ac6be772
2 changed files with 15 additions and 3 deletions

View file

@ -6853,6 +6853,19 @@ Named_type::do_verify()
return true;
}
// Return whether this type is or contains a pointer.
bool
Named_type::do_has_pointer() const
{
if (this->seen_ > 0)
return false;
++this->seen_;
bool ret = this->type_->has_pointer();
--this->seen_;
return ret;
}
// Return a hash code. This is used for method lookup. We simply
// hash on the name itself.

View file

@ -2552,8 +2552,7 @@ class Named_type : public Type
do_verify();
bool
do_has_pointer() const
{ return this->type_->has_pointer(); }
do_has_pointer() const;
unsigned int
do_hash_for_method(Gogo*) const;
@ -2677,7 +2676,7 @@ class Forward_declaration_type : public Type
bool
do_has_pointer() const
{ return this->base()->has_pointer(); }
{ return this->real_type()->has_pointer(); }
unsigned int
do_hash_for_method(Gogo* gogo) const