One more cleanup to lldb version printing

With this patch LLDB_VERSION_STRING replaces "lldb version x.x.x" if it is set. This allows builds to not display the open source version numbers if the people making the distribution overrides the LLDB_VERSION_STRING.

Since LLDB_VERSION_STRING is always overridden on Darwin, this means the first line of lldb -version on Darwin is:

lldb-360.99.0 (<repo path> revision <revision>)

llvm-svn: 286899
This commit is contained in:
Chris Bieneman 2016-11-14 22:43:08 +00:00
parent d71de87be7
commit bd3d0263f8
2 changed files with 16 additions and 18 deletions

View File

@ -88,13 +88,10 @@ class HelpCommandTestCase(TestBase):
"""Test 'help version' and 'version' commands."""
self.expect("help version",
substrs=['Show the LLDB debugger version.'])
version_str = self.version_number_string()
import re
version_str = self.version_number_string()
match = re.match('[0-9]+', version_str)
if sys.platform.startswith("darwin"):
search_regexp = ['lldb-' + (version_str if match else '[0-9]+')]
else:
search_regexp = ['lldb version (\d|\.)+.*\n']
search_regexp = ['lldb( version|-' + (version_str if match else '[0-9]+') + ').*\n']
self.expect("version",
patterns=search_regexp)

View File

@ -47,25 +47,26 @@ const char *lldb_private::GetVersion() {
// as the clang tool.
static std::string g_version_str;
if (g_version_str.empty()) {
#ifdef LLDB_VERSION_STRING
g_version_str += EXPAND_AND_QUOTE(LLDB_VERSION_STRING);
#else
g_version_str += "lldb version ";
g_version_str += CLANG_VERSION_STRING;
#endif
const char *lldb_repo = GetLLDBRepository();
if (lldb_repo) {
g_version_str += " (";
g_version_str += lldb_repo;
}
const char *lldb_rev = GetLLDBRevision();
if (lldb_rev) {
g_version_str += " revision ";
g_version_str += lldb_rev;
if (lldb_repo || lldb_rev) {
g_version_str += " (";
if (lldb_repo)
g_version_str += lldb_repo;
if (lldb_rev) {
g_version_str += " revision ";
g_version_str += lldb_rev;
}
g_version_str += ")";
}
#ifdef LLDB_VERSION_STRING
g_version_str += " (";
g_version_str += EXPAND_AND_QUOTE(LLDB_VERSION_STRING);
g_version_str += ")";
#endif
std::string clang_rev(clang::getClangRevision());
if (clang_rev.length() > 0) {
g_version_str += "\n clang revision ";