aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorOwen Avery <powerboat9.gamer@gmail.com>2023-07-03 13:48:45 -0400
committerCohenArthur <arthur.cohen@embecosm.com>2023-07-10 08:31:35 +0000
commit1fe255e4928dd3a6d1ab574f92d472b1eea894c2 (patch)
treead74dd82065268be9b53193414eb0ff7308aeb86
parenta06cec181de6398231e0662c1ed83d905ad6d1d9 (diff)
downloadgcc-1fe255e4928dd3a6d1ab574f92d472b1eea894c2.zip
gcc-1fe255e4928dd3a6d1ab574f92d472b1eea894c2.tar.gz
gcc-1fe255e4928dd3a6d1ab574f92d472b1eea894c2.tar.bz2
Replace Linemap::unknown_location with UNKNOWN_LOCATION
gcc/rust/ChangeLog: * rust-linemap.h (Linemap::unknown_location): Remove. * ast/rust-ast.cc: Replace Linemap::unknown_location with UNKNOWN_LOCATION. * ast/rust-path.cc: Likewise. * hir/tree/rust-hir.cc: Likewise. * metadata/rust-imports.cc: Likewise. * parse/rust-parse-impl.h: Likewise. * parse/rust-parse.h: Likewise. * rust-backend.h: Likewise. * rust-diagnostics.cc: Likewise. * rust-session-manager.cc: Likewise. * typecheck/rust-tyty.cc: Likewise. Signed-off-by: Owen Avery <powerboat9.gamer@gmail.com>
-rw-r--r--gcc/rust/ast/rust-ast.cc15
-rw-r--r--gcc/rust/ast/rust-path.cc2
-rw-r--r--gcc/rust/hir/tree/rust-hir.cc2
-rw-r--r--gcc/rust/metadata/rust-imports.cc8
-rw-r--r--gcc/rust/parse/rust-parse-impl.h52
-rw-r--r--gcc/rust/parse/rust-parse.h35
-rw-r--r--gcc/rust/rust-backend.h3
-rw-r--r--gcc/rust/rust-diagnostics.cc4
-rw-r--r--gcc/rust/rust-linemap.h3
-rw-r--r--gcc/rust/rust-session-manager.cc17
-rw-r--r--gcc/rust/typecheck/rust-tyty.cc3
11 files changed, 67 insertions, 77 deletions
diff --git a/gcc/rust/ast/rust-ast.cc b/gcc/rust/ast/rust-ast.cc
index 3e5cec8..befdc76 100644
--- a/gcc/rust/ast/rust-ast.cc
+++ b/gcc/rust/ast/rust-ast.cc
@@ -3610,8 +3610,7 @@ AttributeParser::parse_meta_item_inner ()
new MetaListPaths (ident, ident_locus, std::move (path_items)));
}
- rust_error_at (Linemap::unknown_location (),
- "failed to parse any meta item inner");
+ rust_error_at (UNKNOWN_LOCATION, "failed to parse any meta item inner");
return nullptr;
}
@@ -3905,7 +3904,7 @@ MetaListNameValueStr::check_cfg_predicate (const Session &session) const
{
/* HACK: convert vector platform-dependent size_type to string to
* use in printf */
- rust_error_at (Linemap::unknown_location (),
+ rust_error_at (UNKNOWN_LOCATION,
"cfg predicate could not be checked for "
"MetaListNameValueStr with ident of "
"'not' because there are '%s' elements, not '1'",
@@ -3917,7 +3916,7 @@ MetaListNameValueStr::check_cfg_predicate (const Session &session) const
}
else
{
- rust_error_at (Linemap::unknown_location (),
+ rust_error_at (UNKNOWN_LOCATION,
"cfg predicate could not be checked for "
"MetaListNameValueStr with ident of "
"'%s' - ident must be 'all' or 'any'",
@@ -3953,7 +3952,7 @@ MetaListPaths::check_cfg_predicate (const Session &session) const
{
// HACK: convert vector platform-dependent size_type to string to
// use in printf
- rust_error_at (Linemap::unknown_location (),
+ rust_error_at (UNKNOWN_LOCATION,
"cfg predicate could not be checked for MetaListPaths "
"with ident of 'not' "
"because there are '%s' elements, not '1'",
@@ -3965,7 +3964,7 @@ MetaListPaths::check_cfg_predicate (const Session &session) const
}
else
{
- rust_error_at (Linemap::unknown_location (),
+ rust_error_at (UNKNOWN_LOCATION,
"cfg predicate could not be checked for "
"MetaListNameValueStr with ident of "
"'%s' - ident must be 'all' or 'any'",
@@ -4008,7 +4007,7 @@ MetaItemSeq::check_cfg_predicate (const Session &session) const
{
/* HACK: convert vector platform-dependent size_type to string to
* use in printf */
- rust_error_at (Linemap::unknown_location (),
+ rust_error_at (UNKNOWN_LOCATION,
"cfg predicate could not be checked for MetaItemSeq "
"with ident of 'not' "
"because there are '%s' elements, not '1'",
@@ -4021,7 +4020,7 @@ MetaItemSeq::check_cfg_predicate (const Session &session) const
else
{
rust_error_at (
- Linemap::unknown_location (),
+ UNKNOWN_LOCATION,
"cfg predicate could not be checked for MetaItemSeq with path of "
"'%s' - path must be 'all' or 'any'",
path.as_string ().c_str ());
diff --git a/gcc/rust/ast/rust-path.cc b/gcc/rust/ast/rust-path.cc
index ee6a6fb..7c6d7e1 100644
--- a/gcc/rust/ast/rust-path.cc
+++ b/gcc/rust/ast/rust-path.cc
@@ -172,7 +172,7 @@ PathPattern::convert_to_simple_path (bool with_opening_scope_resolution) const
}
// kind of a HACK to get locus depending on opening scope resolution
- Location locus = Linemap::unknown_location ();
+ Location locus = UNKNOWN_LOCATION;
if (with_opening_scope_resolution)
locus = simple_segments[0].get_locus () - 2; // minus 2 chars for ::
else
diff --git a/gcc/rust/hir/tree/rust-hir.cc b/gcc/rust/hir/tree/rust-hir.cc
index 0bad520..9d76504 100644
--- a/gcc/rust/hir/tree/rust-hir.cc
+++ b/gcc/rust/hir/tree/rust-hir.cc
@@ -2173,7 +2173,7 @@ PathPattern::convert_to_simple_path (bool with_opening_scope_resolution) const
}
// kind of a HACK to get locus depending on opening scope resolution
- Location locus = Linemap::unknown_location ();
+ Location locus = UNKNOWN_LOCATION;
if (with_opening_scope_resolution)
{
locus = simple_segments[0].get_locus () - 2; // minus 2 chars for ::
diff --git a/gcc/rust/metadata/rust-imports.cc b/gcc/rust/metadata/rust-imports.cc
index acfec3e..45b3832 100644
--- a/gcc/rust/metadata/rust-imports.cc
+++ b/gcc/rust/metadata/rust-imports.cc
@@ -375,7 +375,7 @@ Stream_from_file::Stream_from_file (int fd) : fd_ (fd), data_ ()
{
if (lseek (fd, 0, SEEK_SET) != 0)
{
- rust_fatal_error (Linemap::unknown_location (), "lseek failed: %m");
+ rust_fatal_error (UNKNOWN_LOCATION, "lseek failed: %m");
this->set_saw_error ();
}
}
@@ -399,7 +399,7 @@ Stream_from_file::do_peek (size_t length, const char **bytes)
if (got < 0)
{
if (!this->saw_error ())
- rust_fatal_error (Linemap::unknown_location (), "read failed: %m");
+ rust_fatal_error (UNKNOWN_LOCATION, "read failed: %m");
this->set_saw_error ();
return false;
}
@@ -407,7 +407,7 @@ Stream_from_file::do_peek (size_t length, const char **bytes)
if (lseek (this->fd_, -got, SEEK_CUR) < 0)
{
if (!this->saw_error ())
- rust_fatal_error (Linemap::unknown_location (), "lseek failed: %m");
+ rust_fatal_error (UNKNOWN_LOCATION, "lseek failed: %m");
this->set_saw_error ();
return false;
}
@@ -427,7 +427,7 @@ Stream_from_file::do_advance (size_t skip)
if (lseek (this->fd_, skip, SEEK_CUR) < 0)
{
if (!this->saw_error ())
- rust_fatal_error (Linemap::unknown_location (), "lseek failed: %m");
+ rust_fatal_error (UNKNOWN_LOCATION, "lseek failed: %m");
this->set_saw_error ();
}
if (!this->data_.empty ())
diff --git a/gcc/rust/parse/rust-parse-impl.h b/gcc/rust/parse/rust-parse-impl.h
index e94e205..06faaee 100644
--- a/gcc/rust/parse/rust-parse-impl.h
+++ b/gcc/rust/parse/rust-parse-impl.h
@@ -606,7 +606,7 @@ AST::SimplePath
Parser<ManagedTokenSource>::parse_simple_path ()
{
bool has_opening_scope_resolution = false;
- Location locus = Linemap::unknown_location ();
+ Location locus = UNKNOWN_LOCATION;
// don't parse anything if not a path upfront
if (!is_simple_path_segment (lexer.peek_token ()->get_id ())
@@ -628,7 +628,7 @@ Parser<ManagedTokenSource>::parse_simple_path ()
AST::SimplePathSegment segment = parse_simple_path_segment ();
// get location if not gotten already
- if (locus == Linemap::unknown_location ())
+ if (locus == UNKNOWN_LOCATION)
locus = segment.get_locus ();
std::vector<AST::SimplePathSegment> segments;
@@ -6764,7 +6764,7 @@ template <typename ManagedTokenSource>
AST::PathInExpression
Parser<ManagedTokenSource>::parse_path_in_expression ()
{
- Location locus = Linemap::unknown_location ();
+ Location locus = UNKNOWN_LOCATION;
bool has_opening_scope_resolution = false;
if (lexer.peek_token ()->get_id () == SCOPE_RESOLUTION)
{
@@ -6778,7 +6778,7 @@ Parser<ManagedTokenSource>::parse_path_in_expression ()
// create segment vector
std::vector<AST::PathExprSegment> segments;
- if (locus == Linemap::unknown_location ())
+ if (locus == UNKNOWN_LOCATION)
{
locus = lexer.peek_token ()->get_locus ();
}
@@ -6949,7 +6949,7 @@ Parser<ManagedTokenSource>::parse_qualified_path_type (
Location locus = pratt_parsed_loc;
/* TODO: should this actually be error? is there anywhere where this could
* be valid? */
- if (locus == Linemap::unknown_location ())
+ if (locus == UNKNOWN_LOCATION)
{
locus = lexer.peek_token ()->get_locus ();
@@ -7381,7 +7381,7 @@ Parser<ManagedTokenSource>::parse_block_expr (AST::AttrVec outer_attrs,
Location pratt_parsed_loc)
{
Location locus = pratt_parsed_loc;
- if (locus == Linemap::unknown_location ())
+ if (locus == UNKNOWN_LOCATION)
{
locus = lexer.peek_token ()->get_locus ();
if (!skip_token (LEFT_CURLY))
@@ -7685,7 +7685,7 @@ Parser<ManagedTokenSource>::parse_return_expr (AST::AttrVec outer_attrs,
Location pratt_parsed_loc)
{
Location locus = pratt_parsed_loc;
- if (locus == Linemap::unknown_location ())
+ if (locus == UNKNOWN_LOCATION)
{
locus = lexer.peek_token ()->get_locus ();
skip_token (RETURN_TOK);
@@ -7710,7 +7710,7 @@ Parser<ManagedTokenSource>::parse_break_expr (AST::AttrVec outer_attrs,
Location pratt_parsed_loc)
{
Location locus = pratt_parsed_loc;
- if (locus == Linemap::unknown_location ())
+ if (locus == UNKNOWN_LOCATION)
{
locus = lexer.peek_token ()->get_locus ();
skip_token (BREAK);
@@ -7741,7 +7741,7 @@ Parser<ManagedTokenSource>::parse_continue_expr (AST::AttrVec outer_attrs,
Location pratt_parsed_loc)
{
Location locus = pratt_parsed_loc;
- if (locus == Linemap::unknown_location ())
+ if (locus == UNKNOWN_LOCATION)
{
locus = lexer.peek_token ()->get_locus ();
skip_token (CONTINUE);
@@ -7792,7 +7792,7 @@ Parser<ManagedTokenSource>::parse_if_expr (AST::AttrVec outer_attrs,
{
// TODO: make having outer attributes an error?
Location locus = pratt_parsed_loc;
- if (locus == Linemap::unknown_location ())
+ if (locus == UNKNOWN_LOCATION)
{
locus = lexer.peek_token ()->get_locus ();
if (!skip_token (IF))
@@ -7950,7 +7950,7 @@ Parser<ManagedTokenSource>::parse_if_let_expr (AST::AttrVec outer_attrs,
{
// TODO: make having outer attributes an error?
Location locus = pratt_parsed_loc;
- if (locus == Linemap::unknown_location ())
+ if (locus == UNKNOWN_LOCATION)
{
locus = lexer.peek_token ()->get_locus ();
if (!skip_token (IF))
@@ -8136,7 +8136,7 @@ Parser<ManagedTokenSource>::parse_loop_expr (AST::AttrVec outer_attrs,
Location pratt_parsed_loc)
{
Location locus = pratt_parsed_loc;
- if (locus == Linemap::unknown_location ())
+ if (locus == UNKNOWN_LOCATION)
{
if (label.is_error ())
locus = lexer.peek_token ()->get_locus ();
@@ -8180,7 +8180,7 @@ Parser<ManagedTokenSource>::parse_while_loop_expr (AST::AttrVec outer_attrs,
Location pratt_parsed_loc)
{
Location locus = pratt_parsed_loc;
- if (locus == Linemap::unknown_location ())
+ if (locus == UNKNOWN_LOCATION)
{
if (label.is_error ())
locus = lexer.peek_token ()->get_locus ();
@@ -8251,7 +8251,7 @@ std::unique_ptr<AST::WhileLetLoopExpr>
Parser<ManagedTokenSource>::parse_while_let_loop_expr (AST::AttrVec outer_attrs,
AST::LoopLabel label)
{
- Location locus = Linemap::unknown_location ();
+ Location locus = UNKNOWN_LOCATION;
if (label.is_error ())
locus = lexer.peek_token ()->get_locus ();
else
@@ -8325,7 +8325,7 @@ std::unique_ptr<AST::ForLoopExpr>
Parser<ManagedTokenSource>::parse_for_loop_expr (AST::AttrVec outer_attrs,
AST::LoopLabel label)
{
- Location locus = Linemap::unknown_location ();
+ Location locus = UNKNOWN_LOCATION;
if (label.is_error ())
locus = lexer.peek_token ()->get_locus ();
else
@@ -8456,7 +8456,7 @@ Parser<ManagedTokenSource>::parse_match_expr (AST::AttrVec outer_attrs,
Location pratt_parsed_loc)
{
Location locus = pratt_parsed_loc;
- if (locus == Linemap::unknown_location ())
+ if (locus == UNKNOWN_LOCATION)
{
locus = lexer.peek_token ()->get_locus ();
skip_token (MATCH_TOK);
@@ -8742,7 +8742,7 @@ Parser<ManagedTokenSource>::parse_unsafe_block_expr (AST::AttrVec outer_attrs,
Location pratt_parsed_loc)
{
Location locus = pratt_parsed_loc;
- if (locus == Linemap::unknown_location ())
+ if (locus == UNKNOWN_LOCATION)
{
locus = lexer.peek_token ()->get_locus ();
skip_token (UNSAFE);
@@ -8773,7 +8773,7 @@ Parser<ManagedTokenSource>::parse_array_expr (AST::AttrVec outer_attrs,
Location pratt_parsed_loc)
{
Location locus = pratt_parsed_loc;
- if (locus == Linemap::unknown_location ())
+ if (locus == UNKNOWN_LOCATION)
{
locus = lexer.peek_token ()->get_locus ();
skip_token (LEFT_SQUARE);
@@ -8959,7 +8959,7 @@ Parser<ManagedTokenSource>::parse_grouped_or_tuple_expr (
{
// adjustment to allow Pratt parsing to reuse function without copy-paste
Location locus = pratt_parsed_loc;
- if (locus == Linemap::unknown_location ())
+ if (locus == UNKNOWN_LOCATION)
{
locus = lexer.peek_token ()->get_locus ();
skip_token (LEFT_PAREN);
@@ -10682,9 +10682,10 @@ Parser<ManagedTokenSource>::parse_pattern_no_alt ()
std::unique_ptr<AST::RangePatternBound> upper_bound
= parse_range_pattern_bound ();
- return std::unique_ptr<AST::RangePattern> (new AST::RangePattern (
- std::move (lower_bound), std::move (upper_bound),
- Linemap::unknown_location (), has_ellipsis_syntax));
+ return std::unique_ptr<AST::RangePattern> (
+ new AST::RangePattern (std::move (lower_bound),
+ std::move (upper_bound),
+ UNKNOWN_LOCATION, has_ellipsis_syntax));
}
case EXCLAM:
return parse_macro_invocation_partial (std::move (path),
@@ -11221,9 +11222,10 @@ Parser<ManagedTokenSource>::parse_ident_leading_pattern ()
std::unique_ptr<AST::RangePatternBound> upper_bound
= parse_range_pattern_bound ();
- return std::unique_ptr<AST::RangePattern> (new AST::RangePattern (
- std::move (lower_bound), std::move (upper_bound),
- Linemap::unknown_location (), has_ellipsis_syntax));
+ return std::unique_ptr<AST::RangePattern> (
+ new AST::RangePattern (std::move (lower_bound),
+ std::move (upper_bound), UNKNOWN_LOCATION,
+ has_ellipsis_syntax));
}
case PATTERN_BIND: {
// only allow on single-segment paths
diff --git a/gcc/rust/parse/rust-parse.h b/gcc/rust/parse/rust-parse.h
index 1d49c95..21540a3 100644
--- a/gcc/rust/parse/rust-parse.h
+++ b/gcc/rust/parse/rust-parse.h
@@ -139,7 +139,7 @@ public:
std::unique_ptr<AST::BlockExpr>
parse_block_expr (AST::AttrVec outer_attrs = AST::AttrVec (),
- Location pratt_parsed_loc = Linemap::unknown_location ());
+ Location pratt_parsed_loc = UNKNOWN_LOCATION);
std::unique_ptr<AST::Item> parse_item (bool called_from_statement);
std::unique_ptr<AST::Pattern> parse_pattern ();
@@ -211,10 +211,9 @@ private:
// first token parsed in the expression (the parsing of that first
// token should be skipped).
parse_qualified_path_in_expression (Location pratt_parsed_loc
- = Linemap::unknown_location ());
- AST::QualifiedPathType
- parse_qualified_path_type (Location pratt_parsed_loc
- = Linemap::unknown_location ());
+ = UNKNOWN_LOCATION);
+ AST::QualifiedPathType parse_qualified_path_type (Location pratt_parsed_loc
+ = UNKNOWN_LOCATION);
AST::QualifiedPathInType parse_qualified_path_in_type ();
// Token tree or macro related
@@ -566,19 +565,18 @@ private:
// token should be skipped).
std::unique_ptr<AST::IfExpr>
parse_if_expr (AST::AttrVec outer_attrs = AST::AttrVec (),
- Location pratt_parsed_loc = Linemap::unknown_location ());
+ Location pratt_parsed_loc = UNKNOWN_LOCATION);
std::unique_ptr<AST::IfLetExpr>
parse_if_let_expr (AST::AttrVec outer_attrs = AST::AttrVec (),
- Location pratt_parsed_loc = Linemap::unknown_location ());
+ Location pratt_parsed_loc = UNKNOWN_LOCATION);
std::unique_ptr<AST::LoopExpr>
parse_loop_expr (AST::AttrVec outer_attrs = AST::AttrVec (),
AST::LoopLabel label = AST::LoopLabel::error (),
- Location pratt_parsed_loc = Linemap::unknown_location ());
+ Location pratt_parsed_loc = UNKNOWN_LOCATION);
std::unique_ptr<AST::WhileLoopExpr>
parse_while_loop_expr (AST::AttrVec outer_attrs = AST::AttrVec (),
AST::LoopLabel label = AST::LoopLabel::error (),
- Location pratt_parsed_loc
- = Linemap::unknown_location ());
+ Location pratt_parsed_loc = UNKNOWN_LOCATION);
std::unique_ptr<AST::WhileLetLoopExpr>
parse_while_let_loop_expr (AST::AttrVec outer_attrs = AST::AttrVec (),
AST::LoopLabel label = AST::LoopLabel::error ());
@@ -587,7 +585,7 @@ private:
AST::LoopLabel label = AST::LoopLabel::error ());
std::unique_ptr<AST::MatchExpr>
parse_match_expr (AST::AttrVec outer_attrs = AST::AttrVec (),
- Location pratt_parsed_loc = Linemap::unknown_location ());
+ Location pratt_parsed_loc = UNKNOWN_LOCATION);
AST::MatchArm parse_match_arm ();
std::vector<std::unique_ptr<AST::Pattern> >
parse_match_arm_patterns (TokenId end_token_id);
@@ -608,25 +606,22 @@ private:
// token should be skipped).
std::unique_ptr<AST::ReturnExpr>
parse_return_expr (AST::AttrVec outer_attrs = AST::AttrVec (),
- Location pratt_parsed_loc = Linemap::unknown_location ());
+ Location pratt_parsed_loc = UNKNOWN_LOCATION);
std::unique_ptr<AST::BreakExpr>
parse_break_expr (AST::AttrVec outer_attrs = AST::AttrVec (),
- Location pratt_parsed_loc = Linemap::unknown_location ());
+ Location pratt_parsed_loc = UNKNOWN_LOCATION);
std::unique_ptr<AST::ContinueExpr>
parse_continue_expr (AST::AttrVec outer_attrs = AST::AttrVec (),
- Location pratt_parsed_loc
- = Linemap::unknown_location ());
+ Location pratt_parsed_loc = UNKNOWN_LOCATION);
std::unique_ptr<AST::UnsafeBlockExpr>
parse_unsafe_block_expr (AST::AttrVec outer_attrs = AST::AttrVec (),
- Location pratt_parsed_loc
- = Linemap::unknown_location ());
+ Location pratt_parsed_loc = UNKNOWN_LOCATION);
std::unique_ptr<AST::ArrayExpr>
parse_array_expr (AST::AttrVec outer_attrs = AST::AttrVec (),
- Location pratt_parsed_loc = Linemap::unknown_location ());
+ Location pratt_parsed_loc = UNKNOWN_LOCATION);
std::unique_ptr<AST::ExprWithoutBlock>
parse_grouped_or_tuple_expr (AST::AttrVec outer_attrs = AST::AttrVec (),
- Location pratt_parsed_loc
- = Linemap::unknown_location ());
+ Location pratt_parsed_loc = UNKNOWN_LOCATION);
std::unique_ptr<AST::StructExprField> parse_struct_expr_field ();
bool will_be_expr_with_block ();
diff --git a/gcc/rust/rust-backend.h b/gcc/rust/rust-backend.h
index 42b2839..4e13919 100644
--- a/gcc/rust/rust-backend.h
+++ b/gcc/rust/rust-backend.h
@@ -52,8 +52,7 @@ public:
tree type;
Location location;
- typed_identifier ()
- : name (), type (NULL_TREE), location (Linemap::unknown_location ())
+ typed_identifier () : name (), type (NULL_TREE), location (UNKNOWN_LOCATION)
{}
typed_identifier (const std::string &a_name, tree a_type,
diff --git a/gcc/rust/rust-diagnostics.cc b/gcc/rust/rust-diagnostics.cc
index bdff7a6..4847f6f 100644
--- a/gcc/rust/rust-diagnostics.cc
+++ b/gcc/rust/rust-diagnostics.cc
@@ -119,7 +119,7 @@ expand_message (const char *fmt, va_list ap)
if (nwr == -1)
{
// memory allocation failed
- rust_be_error_at (Linemap::unknown_location (),
+ rust_be_error_at (UNKNOWN_LOCATION,
"memory allocation failed in vasprintf");
rust_assert (0);
}
@@ -323,7 +323,7 @@ rust_debug_loc (const Location location, const char *fmt, ...)
va_end (ap);
if (nwr == -1)
{
- rust_be_error_at (Linemap::unknown_location (),
+ rust_be_error_at (UNKNOWN_LOCATION,
"memory allocation failed in vasprintf");
rust_assert (0);
}
diff --git a/gcc/rust/rust-linemap.h b/gcc/rust/rust-linemap.h
index 12fdb9f..710e47d 100644
--- a/gcc/rust/rust-linemap.h
+++ b/gcc/rust/rust-linemap.h
@@ -78,9 +78,6 @@ public:
// Return the special Location used for predeclared identifiers.
static Location predeclared_location () { return BUILTINS_LOCATION; }
- // Return the special Location used when no location is known.
- static Location unknown_location () { return UNKNOWN_LOCATION; }
-
// Produce a human-readable description of a Location.
static std::string location_to_string (Location loc)
{
diff --git a/gcc/rust/rust-session-manager.cc b/gcc/rust/rust-session-manager.cc
index 4178245..c27b456 100644
--- a/gcc/rust/rust-session-manager.cc
+++ b/gcc/rust/rust-session-manager.cc
@@ -488,8 +488,8 @@ Session::compile_crate (const char *filename)
dump_lex_stream.open (kLexDumpFile);
if (dump_lex_stream.fail ())
{
- rust_error_at (Linemap::unknown_location (),
- "cannot open %s:%m; ignored", kLexDumpFile);
+ rust_error_at (UNKNOWN_LOCATION, "cannot open %s:%m; ignored",
+ kLexDumpFile);
}
auto stream = Optional<std::ofstream &>::some (dump_lex_stream);
dump_lex_opt = std::move (stream);
@@ -499,7 +499,7 @@ Session::compile_crate (const char *filename)
if (!lex.input_source_is_valid_utf8 ())
{
- rust_error_at (Linemap::unknown_location (),
+ rust_error_at (UNKNOWN_LOCATION,
"cannot read %s; stream did not contain valid UTF-8",
filename);
return;
@@ -802,8 +802,7 @@ Session::injection (AST::Crate &crate)
// create "extern crate" item with the name
std::unique_ptr<AST::ExternCrate> extern_crate (
new AST::ExternCrate (*it, AST::Visibility::create_error (),
- {std::move (attr)},
- Linemap::unknown_location ()));
+ {std::move (attr)}, UNKNOWN_LOCATION));
// insert at beginning
// crate.items.insert (crate.items.begin (), std::move (extern_crate));
@@ -913,7 +912,7 @@ Session::dump_ast_pretty (AST::Crate &crate, bool expanded) const
if (out.fail ())
{
- rust_error_at (Linemap::unknown_location (), "cannot open %s:%m; ignored",
+ rust_error_at (UNKNOWN_LOCATION, "cannot open %s:%m; ignored",
kASTDumpFile);
return;
}
@@ -930,7 +929,7 @@ Session::dump_hir (HIR::Crate &crate) const
out.open (kHIRDumpFile);
if (out.fail ())
{
- rust_error_at (Linemap::unknown_location (), "cannot open %s:%m; ignored",
+ rust_error_at (UNKNOWN_LOCATION, "cannot open %s:%m; ignored",
kHIRDumpFile);
return;
}
@@ -946,7 +945,7 @@ Session::dump_hir_pretty (HIR::Crate &crate) const
out.open (kHIRPrettyDumpFile);
if (out.fail ())
{
- rust_error_at (Linemap::unknown_location (), "cannot open %s:%m; ignored",
+ rust_error_at (UNKNOWN_LOCATION, "cannot open %s:%m; ignored",
kHIRPrettyDumpFile);
return;
}
@@ -1038,7 +1037,7 @@ TargetOptions::dump_target_options () const
out.open (kTargetOptionsDumpFile);
if (out.fail ())
{
- rust_error_at (Linemap::unknown_location (), "cannot open %s:%m; ignored",
+ rust_error_at (UNKNOWN_LOCATION, "cannot open %s:%m; ignored",
kTargetOptionsDumpFile);
return;
}
diff --git a/gcc/rust/typecheck/rust-tyty.cc b/gcc/rust/typecheck/rust-tyty.cc
index d043644..d05633a 100644
--- a/gcc/rust/typecheck/rust-tyty.cc
+++ b/gcc/rust/typecheck/rust-tyty.cc
@@ -1454,8 +1454,7 @@ VariantDef::get_error_node ()
{
static VariantDef node
= VariantDef (UNKNOWN_HIRID, UNKNOWN_DEFID, "",
- {Resolver::CanonicalPath::create_empty (),
- Linemap::unknown_location ()},
+ {Resolver::CanonicalPath::create_empty (), UNKNOWN_LOCATION},
nullptr);
return node;