[clang][modules] Don't prevent translation of FW_Private includes when explicitly...
[llvm-project.git] / lldb / source / Version / Version.cpp
blobb391fe1eacd80882c22044b7ef08497e994b06c9
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 //===----------------------------------------------------------------------===//
9 #include "lldb/Version/Version.h"
10 #include "VCSVersion.inc"
11 #include "lldb/Version/Version.inc"
12 #include "clang/Basic/Version.h"
14 static const char *GetLLDBVersion() {
15 #ifdef LLDB_FULL_VERSION_STRING
16 return LLDB_FULL_VERSION_STRING;
17 #else
18 return "lldb version " LLDB_VERSION_STRING;
19 #endif
22 static const char *GetLLDBRevision() {
23 #ifdef LLDB_REVISION
24 return LLDB_REVISION;
25 #else
26 return nullptr;
27 #endif
30 static const char *GetLLDBRepository() {
31 #ifdef LLDB_REPOSITORY
32 return LLDB_REPOSITORY;
33 #else
34 return nullptr;
35 #endif
38 const char *lldb_private::GetVersion() {
39 static std::string g_version_str;
41 if (g_version_str.empty()) {
42 const char *lldb_version = GetLLDBVersion();
43 const char *lldb_repo = GetLLDBRepository();
44 const char *lldb_rev = GetLLDBRevision();
45 g_version_str += lldb_version;
46 if (lldb_repo || lldb_rev) {
47 g_version_str += " (";
48 if (lldb_repo)
49 g_version_str += lldb_repo;
50 if (lldb_repo && lldb_rev)
51 g_version_str += " ";
52 if (lldb_rev) {
53 g_version_str += "revision ";
54 g_version_str += lldb_rev;
56 g_version_str += ")";
59 std::string clang_rev(clang::getClangRevision());
60 if (clang_rev.length() > 0) {
61 g_version_str += "\n clang revision ";
62 g_version_str += clang_rev;
65 std::string llvm_rev(clang::getLLVMRevision());
66 if (llvm_rev.length() > 0) {
67 g_version_str += "\n llvm revision ";
68 g_version_str += llvm_rev;
72 return g_version_str.c_str();