// Newly created memory buffers are owned by this driver.
void LinkerDriver::addFile(StringRef Path) {
using namespace llvm::sys::fs;
- if (Config->Verbose)
- llvm::outs() << Path << "\n";
+ log(Path);
auto MBOrErr = MemoryBuffer::getFile(Path);
if (error(MBOrErr, "cannot open " + Path))
return;
//===----------------------------------------------------------------------===//
#include "Error.h"
+#include "Config.h"
#include "llvm/ADT/Twine.h"
#include "llvm/Support/raw_ostream.h"
bool HasError;
llvm::raw_ostream *ErrorOS;
+void log(const Twine &Msg) {
+ if (Config->Verbose)
+ llvm::outs() << Msg << "\n";
+}
+
void warning(const Twine &Msg) { llvm::errs() << Msg << "\n"; }
void error(const Twine &Msg) {
extern bool HasError;
extern llvm::raw_ostream *ErrorOS;
+void log(const Twine &Msg);
void warning(const Twine &Msg);
void error(const Twine &Msg);
if (Id == NextId)
break;
}
- if (Config->Verbose)
- llvm::outs() << "ICF needed " << Cnt << " iterations.\n";
+ log("ICF needed " + Twine(Cnt) + " iterations.");
// Merge sections in the same group.
for (auto I = V.begin(), E = V.end(); I != E;) {
});
if (I == Bound)
continue;
- if (Config->Verbose)
- llvm::outs() << "Selected " << Head->getSectionName() << "\n";
+ log("Selected " + Head->getSectionName());
while (I != Bound) {
InputSection<ELFT> *S = *I++;
- if (Config->Verbose)
- llvm::outs() << " Removed " << S->getSectionName() << "\n";
+ log(" Removed " + S->getSectionName());
Head->replace(S);
}
}