[ELF] Replace message(...) with Msg(ctx)
This commit is contained in:
parent
ce13dd1f7e
commit
3b75a5c4c8
@ -342,6 +342,9 @@ SyncStream::~SyncStream() {
|
||||
case DiagLevel::Log:
|
||||
e.log(buf);
|
||||
break;
|
||||
case DiagLevel::Msg:
|
||||
e.message(buf, llvm::outs());
|
||||
break;
|
||||
case DiagLevel::Warn:
|
||||
e.warn(buf);
|
||||
break;
|
||||
|
@ -710,6 +710,9 @@ inline const ELFSyncStream &operator<<(const ELFSyncStream &s, Error v) {
|
||||
// Report a log if --verbose is specified.
|
||||
ELFSyncStream Log(Ctx &ctx);
|
||||
|
||||
// Print a message to stdout.
|
||||
ELFSyncStream Msg(Ctx &ctx);
|
||||
|
||||
// Report a warning. Upgraded to an error if --fatal-warnings is specified.
|
||||
ELFSyncStream Warn(Ctx &ctx);
|
||||
|
||||
|
@ -85,6 +85,7 @@ static void setConfigs(Ctx &ctx, opt::InputArgList &args);
|
||||
static void readConfigs(Ctx &ctx, opt::InputArgList &args);
|
||||
|
||||
ELFSyncStream elf::Log(Ctx &ctx) { return {ctx, DiagLevel::Log}; }
|
||||
ELFSyncStream elf::Msg(Ctx &ctx) { return {ctx, DiagLevel::Msg}; }
|
||||
ELFSyncStream elf::Warn(Ctx &ctx) { return {ctx, DiagLevel::Warn}; }
|
||||
ELFSyncStream elf::Err(Ctx &ctx) {
|
||||
return {ctx, ctx.arg.noinhibitExec ? DiagLevel::Warn : DiagLevel::Err};
|
||||
@ -672,7 +673,7 @@ void LinkerDriver::linkerMain(ArrayRef<const char *> argsArr) {
|
||||
// of Libtool. We cannot convince every software developer to migrate to
|
||||
// the latest version and re-generate scripts. So we have this hack.
|
||||
if (args.hasArg(OPT_v) || args.hasArg(OPT_version))
|
||||
message(getLLDVersion() + " (compatible with GNU linkers)");
|
||||
Msg(ctx) << getLLDVersion() << " (compatible with GNU linkers)";
|
||||
|
||||
if (const char *path = getReproduceOption(args)) {
|
||||
// Note that --reproduce is a debug option so you can ignore it
|
||||
@ -1151,10 +1152,10 @@ static void ltoValidateAllVtablesHaveTypeInfos(Ctx &ctx,
|
||||
ctx.ltoAllVtablesHaveTypeInfos = vtableSymbolsWithNoRTTI.empty();
|
||||
// Check for unmatched RTTI symbols
|
||||
for (StringRef s : vtableSymbolsWithNoRTTI) {
|
||||
message(
|
||||
"--lto-validate-all-vtables-have-type-infos: RTTI missing for vtable "
|
||||
"_ZTV" +
|
||||
s + ", --lto-whole-program-visibility disabled");
|
||||
Msg(ctx) << "--lto-validate-all-vtables-have-type-infos: RTTI missing for "
|
||||
"vtable "
|
||||
"_ZTV"
|
||||
<< s << ", --lto-whole-program-visibility disabled";
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -461,7 +461,7 @@ static void combineRelocHashes(unsigned cnt, InputSection *isec,
|
||||
|
||||
static void print(Ctx &ctx, const Twine &s) {
|
||||
if (ctx.arg.printIcfSections)
|
||||
message(s);
|
||||
Msg(ctx) << s;
|
||||
}
|
||||
|
||||
// The main function of ICF.
|
||||
|
@ -316,7 +316,7 @@ template <class ELFT> static void doParseFile(Ctx &ctx, InputFile *file) {
|
||||
}
|
||||
|
||||
if (ctx.arg.trace)
|
||||
message(toStr(ctx, file));
|
||||
Msg(ctx) << file;
|
||||
|
||||
if (file->kind() == InputFile::ObjKind) {
|
||||
ctx.objectFiles.push_back(cast<ELFFileBase>(file));
|
||||
|
@ -391,7 +391,7 @@ template <class ELFT> void elf::markLive(Ctx &ctx) {
|
||||
if (ctx.arg.printGcSections)
|
||||
for (InputSectionBase *sec : ctx.inputSections)
|
||||
if (!sec->isLive())
|
||||
message("removing unused section " + toStr(ctx, sec));
|
||||
Msg(ctx) << "removing unused section " << sec;
|
||||
}
|
||||
|
||||
template void elf::markLive<ELF32LE>(Ctx &);
|
||||
|
@ -295,7 +295,7 @@ void elf::printTraceSymbol(const Symbol &sym, StringRef name) {
|
||||
else
|
||||
s = ": definition of ";
|
||||
|
||||
message(toStr(sym.file->ctx, sym.file) + s + name);
|
||||
Msg(ctx) << toStr(sym.file->ctx, sym.file) << s << name;
|
||||
}
|
||||
|
||||
static void recordWhyExtract(Ctx &ctx, const InputFile *reference,
|
||||
|
@ -152,7 +152,7 @@ void message(const Twine &msg, llvm::raw_ostream &s = outs());
|
||||
void warn(const Twine &msg);
|
||||
uint64_t errorCount();
|
||||
|
||||
enum class DiagLevel { Log, Warn, Err, Fatal };
|
||||
enum class DiagLevel { Log, Msg, Warn, Err, Fatal };
|
||||
|
||||
// A class that synchronizes thread writing to the same stream similar
|
||||
// std::osyncstream.
|
||||
|
Loading…
x
Reference in New Issue
Block a user