1 //===-- lldb.cpp ------------------------------------------------*- C++ -*-===//
3 // The LLVM Compiler Infrastructure
5 // This file is distributed under the University of Illinois Open Source
6 // License. See LICENSE.TXT for details.
8 //===----------------------------------------------------------------------===//
10 #include "lldb/lldb-private.h"
13 using namespace lldb_private;
15 #include "clang/Basic/Version.h"
17 #ifdef HAVE_SVN_VERSION_INC
18 #include "SVNVersion.inc"
21 #ifdef HAVE_APPLE_VERSION_INC
22 #include "AppleVersion.inc"
25 static const char *GetLLDBRevision() {
33 static const char *GetLLDBRepository() {
34 #ifdef LLDB_REPOSITORY
35 return LLDB_REPOSITORY;
41 #define QUOTE(str) #str
42 #define EXPAND_AND_QUOTE(str) QUOTE(str)
44 const char *lldb_private::GetVersion() {
45 // On platforms other than Darwin, report a version number in the same style
47 static std::string g_version_str;
48 if (g_version_str.empty()) {
49 g_version_str += "lldb version ";
50 g_version_str += CLANG_VERSION_STRING;
52 const char *lldb_repo = GetLLDBRepository();
53 const char *lldb_rev = GetLLDBRevision();
54 if (lldb_repo || lldb_rev) {
55 g_version_str += " (";
57 g_version_str += lldb_repo;
59 g_version_str += " revision ";
60 g_version_str += lldb_rev;
65 std::string clang_rev(clang::getClangRevision());
66 if (clang_rev.length() > 0) {
67 g_version_str += "\n clang revision ";
68 g_version_str += clang_rev;
70 std::string llvm_rev(clang::getLLVMRevision());
71 if (llvm_rev.length() > 0) {
72 g_version_str += "\n llvm revision ";
73 g_version_str += llvm_rev;
76 return g_version_str.c_str();