@@ -69,28 +69,31 @@ MachOOptTable::MachOOptTable() : GenericOptTable(optInfo) {}
6969
7070// Set color diagnostics according to --color-diagnostics={auto,always,never}
7171// or --no-color-diagnostics flags.
72- static void handleColorDiagnostics (InputArgList &args) {
72+ static void handleColorDiagnostics (CommonLinkerContext &ctx,
73+ InputArgList &args) {
7374 const Arg *arg =
7475 args.getLastArg (OPT_color_diagnostics, OPT_color_diagnostics_eq,
7576 OPT_no_color_diagnostics);
7677 if (!arg)
7778 return ;
79+ auto &errs = ctx.e .errs ();
7880 if (arg->getOption ().getID () == OPT_color_diagnostics) {
79- lld:: errs() .enable_colors (true );
81+ errs.enable_colors (true );
8082 } else if (arg->getOption ().getID () == OPT_no_color_diagnostics) {
81- lld:: errs() .enable_colors (false );
83+ errs.enable_colors (false );
8284 } else {
8385 StringRef s = arg->getValue ();
8486 if (s == " always" )
85- lld:: errs() .enable_colors (true );
87+ errs.enable_colors (true );
8688 else if (s == " never" )
87- lld:: errs() .enable_colors (false );
89+ errs.enable_colors (false );
8890 else if (s != " auto" )
8991 error (" unknown option: --color-diagnostics=" + s);
9092 }
9193}
9294
93- InputArgList MachOOptTable::parse (ArrayRef<const char *> argv) {
95+ InputArgList MachOOptTable::parse (CommonLinkerContext &ctx,
96+ ArrayRef<const char *> argv) {
9497 // Make InputArgList from string vectors.
9598 unsigned missingIndex;
9699 unsigned missingCount;
@@ -109,7 +112,7 @@ InputArgList MachOOptTable::parse(ArrayRef<const char *> argv) {
109112 if (missingCount)
110113 error (Twine (args.getArgString (missingIndex)) + " : missing argument" );
111114
112- handleColorDiagnostics (args);
115+ handleColorDiagnostics (ctx, args);
113116
114117 for (const Arg *arg : args.filtered (OPT_UNKNOWN)) {
115118 std::string nearest;
@@ -122,11 +125,12 @@ InputArgList MachOOptTable::parse(ArrayRef<const char *> argv) {
122125 return args;
123126}
124127
125- void MachOOptTable::printHelp (const char *argv0, bool showHidden) const {
126- OptTable::printHelp (lld::outs (),
127- (std::string (argv0) + " [options] file..." ).c_str (),
128+ void MachOOptTable::printHelp (CommonLinkerContext &ctx, const char *argv0,
129+ bool showHidden) const {
130+ auto &outs = ctx.e .outs ();
131+ OptTable::printHelp (outs, (std::string (argv0) + " [options] file..." ).c_str (),
128132 " LLVM Linker" , showHidden);
129- lld:: outs() << " \n " ;
133+ outs << ' \n ' ;
130134}
131135
132136static std::string rewritePath (StringRef s) {
0 commit comments