aboutsummaryrefslogtreecommitdiff
path: root/lib/Support/CommandLine.cpp
diff options
context:
space:
mode:
authorReid Spencer <rspencer@reidspencer.com>2004-11-14 22:04:00 +0000
committerReid Spencer <rspencer@reidspencer.com>2004-11-14 22:04:00 +0000
commitad0846bd8be0a86e0277e1890fd280c9868f830a (patch)
tree22ea310b63abb11e2c2b130b039ee11fcd3e8365 /lib/Support/CommandLine.cpp
parenta455cca62fd122279252cfaef0d473f932ee19e2 (diff)
Implement the MoreHelp utility that calls a function to printmore help information if the MoreHelp global is not null.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@17774 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Support/CommandLine.cpp')
-rw-r--r--lib/Support/CommandLine.cpp10
1 files changed, 10 insertions, 0 deletions
diff --git a/lib/Support/CommandLine.cpp b/lib/Support/CommandLine.cpp
index 90afa0d9e3..ad82c84947 100644
--- a/lib/Support/CommandLine.cpp
+++ b/lib/Support/CommandLine.cpp
@@ -834,6 +834,12 @@ void generic_parser_base::printOptionInfo(const Option &O,
//===----------------------------------------------------------------------===//
// --help and --help-hidden option implementation
//
+
+// If this variable is set, it is a pointer to a function that the user wants
+// us to call after we print out the help info. Basically a hook to allow
+// additional help to be printed.
+void (*cl::MoreHelp)() = 0;
+
namespace {
class HelpPrinter {
@@ -907,6 +913,10 @@ public:
for (unsigned i = 0, e = Options.size(); i != e; ++i)
Options[i].second->printOptionInfo(MaxArgLen);
+ // Call the user's hook so help output can be extended.
+ if (MoreHelp != 0)
+ (*MoreHelp)();
+
// Halt the program if help information is printed
exit(1);
}