@@ -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;
0 commit comments