aboutsummaryrefslogtreecommitdiff
path: root/gcc/go/gofrontend/parse.h
diff options
context:
space:
mode:
authorIan Lance Taylor <ian@gcc.gnu.org>2012-01-23 23:55:31 +0000
committerIan Lance Taylor <ian@gcc.gnu.org>2012-01-23 23:55:31 +0000
commitb1b3aec1b1e26c22791f21d971a851af4df2dad2 (patch)
treeed963d480affb07d364c84b0b56a97f7bb92427b /gcc/go/gofrontend/parse.h
parent8bae34da8a4625767bc7e1caab295855963ff280 (diff)
downloadgcc-b1b3aec1b1e26c22791f21d971a851af4df2dad2.zip
gcc-b1b3aec1b1e26c22791f21d971a851af4df2dad2.tar.gz
gcc-b1b3aec1b1e26c22791f21d971a851af4df2dad2.tar.bz2
compiler: Give an error if a variable is defined but not used.
From-SVN: r183458
Diffstat (limited to 'gcc/go/gofrontend/parse.h')
-rw-r--r--gcc/go/gofrontend/parse.h11
1 files changed, 11 insertions, 0 deletions
diff --git a/gcc/go/gofrontend/parse.h b/gcc/go/gofrontend/parse.h
index 0a3fe64..f45aa85 100644
--- a/gcc/go/gofrontend/parse.h
+++ b/gcc/go/gofrontend/parse.h
@@ -155,6 +155,11 @@ class Parse
// break or continue statement with no label.
typedef std::vector<std::pair<Statement*, Label*> > Bc_stack;
+ // Map from type switch variables to the variables they mask, so
+ // that a use of the type switch variable can become a use of the
+ // real variable.
+ typedef Unordered_map(Named_object*, Named_object*) Type_switch_vars;
+
// Parser nonterminals.
void identifier_list(Typed_identifier_list*);
Expression_list* expression_list(Expression*, bool may_be_sink);
@@ -288,6 +293,10 @@ class Parse
Statement*
find_bc_statement(const Bc_stack*, const std::string&) const;
+ // Mark a variable as used.
+ void
+ mark_var_used(Named_object*);
+
// The lexer output we are parsing.
Lex* lex_;
// The current token.
@@ -307,6 +316,8 @@ class Parse
// References from the local function to variables defined in
// enclosing functions.
Enclosing_vars enclosing_vars_;
+ // Map from type switch variables to real variables.
+ Type_switch_vars type_switch_vars_;
};