mirror of
https://github.com/xomboverlord/ldc.git
synced 2026-02-28 01:23:14 +01:00
Use LLVM OStream wrapper instead of <iostream> in the logger.
llvm::OStream provides all std::ostream functionality (by holding a
std::ostream* internally), but
* doesn't include <iostream>, avoiding per-file overhead.
* allows the stream pointer to be null, and the (inlined) operators do nothing
when that's the case. (This also allows removal of the ofstream("/dev/null")
hack Logger used when disabled, which presumably wasn't very portable)
This commit is contained in:
@@ -8,7 +8,6 @@
|
||||
// See the included readme.txt for details.
|
||||
|
||||
#include <cstddef>
|
||||
#include <iostream>
|
||||
#include <fstream>
|
||||
|
||||
#include "gen/llvm.h"
|
||||
@@ -344,13 +343,15 @@ void assemble(const llvm::sys::Path& asmpath, const llvm::sys::Path& objpath)
|
||||
Args.push_back(args[i].c_str());
|
||||
Args.push_back(0);
|
||||
|
||||
Logger::println("Assembling with: ");
|
||||
std::vector<const char*>::const_iterator I = Args.begin(), E = Args.end();
|
||||
std::ostream& logstr = Logger::cout();
|
||||
for (; I != E; ++I)
|
||||
if (*I)
|
||||
logstr << "'" << *I << "'" << " ";
|
||||
logstr << "\n" << std::flush;
|
||||
if (Logger::enabled()) {
|
||||
Logger::println("Assembling with: ");
|
||||
std::vector<const char*>::const_iterator I = Args.begin(), E = Args.end();
|
||||
std::ostream& logstr = *Logger::cout().stream();
|
||||
for (; I != E; ++I)
|
||||
if (*I)
|
||||
logstr << "'" << *I << "'" << " ";
|
||||
logstr << "\n" << std::flush;
|
||||
}
|
||||
|
||||
// Run the compiler to assembly the program.
|
||||
std::string ErrMsg;
|
||||
|
||||
Reference in New Issue
Block a user