aboutsummaryrefslogtreecommitdiff
path: root/gcc/rust/lex/rust-lex.cc
diff options
context:
space:
mode:
Diffstat (limited to 'gcc/rust/lex/rust-lex.cc')
-rw-r--r--gcc/rust/lex/rust-lex.cc9
1 files changed, 7 insertions, 2 deletions
diff --git a/gcc/rust/lex/rust-lex.cc b/gcc/rust/lex/rust-lex.cc
index c23088f..f620e15 100644
--- a/gcc/rust/lex/rust-lex.cc
+++ b/gcc/rust/lex/rust-lex.cc
@@ -128,7 +128,8 @@ Lexer::Lexer (const char *filename, RAIIFile file_input, Linemap *linemap)
token_queue (TokenSource (this))
{
// inform line_table that file is being entered and is in line 1
- line_map->start_file (filename, current_line);
+ if (linemap)
+ line_map->start_file (filename, current_line);
}
Lexer::~Lexer ()
@@ -152,7 +153,11 @@ Lexer::~Lexer ()
Location
Lexer::get_current_location ()
{
- return line_map->get_location (current_column);
+ if (line_map)
+ return line_map->get_location (current_column);
+ else
+ // If we have no linemap, we're lexing something without proper locations
+ return Location ();
}
int