[Lldb-commits] [lldb] r286899 - One more cleanup to lldb version printing
Chris Bieneman via lldb-commits
lldb-commits at lists.llvm.org
Mon Nov 14 14:43:08 PST 2016
Author: cbieneman
Date: Mon Nov 14 16:43:08 2016
New Revision: 286899
URL: http://llvm.org/viewvc/llvm-project?rev=286899&view=rev
Log:
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>)
Modified:
lldb/trunk/packages/Python/lldbsuite/test/help/TestHelp.py
lldb/trunk/source/lldb.cpp
Modified: lldb/trunk/packages/Python/lldbsuite/test/help/TestHelp.py
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/packages/Python/lldbsuite/test/help/TestHelp.py?rev=286899&r1=286898&r2=286899&view=diff
==============================================================================
--- lldb/trunk/packages/Python/lldbsuite/test/help/TestHelp.py (original)
+++ lldb/trunk/packages/Python/lldbsuite/test/help/TestHelp.py Mon Nov 14 16:43:08 2016
@@ -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)
Modified: lldb/trunk/source/lldb.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/lldb.cpp?rev=286899&r1=286898&r2=286899&view=diff
==============================================================================
--- lldb/trunk/source/lldb.cpp (original)
+++ lldb/trunk/source/lldb.cpp Mon Nov 14 16:43:08 2016
@@ -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 ";
More information about the lldb-commits
mailing list