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;
42 #define QUOTE(str) #str
43 #define EXPAND_AND_QUOTE(str) QUOTE(str)
45 const char *lldb_private::GetVersion() {
46 // On platforms other than Darwin, report a version number in the same style
48 static std::string g_version_str;
49 if (g_version_str.empty()) {
51 #ifdef LLDB_VERSION_STRING
52 g_version_str += EXPAND_AND_QUOTE(LLDB_VERSION_STRING);
54 g_version_str += "lldb version ";
55 g_version_str += CLANG_VERSION_STRING;
57 const char *lldb_repo = GetLLDBRepository();
58 const char *lldb_rev = GetLLDBRevision();
59 if (lldb_repo || lldb_rev) {
60 g_version_str += " (";
62 g_version_str += lldb_repo;
64 g_version_str += " revision ";
65 g_version_str += lldb_rev;
70 std::string clang_rev(clang::getClangRevision());
71 if (clang_rev.length() > 0) {
72 g_version_str += "\n clang revision ";
73 g_version_str += clang_rev;
75 std::string llvm_rev(clang::getLLVMRevision());
76 if (llvm_rev.length() > 0) {
77 g_version_str += "\n llvm revision ";
78 g_version_str += llvm_rev;
82 return g_version_str.c_str();