aboutsummaryrefslogtreecommitdiff
path: root/gcc/rust/expand/rust-proc-macro.cc
diff options
context:
space:
mode:
authorPierre-Emmanuel Patry <pierre-emmanuel.patry@embecosm.com>2023-08-29 17:24:03 +0200
committerP-E-P <32375388+P-E-P@users.noreply.github.com>2023-09-06 11:50:30 +0000
commit4e7ae3938b2364370e848acb3d51e1a9c4c5d512 (patch)
treecc3fc3d13347d9b3179a0d6a41479b83029970cb /gcc/rust/expand/rust-proc-macro.cc
parent241e53bc424ae2ce7185d32f069d776ebddb599a (diff)
downloadgcc-4e7ae3938b2364370e848acb3d51e1a9c4c5d512.zip
gcc-4e7ae3938b2364370e848acb3d51e1a9c4c5d512.tar.gz
gcc-4e7ae3938b2364370e848acb3d51e1a9c4c5d512.tar.bz2
Add missing linemap to lexer
When some proc macro create tokens and later have some code referring to those created tokens the code was missing a linemap since the pointer was null, throwing an ICE. gcc/rust/ChangeLog: * expand/rust-proc-macro.cc (tokenstream_from_string): Change linemap null pointer to the current linemap. Signed-off-by: Pierre-Emmanuel Patry <pierre-emmanuel.patry@embecosm.com>
Diffstat (limited to 'gcc/rust/expand/rust-proc-macro.cc')
-rw-r--r--gcc/rust/expand/rust-proc-macro.cc3
1 files changed, 2 insertions, 1 deletions
diff --git a/gcc/rust/expand/rust-proc-macro.cc b/gcc/rust/expand/rust-proc-macro.cc
index f0f6d65..2fdfcb2 100644
--- a/gcc/rust/expand/rust-proc-macro.cc
+++ b/gcc/rust/expand/rust-proc-macro.cc
@@ -16,6 +16,7 @@
#include "rust-diagnostics.h"
#include "rust-proc-macro.h"
+#include "rust-session-manager.h"
#include "rust-lex.h"
#include "rust-token-converter.h"
#include "rust-attributes.h"
@@ -68,7 +69,7 @@ ProcMacro::TokenStream
tokenstream_from_string (std::string &data, bool &lex_error)
{
// FIXME: Insert location pointing to call site in tokens
- Lexer lex (data, nullptr);
+ Lexer lex (data, Session::get_instance ().linemap);
std::vector<const_TokenPtr> tokens;
TokenPtr ptr;