diff --git a/include/llvm/Support/CommandLine.h b/include/llvm/Support/CommandLine.h index 8d4ac81d294..d1d698400df 100644 --- a/include/llvm/Support/CommandLine.h +++ b/include/llvm/Support/CommandLine.h @@ -343,6 +343,9 @@ public: virtual void printOptionValue(size_t GlobalWidth, bool Force) const = 0; + static void printHelpStr(StringRef HelpStr, size_t Indent, + size_t FirstLineIndentedBy); + virtual void getExtraOptionNames(SmallVectorImpl &) {} // addOccurrence - Wrapper around handleOccurrence that enforces Flags. diff --git a/lib/Support/CMakeLists.txt b/lib/Support/CMakeLists.txt index f7cfa760ba0..4f7f2166cd0 100644 --- a/lib/Support/CMakeLists.txt +++ b/lib/Support/CMakeLists.txt @@ -47,6 +47,7 @@ add_llvm_library(LLVMSupport CrashRecoveryContext.cpp DataExtractor.cpp Debug.cpp + DebugCounter.cpp DeltaAlgorithm.cpp DAGDeltaAlgorithm.cpp Dwarf.cpp diff --git a/lib/Support/CommandLine.cpp b/lib/Support/CommandLine.cpp index 3889902eea5..b1142d79cdb 100644 --- a/lib/Support/CommandLine.cpp +++ b/lib/Support/CommandLine.cpp @@ -1404,8 +1404,8 @@ static StringRef getValueStr(const Option &O, StringRef DefaultMsg) { // Return the width of the option tag for printing... size_t alias::getOptionWidth() const { return ArgStr.size() + 6; } -static void printHelpStr(StringRef HelpStr, size_t Indent, - size_t FirstLineIndentedBy) { +void Option::printHelpStr(StringRef HelpStr, size_t Indent, + size_t FirstLineIndentedBy) { std::pair Split = HelpStr.split('\n'); outs().indent(Indent - FirstLineIndentedBy) << " - " << Split.first << "\n"; while (!Split.second.empty()) { @@ -1448,7 +1448,7 @@ void basic_parser_impl::printOptionInfo(const Option &O, if (!ValName.empty()) outs() << "=<" << getValueStr(O, ValName) << '>'; - printHelpStr(O.HelpStr, GlobalWidth, getOptionWidth(O)); + Option::printHelpStr(O.HelpStr, GlobalWidth, getOptionWidth(O)); } void basic_parser_impl::printOptionName(const Option &O, @@ -1587,7 +1587,7 @@ void generic_parser_base::printOptionInfo(const Option &O, size_t GlobalWidth) const { if (O.hasArgStr()) { outs() << " -" << O.ArgStr; - printHelpStr(O.HelpStr, GlobalWidth, O.ArgStr.size() + 6); + Option::printHelpStr(O.HelpStr, GlobalWidth, O.ArgStr.size() + 6); for (unsigned i = 0, e = getNumOptions(); i != e; ++i) { size_t NumSpaces = GlobalWidth - getOption(i).size() - 8; @@ -1600,7 +1600,7 @@ void generic_parser_base::printOptionInfo(const Option &O, for (unsigned i = 0, e = getNumOptions(); i != e; ++i) { auto Option = getOption(i); outs() << " -" << Option; - printHelpStr(getDescription(i), GlobalWidth, Option.size() + 8); + Option::printHelpStr(getDescription(i), GlobalWidth, Option.size() + 8); } } }