Index: llvm/lib/Support/CommandLine.cpp =================================================================== --- llvm/lib/Support/CommandLine.cpp +++ llvm/lib/Support/CommandLine.cpp @@ -129,6 +129,19 @@ return OS; } +// Use for inline printing (omit leading spaces) +class PrintArgInline { + StringRef ArgName; +public: + PrintArgInline(StringRef ArgName) : ArgName(ArgName) {} + friend raw_ostream &operator<<(raw_ostream &OS, const PrintArgInline &); +}; + +raw_ostream &operator<<(raw_ostream &OS, const PrintArgInline &Arg) { + OS << argPrefix(Arg.ArgName).ltrim() << Arg.ArgName; + return OS; +} + class CommandLineParser { public: // Globals for name and overview of program. Program name is not a string to @@ -1447,7 +1460,7 @@ if (NearestHandler) { // If we know a near match, report it as well. *Errs << ProgramName << ": Did you mean '" - << PrintArg(NearestHandlerString) << "'?\n"; + << PrintArgInline(NearestHandlerString) << "'?\n"; } ErrorParsing = true; @@ -1601,7 +1614,7 @@ if (ArgName.empty()) Errs << HelpStr; // Be nice for positional arguments else - Errs << GlobalParser->ProgramName << ": for the " << PrintArg(ArgName); + Errs << GlobalParser->ProgramName << ": for the " << PrintArgInline(ArgName); Errs << " option: " << Message << "\n"; return true;