diff options
author | Ian Lance Taylor <ian@gcc.gnu.org> | 2010-12-24 00:33:49 +0000 |
---|---|---|
committer | Ian Lance Taylor <ian@gcc.gnu.org> | 2010-12-24 00:33:49 +0000 |
commit | 38ac6be772b39c41aa4dee3446ed776084683d62 (patch) | |
tree | d64cfad05b1b25773003424d2de53567e39b5a26 /gcc | |
parent | 4cc3ef613998834c7a81386f166494a8f50309a5 (diff) | |
download | gcc-38ac6be772b39c41aa4dee3446ed776084683d62.zip gcc-38ac6be772b39c41aa4dee3446ed776084683d62.tar.gz gcc-38ac6be772b39c41aa4dee3446ed776084683d62.tar.bz2 |
Avoid endless loop checking whether type is pointer.
From-SVN: r168221
Diffstat (limited to 'gcc')
-rw-r--r-- | gcc/go/gofrontend/types.cc | 13 | ||||
-rw-r--r-- | gcc/go/gofrontend/types.h | 5 |
2 files changed, 15 insertions, 3 deletions
diff --git a/gcc/go/gofrontend/types.cc b/gcc/go/gofrontend/types.cc index 2278c94..6ea5297 100644 --- a/gcc/go/gofrontend/types.cc +++ b/gcc/go/gofrontend/types.cc @@ -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. diff --git a/gcc/go/gofrontend/types.h b/gcc/go/gofrontend/types.h index fea864a..cecf106 100644 --- a/gcc/go/gofrontend/types.h +++ b/gcc/go/gofrontend/types.h @@ -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 |