LLDB mainline
Version.cpp
Go to the documentation of this file.
1//===-- Version.cpp -------------------------------------------------------===//
2//
3// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4// See https://llvm.org/LICENSE.txt for license information.
5// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
6//
7//===----------------------------------------------------------------------===//
8
10#include "VCSVersion.inc"
11#include "lldb/Version/Version.inc"
12
13static const char *GetLLDBVersion() {
14#ifdef LLDB_FULL_VERSION_STRING
15 return LLDB_FULL_VERSION_STRING;
16#else
17 return "lldb version " LLDB_VERSION_STRING;
18#endif
19}
20
21static const char *GetLLDBRevision() {
22#ifdef LLDB_REVISION
23 return LLDB_REVISION;
24#else
25 return nullptr;
26#endif
27}
28
29static const char *GetLLDBRepository() {
30#ifdef LLDB_REPOSITORY
31 return LLDB_REPOSITORY;
32#else
33 return nullptr;
34#endif
35}
36
38 static std::string g_version_str;
39
40 if (g_version_str.empty()) {
41 const char *lldb_version = GetLLDBVersion();
42 const char *lldb_repo = GetLLDBRepository();
43 const char *lldb_rev = GetLLDBRevision();
44 g_version_str += lldb_version;
45 if (lldb_repo || lldb_rev) {
46 g_version_str += " (";
47 if (lldb_repo)
48 g_version_str += lldb_repo;
49 if (lldb_repo && lldb_rev)
50 g_version_str += " ";
51 if (lldb_rev) {
52 g_version_str += "revision ";
53 g_version_str += lldb_rev;
54 }
55 g_version_str += ")";
56 }
57 }
58
59 return g_version_str.c_str();
60}
static const char * GetLLDBVersion()
Definition Version.cpp:13
static const char * GetLLDBRepository()
Definition Version.cpp:29
static const char * GetLLDBRevision()
Definition Version.cpp:21
const char * GetVersion()
Retrieves a string representing the LLDB version, which includes the lldb version number,...
Definition Version.cpp:37