Skip to content

Commit 8c7c8ea

Browse files
committed
[lld-link] Replace global lld::errs() with ctx.e.errs()
1 parent 5bb9465 commit 8c7c8ea

File tree

2 files changed

+8
-7
lines changed

2 files changed

+8
-7
lines changed

lld/COFF/DriverUtils.cpp

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -858,21 +858,22 @@ COFFOptTable::COFFOptTable() : GenericOptTable(infoTable, true) {}
858858

859859
// Set color diagnostics according to --color-diagnostics={auto,always,never}
860860
// or --no-color-diagnostics flags.
861-
static void handleColorDiagnostics(opt::InputArgList &args) {
861+
static void handleColorDiagnostics(COFFLinkerContext &ctx,
862+
opt::InputArgList &args) {
862863
auto *arg = args.getLastArg(OPT_color_diagnostics, OPT_color_diagnostics_eq,
863864
OPT_no_color_diagnostics);
864865
if (!arg)
865866
return;
866867
if (arg->getOption().getID() == OPT_color_diagnostics) {
867-
lld::errs().enable_colors(true);
868+
ctx.e.errs().enable_colors(true);
868869
} else if (arg->getOption().getID() == OPT_no_color_diagnostics) {
869-
lld::errs().enable_colors(false);
870+
ctx.e.errs().enable_colors(false);
870871
} else {
871872
StringRef s = arg->getValue();
872873
if (s == "always")
873-
lld::errs().enable_colors(true);
874+
ctx.e.errs().enable_colors(true);
874875
else if (s == "never")
875-
lld::errs().enable_colors(false);
876+
ctx.e.errs().enable_colors(false);
876877
else if (s != "auto")
877878
error("unknown option: --color-diagnostics=" + s);
878879
}
@@ -939,7 +940,7 @@ opt::InputArgList ArgParser::parse(ArrayRef<const char *> argv) {
939940
if (missingCount)
940941
fatal(Twine(args.getArgString(missingIndex)) + ": missing argument");
941942

942-
handleColorDiagnostics(args);
943+
handleColorDiagnostics(ctx, args);
943944

944945
for (opt::Arg *arg : args.filtered(OPT_UNKNOWN)) {
945946
std::string nearest;

lld/COFF/Writer.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2461,7 +2461,7 @@ void Writer::sortExceptionTables() {
24612461
break;
24622462
default:
24632463
if (pdata.first)
2464-
lld::errs() << "warning: don't know how to handle .pdata.\n";
2464+
ctx.e.errs() << "warning: don't know how to handle .pdata\n";
24652465
break;
24662466
}
24672467
}

0 commit comments

Comments
 (0)