Skip to content

Commit

Permalink
Avoid std::endl
Browse files Browse the repository at this point in the history
  • Loading branch information
SimplyDanny committed Dec 6, 2023
1 parent a30d7ea commit 47c4fe9
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 8 deletions.
3 changes: 2 additions & 1 deletion src/bitsyc.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,8 @@ int main(int argc, char *argv[]) {

std::ifstream file_stream{opt::input_name};
if (!file_stream.good()) {
std::cerr << "Cannot open the input file." << std::endl;
std::cerr << "Cannot open the input file."
<< "\n";
return 1;
}

Expand Down
12 changes: 6 additions & 6 deletions src/execution/ModuleProcessor.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -37,23 +37,23 @@ bool ModuleProcessor::show_cfg() const {

auto dot_program = llvm::sys::findProgramByName("dot");
if (!dot_program) {
std::cerr << "The 'dot' program cannot be found in your PATH." << std::endl;
std::cerr << "The 'dot' program cannot be found in your PATH." << '\n';
return false;
}
auto png_file = std::filesystem::current_path() / (output_name + ".png");
llvm::ArrayRef<llvm::StringRef> dot_arguments{*dot_program, "-Tpng", "-o", png_file.c_str(), dot_file.c_str()};
if (llvm::sys::ExecuteAndWait(*dot_program, dot_arguments) != 0) {
std::cerr << "Error converting DOT file to PNG file." << std::endl;
std::cerr << "Error converting DOT file to PNG file." << '\n';
return false;
}
std::cout << "PNG file " << png_file << " generated." << std::endl;
std::cout << "PNG file " << png_file << " generated." << '\n';

#if defined(__APPLE__)
std::cout << "Opening it ..." << std::endl;
std::cout << "Opening it ..." << '\n';
auto open_program = llvm::sys::findProgramByName("open");
llvm::ArrayRef<llvm::StringRef> open_arguments{*open_program, png_file.c_str()};
if (llvm::sys::ExecuteAndWait(*open_program, open_arguments) != 0) {
std::cerr << "Error opening PNG file." << std::endl;
std::cerr << "Error opening PNG file." << '\n';
return false;
}
#endif
Expand Down Expand Up @@ -87,7 +87,7 @@ int ModuleProcessor::compile() const {
std::error_code error_code;
llvm::raw_fd_ostream file_stream{ll_file.string(), error_code};
if (error_code.value() != 0) {
std::cerr << "Error creating temporary file for IR output." << std::endl;
std::cerr << "Error creating temporary file for IR output." << '\n';
return error_code.value();
}
module->print(file_stream, nullptr);
Expand Down
2 changes: 1 addition & 1 deletion src/helper/ConsolePrinter.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ ConsolePrinter &ConsolePrinter::operator<<(const EndlPrinter &endl_printer) {
}

void endl(ConsolePrinter &printer) {
std::cout << std::endl;
std::cout << '\n';
printer.last_was_endl = true;
}

Expand Down

0 comments on commit 47c4fe9

Please sign in to comment.