@@ -120,13 +120,14 @@ struct text_with_pos{
120
120
class positional_printer
121
121
{
122
122
// Core information
123
- std::ofstream out = {}; // Cpp1 syntax output file
124
- std::string filename = {};
125
- std::vector<comment> const * pcomments = {}; // Cpp2 comments data
123
+ std::ofstream out = {}; // Cpp1 syntax output file
124
+ std::string cpp2_filename = {};
125
+ std::string cpp1_filename = {};
126
+ std::vector<comment> const * pcomments = {}; // Cpp2 comments data
126
127
127
- source_position curr_pos = {}; // current (line,col) in output
128
- int next_comment = 0 ; // index of the next comment not yet printed
129
- bool last_was_cpp2 = false ;
128
+ source_position curr_pos = {}; // current (line,col) in output
129
+ int next_comment = 0 ; // index of the next comment not yet printed
130
+ bool last_was_cpp2 = false ;
130
131
131
132
struct req_act_info {
132
133
colno_t requested;
@@ -235,7 +236,7 @@ class positional_printer
235
236
236
237
// Not using print() here because this is transparent to the curr_pos
237
238
if (!flag_clean_cpp1) {
238
- out << " #line " << line << " " << std::quoted (filename + " 2 " ) << " \n " ;
239
+ out << " #line " << line << " " << std::quoted (cpp2_filename ) << " \n " ;
239
240
}
240
241
}
241
242
@@ -324,14 +325,16 @@ class positional_printer
324
325
// Open
325
326
//
326
327
auto open (
327
- std::string cpp1_filename,
328
+ std::string cpp2_filename_,
329
+ std::string cpp1_filename_,
328
330
std::vector<comment> const & comments
329
331
)
330
332
-> void
331
333
{
334
+ cpp2_filename = cpp2_filename_;
332
335
assert (!out.is_open () && !pcomments && " ICE: tried to call .open twice" );
333
- filename = cpp1_filename ;
334
- out.open (filename );
336
+ cpp1_filename = cpp1_filename_ ;
337
+ out.open (cpp1_filename );
335
338
pcomments = &comments;
336
339
}
337
340
@@ -352,7 +355,7 @@ class positional_printer
352
355
return ;
353
356
}
354
357
out.close ();
355
- std::remove (filename .c_str ());
358
+ std::remove (cpp1_filename .c_str ());
356
359
}
357
360
358
361
@@ -730,6 +733,7 @@ class cppfront
730
733
cpp1_filename = flag_cpp1_filename; // use override if present
731
734
}
732
735
printer.open (
736
+ sourcefile,
733
737
cpp1_filename,
734
738
tokens.get_comments ()
735
739
);
0 commit comments