aboutsummaryrefslogtreecommitdiff
path: root/gcc/rust/ast/rust-macro.h
diff options
context:
space:
mode:
authorArthur Cohen <arthur.cohen@embecosm.com>2022-02-16 13:03:45 +0100
committerArthur Cohen <arthur.cohen@embecosm.com>2022-02-17 09:43:48 +0100
commit45ca46018f034e50d37e6fdcd3d0de9c0ce74927 (patch)
tree46c2aa8c0da5a1cfd72b50fb4579ff000c2d46cc /gcc/rust/ast/rust-macro.h
parenta5272f389b02623b8bc4aaeafcf84013dae7c9fb (diff)
downloadgcc-45ca46018f034e50d37e6fdcd3d0de9c0ce74927.zip
gcc-45ca46018f034e50d37e6fdcd3d0de9c0ce74927.tar.gz
gcc-45ca46018f034e50d37e6fdcd3d0de9c0ce74927.tar.bz2
macrotranscriber: Add location info
Diffstat (limited to 'gcc/rust/ast/rust-macro.h')
-rw-r--r--gcc/rust/ast/rust-macro.h12
1 files changed, 7 insertions, 5 deletions
diff --git a/gcc/rust/ast/rust-macro.h b/gcc/rust/ast/rust-macro.h
index 2d59b18..ef50e4a 100644
--- a/gcc/rust/ast/rust-macro.h
+++ b/gcc/rust/ast/rust-macro.h
@@ -277,15 +277,16 @@ struct MacroTranscriber
{
private:
DelimTokenTree token_tree;
-
- // TODO: should store location information?
+ Location locus;
public:
- MacroTranscriber (DelimTokenTree token_tree)
- : token_tree (std::move (token_tree))
+ MacroTranscriber (DelimTokenTree token_tree, Location locus)
+ : token_tree (std::move (token_tree)), locus (locus)
{}
std::string as_string () const { return token_tree.as_string (); }
+
+ Location get_locus () const { return locus; }
};
// A macro rule? Matcher and transcriber pair?
@@ -310,7 +311,8 @@ public:
{
// FIXME: Once #928 is merged, give location to MacroMatcher
return MacroRule (MacroMatcher::create_error (Location ()),
- MacroTranscriber (DelimTokenTree::create_empty ()));
+ MacroTranscriber (DelimTokenTree::create_empty (),
+ Location ()));
}
std::string as_string () const;