llvm.org GIT mirror llvm / aed293d
Add PrintVersionMessage() that tools can use to print version number without exiting program. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@33737 91177308-0d34-0410-b5e6-96231b3b80d8 Devang Patel 12 years ago
2 changed file(s) with 12 addition(s) and 3 deletion(s). Raw diff Collapse all Expand all
12801280 extrahelp(const char* help);
12811281 };
12821282
1283 void PrintVersionMessage();
12831284 // This function just prints the help message, exactly the same way as if the
12841285 // --help option had been given on the command line.
12851286 // NOTE: THIS FUNCTION TERMINATES THE PROGRAM!
979979 namespace {
980980 class VersionPrinter {
981981 public:
982 void operator=(bool OptionWasSpecified) {
983 if (OptionWasSpecified) {
984 if (OverrideVersionPrinter == 0) {
982 void print() {
985983 cout << "Low Level Virtual Machine (http://llvm.org/):\n";
986984 cout << " " << PACKAGE_NAME << " version " << PACKAGE_VERSION;
987985 #ifdef LLVM_VERSION_INFO
997995 cout << " with assertions";
998996 #endif
999997 cout << ".\n";
998 }
999 void operator=(bool OptionWasSpecified) {
1000 if (OptionWasSpecified) {
1001 if (OverrideVersionPrinter == 0) {
1002 print();
10001003 Options->clear(); // Don't bother making option dtors remove from map.
10011004 exit(1);
10021005 } else {
10271030 NormalPrinter = true;
10281031 }
10291032
1033 /// Utility function for printing version number.
1034 void cl::PrintVersionMessage() {
1035 VersionPrinterInstance.print();
1036 }
1037
10301038 void cl::SetVersionPrinter(void (*func)()) {
10311039 OverrideVersionPrinter = func;
10321040 }