diff options
author | Devang Patel <dpatel@apple.com> | 2007-02-01 01:43:37 +0000 |
---|---|---|
committer | Devang Patel <dpatel@apple.com> | 2007-02-01 01:43:37 +0000 |
commit | 9eb2caaeb63786ca6099cdd4edeb8075bd1a7fda (patch) | |
tree | bcba48825eff01802f7975f33fb846ae1e82a54b /llvm/lib/Support/CommandLine.cpp | |
parent | e3eeb24a86df6a70e3b5d277fa6ababdc3d8be6e (diff) | |
download | bcm5719-llvm-9eb2caaeb63786ca6099cdd4edeb8075bd1a7fda.tar.gz bcm5719-llvm-9eb2caaeb63786ca6099cdd4edeb8075bd1a7fda.zip |
Add PrintVersionMessage() that tools can use to print version number
without exiting program.
llvm-svn: 33737
Diffstat (limited to 'llvm/lib/Support/CommandLine.cpp')
-rw-r--r-- | llvm/lib/Support/CommandLine.cpp | 14 |
1 files changed, 11 insertions, 3 deletions
diff --git a/llvm/lib/Support/CommandLine.cpp b/llvm/lib/Support/CommandLine.cpp index 012f759d4f6..e556d76f965 100644 --- a/llvm/lib/Support/CommandLine.cpp +++ b/llvm/lib/Support/CommandLine.cpp @@ -980,9 +980,7 @@ static void (*OverrideVersionPrinter)() = 0; namespace { class VersionPrinter { public: - void operator=(bool OptionWasSpecified) { - if (OptionWasSpecified) { - if (OverrideVersionPrinter == 0) { + void print() { cout << "Low Level Virtual Machine (http://llvm.org/):\n"; cout << " " << PACKAGE_NAME << " version " << PACKAGE_VERSION; #ifdef LLVM_VERSION_INFO @@ -998,6 +996,11 @@ public: cout << " with assertions"; #endif cout << ".\n"; + } + void operator=(bool OptionWasSpecified) { + if (OptionWasSpecified) { + if (OverrideVersionPrinter == 0) { + print(); Options->clear(); // Don't bother making option dtors remove from map. exit(1); } else { @@ -1028,6 +1031,11 @@ void cl::PrintHelpMessage() { NormalPrinter = true; } +/// Utility function for printing version number. +void cl::PrintVersionMessage() { + VersionPrinterInstance.print(); +} + void cl::SetVersionPrinter(void (*func)()) { OverrideVersionPrinter = func; } |