@@ -86,7 +86,7 @@ The input Carbon source file to compile.
86
86
},
87
87
[&](auto & arg_b) {
88
88
arg_b.Required (true );
89
- arg_b.Append (&input_file_names );
89
+ arg_b.Append (&input_filenames );
90
90
});
91
91
92
92
b.AddOneOfOption (
@@ -128,7 +128,7 @@ Passing `--output=-` will write the output to stdout. In that case, the flag
128
128
object output can be forced by enabling `--force-obj-output`.
129
129
)""" ,
130
130
},
131
- [&](auto & arg_b) { arg_b.Set (&output_file_name ); });
131
+ [&](auto & arg_b) { arg_b.Set (&output_filename ); });
132
132
133
133
b.AddStringOption (
134
134
{
@@ -262,8 +262,8 @@ Dump the generated assembly to stdout after codegen.
262
262
std::string host = llvm::sys::getDefaultTargetTriple();
263
263
llvm::StringRef target;
264
264
265
- llvm::StringRef output_file_name ;
266
- llvm::SmallVector<llvm::StringRef> input_file_names ;
265
+ llvm::StringRef output_filename ;
266
+ llvm::SmallVector<llvm::StringRef> input_filenames ;
267
267
268
268
bool asm_output = false ;
269
269
bool force_obj_output = false ;
@@ -395,10 +395,10 @@ auto Driver::ValidateCompileOptions(const CompileOptions& options) const
395
395
class Driver ::CompilationUnit {
396
396
public:
397
397
explicit CompilationUnit (Driver* driver, const CompileOptions& options,
398
- llvm::StringRef input_file_name )
398
+ llvm::StringRef input_filename )
399
399
: driver_(driver),
400
400
options_(options),
401
- input_file_name_(input_file_name ),
401
+ input_filename_(input_filename ),
402
402
vlog_stream_(driver_->vlog_stream_),
403
403
stream_consumer_(driver_->error_stream_) {
404
404
if (vlog_stream_ != nullptr || options_.stream_errors ) {
@@ -412,10 +412,10 @@ class Driver::CompilationUnit {
412
412
// Loads source and lexes it. Returns true on success.
413
413
auto RunLex () -> void {
414
414
LogCall (" SourceBuffer::MakeFromFile" , [&] {
415
- if (input_file_name_ == " -" ) {
415
+ if (input_filename_ == " -" ) {
416
416
source_ = SourceBuffer::MakeFromStdin (*consumer_);
417
417
} else {
418
- source_ = SourceBuffer::MakeFromFile (driver_->fs_ , input_file_name_ ,
418
+ source_ = SourceBuffer::MakeFromFile (driver_->fs_ , input_filename_ ,
419
419
*consumer_);
420
420
}
421
421
});
@@ -501,7 +501,7 @@ class Driver::CompilationUnit {
501
501
502
502
LogCall (" Lower::LowerToLLVM" , [&] {
503
503
llvm_context_ = std::make_unique<llvm::LLVMContext>();
504
- module_ = Lower::LowerToLLVM (*llvm_context_, input_file_name_ , *sem_ir_,
504
+ module_ = Lower::LowerToLLVM (*llvm_context_, input_filename_ , *sem_ir_,
505
505
vlog_stream_);
506
506
});
507
507
if (vlog_stream_) {
@@ -526,10 +526,10 @@ class Driver::CompilationUnit {
526
526
527
527
auto PrintSharedValues () const -> void {
528
528
Yaml::Print (driver_->output_stream_ ,
529
- value_stores_.OutputYaml (input_file_name_ ));
529
+ value_stores_.OutputYaml (input_filename_ ));
530
530
}
531
531
532
- auto input_file_name () -> llvm::StringRef { return input_file_name_ ; }
532
+ auto input_filename () -> llvm::StringRef { return input_filename_ ; }
533
533
auto success () -> bool { return success_; }
534
534
auto has_source () -> bool { return source_.has_value (); }
535
535
@@ -546,7 +546,7 @@ class Driver::CompilationUnit {
546
546
codegen->EmitAssembly (*vlog_stream_);
547
547
}
548
548
549
- if (options_.output_file_name == " -" ) {
549
+ if (options_.output_filename == " -" ) {
550
550
// TODO: the output file name, forcing object output, and requesting
551
551
// textual assembly output are all somewhat linked flags. We should add
552
552
// some validation that they are used correctly.
@@ -560,17 +560,17 @@ class Driver::CompilationUnit {
560
560
}
561
561
}
562
562
} else {
563
- llvm::SmallString<256 > output_file_name = options_.output_file_name ;
564
- if (output_file_name .empty ()) {
563
+ llvm::SmallString<256 > output_filename = options_.output_filename ;
564
+ if (output_filename .empty ()) {
565
565
if (!source_->is_regular_file ()) {
566
566
// Don't invent file names like `-.o` or `/dev/stdin.o`.
567
567
driver_->error_stream_
568
568
<< " ERROR: Output file name must be specified for input '"
569
- << input_file_name_ << " ' that is not a regular file.\n " ;
569
+ << input_filename_ << " ' that is not a regular file.\n " ;
570
570
return false ;
571
571
}
572
- output_file_name = input_file_name_ ;
573
- llvm::sys::path::replace_extension (output_file_name ,
572
+ output_filename = input_filename_ ;
573
+ llvm::sys::path::replace_extension (output_filename ,
574
574
options_.asm_output ? " .s" : " .o" );
575
575
} else {
576
576
// TODO: Handle the case where multiple input files were specified
@@ -579,14 +579,14 @@ class Driver::CompilationUnit {
579
579
// Currently each unit overwrites the output from the previous one in
580
580
// this case.
581
581
}
582
- CARBON_VLOG () << " Writing output to: " << output_file_name << " \n " ;
582
+ CARBON_VLOG () << " Writing output to: " << output_filename << " \n " ;
583
583
584
584
std::error_code ec;
585
- llvm::raw_fd_ostream output_file (output_file_name , ec,
585
+ llvm::raw_fd_ostream output_file (output_filename , ec,
586
586
llvm::sys::fs::OF_None);
587
587
if (ec) {
588
588
driver_->error_stream_ << " ERROR: Could not open output file '"
589
- << output_file_name << " ': " << ec.message ()
589
+ << output_filename << " ': " << ec.message ()
590
590
<< " \n " ;
591
591
return false ;
592
592
}
@@ -606,15 +606,15 @@ class Driver::CompilationUnit {
606
606
// Wraps a call with log statements to indicate start and end.
607
607
auto LogCall (llvm::StringLiteral label, llvm::function_ref<void ()> fn)
608
608
-> void {
609
- CARBON_VLOG () << " *** " << label << " : " << input_file_name_ << " ***\n " ;
609
+ CARBON_VLOG () << " *** " << label << " : " << input_filename_ << " ***\n " ;
610
610
fn ();
611
611
CARBON_VLOG () << " *** " << label << " done ***\n " ;
612
612
}
613
613
614
614
Driver* driver_;
615
615
SharedValueStores value_stores_;
616
616
const CompileOptions& options_;
617
- llvm::StringRef input_file_name_ ;
617
+ llvm::StringRef input_filename_ ;
618
618
619
619
// Copied from driver_ for CARBON_VLOG.
620
620
llvm::raw_pwrite_stream* vlog_stream_;
@@ -646,7 +646,7 @@ auto Driver::Compile(const CompileOptions& options) -> RunResult {
646
646
for (const auto & unit : units) {
647
647
result.success &= unit->success ();
648
648
result.per_file_success .push_back (
649
- {unit->input_file_name (), unit->success ()});
649
+ {unit->input_filename (), unit->success ()});
650
650
}
651
651
return result;
652
652
};
@@ -666,9 +666,9 @@ auto Driver::Compile(const CompileOptions& options) -> RunResult {
666
666
}
667
667
}
668
668
});
669
- for (const auto & input_file_name : options.input_file_names ) {
669
+ for (const auto & input_filename : options.input_filenames ) {
670
670
units.push_back (
671
- std::make_unique<CompilationUnit>(this , options, input_file_name ));
671
+ std::make_unique<CompilationUnit>(this , options, input_filename ));
672
672
}
673
673
674
674
// Lex.
0 commit comments