mirror of
https://github.com/RPCS3/llvm-mirror.git
synced 2025-02-01 05:01:59 +01:00
Add PrintVersionMessage() that tools can use to print version number
without exiting program. llvm-svn: 33737
This commit is contained in:
parent
18483c395e
commit
46a1a617f5
@ -1281,6 +1281,7 @@ struct extrahelp {
|
|||||||
extrahelp(const char* help);
|
extrahelp(const char* help);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
void PrintVersionMessage();
|
||||||
// This function just prints the help message, exactly the same way as if the
|
// This function just prints the help message, exactly the same way as if the
|
||||||
// --help option had been given on the command line.
|
// --help option had been given on the command line.
|
||||||
// NOTE: THIS FUNCTION TERMINATES THE PROGRAM!
|
// NOTE: THIS FUNCTION TERMINATES THE PROGRAM!
|
||||||
|
@ -980,9 +980,7 @@ static void (*OverrideVersionPrinter)() = 0;
|
|||||||
namespace {
|
namespace {
|
||||||
class VersionPrinter {
|
class VersionPrinter {
|
||||||
public:
|
public:
|
||||||
void operator=(bool OptionWasSpecified) {
|
void print() {
|
||||||
if (OptionWasSpecified) {
|
|
||||||
if (OverrideVersionPrinter == 0) {
|
|
||||||
cout << "Low Level Virtual Machine (http://llvm.org/):\n";
|
cout << "Low Level Virtual Machine (http://llvm.org/):\n";
|
||||||
cout << " " << PACKAGE_NAME << " version " << PACKAGE_VERSION;
|
cout << " " << PACKAGE_NAME << " version " << PACKAGE_VERSION;
|
||||||
#ifdef LLVM_VERSION_INFO
|
#ifdef LLVM_VERSION_INFO
|
||||||
@ -998,6 +996,11 @@ public:
|
|||||||
cout << " with assertions";
|
cout << " with assertions";
|
||||||
#endif
|
#endif
|
||||||
cout << ".\n";
|
cout << ".\n";
|
||||||
|
}
|
||||||
|
void operator=(bool OptionWasSpecified) {
|
||||||
|
if (OptionWasSpecified) {
|
||||||
|
if (OverrideVersionPrinter == 0) {
|
||||||
|
print();
|
||||||
Options->clear(); // Don't bother making option dtors remove from map.
|
Options->clear(); // Don't bother making option dtors remove from map.
|
||||||
exit(1);
|
exit(1);
|
||||||
} else {
|
} else {
|
||||||
@ -1028,6 +1031,11 @@ void cl::PrintHelpMessage() {
|
|||||||
NormalPrinter = true;
|
NormalPrinter = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// Utility function for printing version number.
|
||||||
|
void cl::PrintVersionMessage() {
|
||||||
|
VersionPrinterInstance.print();
|
||||||
|
}
|
||||||
|
|
||||||
void cl::SetVersionPrinter(void (*func)()) {
|
void cl::SetVersionPrinter(void (*func)()) {
|
||||||
OverrideVersionPrinter = func;
|
OverrideVersionPrinter = func;
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user