19
19
#include < iostream>
20
20
#include < cstdio>
21
21
#include < optional>
22
- #include < filesystem>
23
22
24
23
namespace cpp2 {
25
24
@@ -69,14 +68,6 @@ static cmdline_processor::register_flag cmd_noline(
69
68
[]{ flag_clean_cpp1 = true ; }
70
69
);
71
70
72
- static auto flag_absolute_line_directives = false ;
73
- static cmdline_processor::register_flag cmd_absolute_line_directives (
74
- 9 ,
75
- " absolute-line-directives" ,
76
- " Emit absolute paths in #line directives" ,
77
- [] { flag_absolute_line_directives = true ; }
78
- );
79
-
80
71
static auto flag_import_std = false ;
81
72
static cmdline_processor::register_flag cmd_import_std (
82
73
0 ,
@@ -231,11 +222,6 @@ class positional_printer
231
222
bool printed_extra = false ;
232
223
char last_printed_char = {};
233
224
234
- struct line_directive_info {
235
- lineno_t out_pos_line; // output lineno where the line directive was printed
236
- lineno_t line; // the lineno in the line directive
237
- } prev_line_directive = {};
238
-
239
225
struct req_act_info {
240
226
colno_t requested;
241
227
colno_t offset;
@@ -415,15 +401,6 @@ class positional_printer
415
401
return ;
416
402
}
417
403
418
- // Don't print duplicate line directives on subsequent lines
419
- if (
420
- prev_line_directive.out_pos_line == curr_pos.lineno
421
- && prev_line_directive.line == line
422
- )
423
- {
424
- return ;
425
- }
426
-
427
404
// Otherwise, implement the request
428
405
prev_line_info = { curr_pos.lineno , { } };
429
406
ensure_at_start_of_new_line ();
@@ -434,7 +411,6 @@ class positional_printer
434
411
*out << " #line " << line << " " << std::quoted (cpp2_filename) << " \n " ;
435
412
}
436
413
just_printed_line_directive = true ;
437
- prev_line_directive = { curr_pos.lineno , line };
438
414
}
439
415
440
416
// Catch up with comment/blank lines
@@ -644,9 +620,7 @@ class positional_printer
644
620
)
645
621
-> void
646
622
{
647
- cpp2_filename = (flag_absolute_line_directives) ?
648
- std::filesystem::absolute (std::filesystem::path (cpp2_filename_)).string () :
649
- cpp2_filename_;
623
+ cpp2_filename = cpp2_filename_;
650
624
assert (
651
625
!is_open ()
652
626
&& !pcomments
@@ -5627,12 +5601,6 @@ class cppfront
5627
5601
)
5628
5602
)
5629
5603
{
5630
- // Print a line directive before every function definition
5631
- // (needed to enable debugging with lldb).
5632
- if (n.initializer ) {
5633
- printer.print_extra (" " );
5634
- }
5635
-
5636
5604
auto is_streaming_operator = [](std::string_view sv) {
5637
5605
return
5638
5606
sv == " operator<<"
@@ -5964,6 +5932,7 @@ class cppfront
5964
5932
// Else emit the definition
5965
5933
else if (n.initializer )
5966
5934
{
5935
+
5967
5936
if (func->returns .index () == function_type_node::list) {
5968
5937
auto & r = std::get<function_type_node::list>(func->returns );
5969
5938
function_returns.emplace_back (r.get ());
0 commit comments