[llvm-commits] CVS: llvm/lib/Support/CommandLine.cpp
Devang Patel
dpatel at apple.com
Wed Jan 31 17:43:55 PST 2007
Changes in directory llvm/lib/Support:
CommandLine.cpp updated: 1.81 -> 1.82
---
Log message:
Add PrintVersionMessage() that tools can use to print version number
without exiting program.
---
Diffs of the changes: (+11 -3)
CommandLine.cpp | 14 +++++++++++---
1 files changed, 11 insertions(+), 3 deletions(-)
Index: llvm/lib/Support/CommandLine.cpp
diff -u llvm/lib/Support/CommandLine.cpp:1.81 llvm/lib/Support/CommandLine.cpp:1.82
--- llvm/lib/Support/CommandLine.cpp:1.81 Thu Dec 7 17:41:45 2006
+++ llvm/lib/Support/CommandLine.cpp Wed Jan 31 19:43:37 2007
@@ -980,9 +980,7 @@
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 @@
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 @@
NormalPrinter = true;
}
+/// Utility function for printing version number.
+void cl::PrintVersionMessage() {
+ VersionPrinterInstance.print();
+}
+
void cl::SetVersionPrinter(void (*func)()) {
OverrideVersionPrinter = func;
}
More information about the llvm-commits
mailing list