This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Go patch committed: Fix missing type traversals
- From: Ian Lance Taylor <iant at google dot com>
- To: gcc-patches at gcc dot gnu dot org, gofrontend-dev at googlegroups dot com
- Date: Tue, 22 Feb 2011 20:54:32 -0800
- Subject: Go patch committed: Fix missing type traversals
This patch to the Go frontend fixes a couple of cases were types were
not traversed when requested. Bootstrapped and ran Go testsuite on
x86_64-unknown-linux-gnu. Committed to mainline.
Ian
diff -r 8d418948131c go/expressions.cc
--- a/go/expressions.cc Mon Feb 21 19:43:34 2011 -0800
+++ b/go/expressions.cc Tue Feb 22 20:52:18 2011 -0800
@@ -2357,6 +2357,9 @@
check_for_init_loop();
protected:
+ int
+ do_traverse(Traverse*);
+
Expression*
do_lower(Gogo*, Named_object*, int);
@@ -2412,6 +2415,16 @@
mutable bool seen_;
};
+// Traversal.
+
+int
+Const_expression::do_traverse(Traverse* traverse)
+{
+ if (this->type_ != NULL)
+ return Type::traverse(this->type_, traverse);
+ return TRAVERSE_CONTINUE;
+}
+
// Lower a constant expression. This is where we convert the
// predeclared constant iota into an integer value.
diff -r 8d418948131c go/statements.cc
--- a/go/statements.cc Mon Feb 21 19:43:34 2011 -0800
+++ b/go/statements.cc Tue Feb 22 20:52:18 2011 -0800
@@ -318,6 +318,9 @@
int
Temporary_statement::do_traverse(Traverse* traverse)
{
+ if (this->type_ != NULL
+ && this->traverse_type(traverse, this->type_) == TRAVERSE_EXIT)
+ return TRAVERSE_EXIT;
if (this->init_ == NULL)
return TRAVERSE_CONTINUE;
else