From c12df35927747bd91c0a2d0ffce030f2cdb9f722 Mon Sep 17 00:00:00 2001 From: Ian Lance Taylor Date: Tue, 6 Oct 2015 21:24:17 +0000 Subject: compiler: Record each import as a distinct alias. This patch introduces the Package_alias class which is a finer representation of the different between a package and the aliases it is imported under. Each alias keeps track of the location of its import statement and how many times that alias has been used. This allows the gofrontend to report when a specific import has not been used even if a symbol from the package has been used by another import. Fixes golang/go#12326. Reviewed-on: https://go-review.googlesource.com/14259 From-SVN: r228550 --- gcc/go/gofrontend/parse.cc | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'gcc/go/gofrontend/parse.cc') diff --git a/gcc/go/gofrontend/parse.cc b/gcc/go/gofrontend/parse.cc index cc43776..9d6a8c6 100644 --- a/gcc/go/gofrontend/parse.cc +++ b/gcc/go/gofrontend/parse.cc @@ -198,7 +198,7 @@ Parse::qualified_ident(std::string* pname, Named_object** ppackage) return false; } - package->package_value()->note_usage(); + package->package_value()->note_usage(Gogo::unpack_hidden_name(name)); token = this->advance_token(); if (!token->is_identifier()) @@ -2430,7 +2430,7 @@ Parse::operand(bool may_be_sink, bool* is_parenthesized) return Expression::make_error(location); } package = named_object->package_value(); - package->note_usage(); + package->note_usage(id); id = this->peek_token()->identifier(); is_exported = this->peek_token()->is_identifier_exported(); packed = this->gogo_->pack_hidden_name(id, is_exported); -- cgit v1.1