aboutsummaryrefslogtreecommitdiff
path: root/gcc/rust/expand/rust-macro-builtins.cc
diff options
context:
space:
mode:
authorOwen Avery <powerboat9.gamer@gmail.com>2023-07-03 13:33:16 -0400
committerCohenArthur <arthur.cohen@embecosm.com>2023-07-07 12:10:52 +0000
commit5ca1ed0397314d47e7ecd937000ec096f8274a60 (patch)
tree183273ee5f5464ec101641671138494e3ca63f20 /gcc/rust/expand/rust-macro-builtins.cc
parent65553ce9a9821591d0296f2b20286a91e25be8da (diff)
downloadgcc-5ca1ed0397314d47e7ecd937000ec096f8274a60.zip
gcc-5ca1ed0397314d47e7ecd937000ec096f8274a60.tar.gz
gcc-5ca1ed0397314d47e7ecd937000ec096f8274a60.tar.bz2
Reduce Linemap/Gcc_linemap abstraction further
gcc/rust/ChangeLog: * expand/rust-macro-builtins.cc (source_relative_path): Use LOCATION_FILE. (MacroBuiltin::file_handler): Likewise. (MacroBuiltin::column_handler): Use LOCATION_COLUMN. (MacroBuiltin::line_handler): Use LOCATION_LINE. * rust-linemap.cc (Gcc_linemap::location_file): Remove. (Gcc_linemap::location_line): Remove. (Gcc_linemap::location_column): Remove. * rust-linemap.h (Linemap::location_file): Remove. (Linemap::location_line): Remove. (Linemap::location_column): Remove. (Linemap::location_to_file): Remove. (Linemap::location_to_line): Remove. (Linemap::location_to_column): Remove. Signed-off-by: Owen Avery <powerboat9.gamer@gmail.com>
Diffstat (limited to 'gcc/rust/expand/rust-macro-builtins.cc')
-rw-r--r--gcc/rust/expand/rust-macro-builtins.cc12
1 files changed, 4 insertions, 8 deletions
diff --git a/gcc/rust/expand/rust-macro-builtins.cc b/gcc/rust/expand/rust-macro-builtins.cc
index 59a1f19..6b3f3c7 100644
--- a/gcc/rust/expand/rust-macro-builtins.cc
+++ b/gcc/rust/expand/rust-macro-builtins.cc
@@ -354,8 +354,7 @@ parse_single_string_literal (BuiltinMacro kind,
std::string
source_relative_path (std::string path, Location locus)
{
- std::string compile_fname
- = Session::get_instance ().linemap->location_file (locus);
+ std::string compile_fname = LOCATION_FILE (locus);
auto dir_separator_pos = compile_fname.rfind (file_separator);
@@ -410,8 +409,7 @@ MacroBuiltin::assert_handler (Location invoc_locus, AST::MacroInvocData &invoc)
AST::Fragment
MacroBuiltin::file_handler (Location invoc_locus, AST::MacroInvocData &)
{
- auto current_file
- = Session::get_instance ().linemap->location_file (invoc_locus);
+ auto current_file = LOCATION_FILE (invoc_locus);
auto file_str = AST::SingleASTNode (make_string (invoc_locus, current_file));
auto str_token
= make_token (Token::make_string (invoc_locus, std::move (current_file)));
@@ -422,8 +420,7 @@ MacroBuiltin::file_handler (Location invoc_locus, AST::MacroInvocData &)
AST::Fragment
MacroBuiltin::column_handler (Location invoc_locus, AST::MacroInvocData &)
{
- auto current_column
- = Session::get_instance ().linemap->location_to_column (invoc_locus);
+ auto current_column = LOCATION_COLUMN (invoc_locus);
auto column_tok = make_token (
Token::make_int (invoc_locus, std::to_string (current_column)));
@@ -896,8 +893,7 @@ MacroBuiltin::include_handler (Location invoc_locus, AST::MacroInvocData &invoc)
AST::Fragment
MacroBuiltin::line_handler (Location invoc_locus, AST::MacroInvocData &)
{
- auto current_line
- = Session::get_instance ().linemap->location_to_line (invoc_locus);
+ auto current_line = LOCATION_LINE (invoc_locus);
auto line_no = AST::SingleASTNode (std::unique_ptr<AST::Expr> (
new AST::LiteralExpr (std::to_string (current_line), AST::Literal::INT,