aboutsummaryrefslogtreecommitdiff
path: root/gcc/go/gofrontend/statements.cc
diff options
context:
space:
mode:
authorIan Lance Taylor <ian@gcc.gnu.org>2010-12-22 16:21:06 +0000
committerIan Lance Taylor <ian@gcc.gnu.org>2010-12-22 16:21:06 +0000
commit480cc89916ef34ec51c77b894a5e3781545a1e6c (patch)
tree162e28a65f8c5d29defa904a5c9bade83b68d753 /gcc/go/gofrontend/statements.cc
parent1d9fa70c34069d3b341e07ada11dde6cd029207b (diff)
downloadgcc-480cc89916ef34ec51c77b894a5e3781545a1e6c.zip
gcc-480cc89916ef34ec51c77b894a5e3781545a1e6c.tar.gz
gcc-480cc89916ef34ec51c77b894a5e3781545a1e6c.tar.bz2
Don't crash if a temporary is not defined due to errors.
From-SVN: r168173
Diffstat (limited to 'gcc/go/gofrontend/statements.cc')
-rw-r--r--gcc/go/gofrontend/statements.cc13
1 files changed, 13 insertions, 0 deletions
diff --git a/gcc/go/gofrontend/statements.cc b/gcc/go/gofrontend/statements.cc
index 047045c..fcc16d1 100644
--- a/gcc/go/gofrontend/statements.cc
+++ b/gcc/go/gofrontend/statements.cc
@@ -299,6 +299,19 @@ Temporary_statement::type() const
return this->type_ != NULL ? this->type_ : this->init_->type();
}
+// Return the tree for the temporary variable.
+
+tree
+Temporary_statement::get_decl() const
+{
+ if (this->decl_ == NULL)
+ {
+ gcc_assert(saw_errors());
+ return error_mark_node;
+ }
+ return this->decl_;
+}
+
// Traversal.
int