Skip to content

Revert "[lldb] Make lldbVersion a full fledged library " #3690

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
23 changes: 0 additions & 23 deletions lldb/include/lldb/Version/Version.h

This file was deleted.

6 changes: 0 additions & 6 deletions lldb/include/lldb/Version/Version.inc.in

This file was deleted.

6 changes: 6 additions & 0 deletions lldb/include/lldb/lldb-private.h
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,12 @@
#include "lldb/lldb-private-types.h"
#include "lldb/lldb-public.h"

namespace lldb_private {

const char *GetVersion();

} // namespace lldb_private

#endif // defined(__cplusplus)

#endif // LLDB_LLDB_PRIVATE_H
2 changes: 1 addition & 1 deletion lldb/source/API/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -104,6 +104,7 @@ add_lldb_library(liblldb SHARED ${option_framework}
${lldb_lua_wrapper}

LINK_LIBS
lldbBase
lldbBreakpoint
lldbCore
lldbDataFormatters
Expand All @@ -114,7 +115,6 @@ add_lldb_library(liblldb SHARED ${option_framework}
lldbSymbol
lldbTarget
lldbUtility
lldbVersion
${LLDB_ALL_PLUGINS}
## BEGIN SWIFT
${SWIFT_ALL_LIBS}
Expand Down
3 changes: 2 additions & 1 deletion lldb/source/API/SBDebugger.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,8 @@

#include "lldb/API/SBDebugger.h"

#include "lldb/lldb-private.h"

#include "lldb/API/SBBroadcaster.h"
#include "lldb/API/SBCommandInterpreter.h"
#include "lldb/API/SBCommandInterpreterRunOptions.h"
Expand Down Expand Up @@ -50,7 +52,6 @@
#include "lldb/Target/TargetList.h"
#include "lldb/Utility/Args.h"
#include "lldb/Utility/State.h"
#include "lldb/Version/Version.h"

#include "llvm/ADT/STLExtras.h"
#include "llvm/ADT/StringRef.h"
Expand Down
2 changes: 1 addition & 1 deletion lldb/source/API/SBReproducer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
#include "lldb/API/SBHostOS.h"
#include "lldb/API/SBReproducer.h"
#include "lldb/Host/FileSystem.h"
#include "lldb/Version/Version.h"
#include "lldb/lldb-private.h"

using namespace lldb;
using namespace lldb_private;
Expand Down
41 changes: 38 additions & 3 deletions lldb/source/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,5 +1,41 @@
include_directories(${CMAKE_CURRENT_SOURCE_DIR})
include_directories(${CMAKE_CURRENT_BINARY_DIR})
include_directories(.)

set(lldbBase_SOURCES
lldb.cpp
)


find_first_existing_vc_file("${LLDB_SOURCE_DIR}" lldb_vc)

set(version_inc "${CMAKE_CURRENT_BINARY_DIR}/VCSVersion.inc")
set(generate_vcs_version_script "${LLVM_CMAKE_PATH}/GenerateVersionFromVCS.cmake")

if(lldb_vc AND LLVM_APPEND_VC_REV)
set(lldb_source_dir ${LLDB_SOURCE_DIR})
endif()

add_custom_command(OUTPUT "${version_inc}"
DEPENDS "${lldb_vc}" "${generate_vcs_version_script}"
COMMAND ${CMAKE_COMMAND} "-DNAMES=LLDB"
"-DLLDB_SOURCE_DIR=${lldb_source_dir}"
"-DHEADER_FILE=${version_inc}"
-P "${generate_vcs_version_script}")

# Mark the generated header as being generated.
set_source_files_properties("${version_inc}"
PROPERTIES GENERATED TRUE
HEADER_FILE_ONLY TRUE)

list(APPEND lldbBase_SOURCES ${version_inc})

if(LLDB_VERSION_STRING)
set_property(SOURCE lldb.cpp APPEND PROPERTY
COMPILE_DEFINITIONS "LLDB_VERSION_STRING=${LLDB_VERSION_STRING}")
endif()

add_lldb_library(lldbBase
${lldbBase_SOURCES}
)

add_subdirectory(Breakpoint)
add_subdirectory(Commands)
Expand All @@ -13,7 +49,6 @@ add_subdirectory(Plugins)
add_subdirectory(Symbol)
add_subdirectory(Target)
add_subdirectory(Utility)
add_subdirectory(Version)

# Build API last. Since liblldb needs to link against every other target, it needs
# those targets to have already been created.
Expand Down
2 changes: 1 addition & 1 deletion lldb/source/Commands/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@ add_lldb_library(lldbCommands
CommandOptionsProcessLaunch.cpp

LINK_LIBS
lldbBase
lldbBreakpoint
lldbCore
lldbDataFormatters
Expand All @@ -51,7 +52,6 @@ add_lldb_library(lldbCommands
lldbSymbol
lldbTarget
lldbUtility
lldbVersion

LINK_COMPONENTS
Support
Expand Down
2 changes: 1 addition & 1 deletion lldb/source/Commands/CommandObjectVersion.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
#include "CommandObjectVersion.h"

#include "lldb/Interpreter/CommandReturnObject.h"
#include "lldb/Version/Version.h"
#include "lldb/lldb-private.h"

using namespace lldb;
using namespace lldb_private;
Expand Down
2 changes: 1 addition & 1 deletion lldb/source/Initialization/SystemInitializerCommon.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
#include "lldb/Utility/Log.h"
#include "lldb/Utility/ReproducerProvider.h"
#include "lldb/Utility/Timer.h"
#include "lldb/Version/Version.h"
#include "lldb/lldb-private.h"

#if defined(__linux__) || defined(__FreeBSD__) || defined(__NetBSD__)
#include "Plugins/Process/POSIX/ProcessPOSIXLog.h"
Expand Down
42 changes: 0 additions & 42 deletions lldb/source/Version/CMakeLists.txt

This file was deleted.

26 changes: 15 additions & 11 deletions lldb/source/Version/Version.cpp → lldb/source/lldb.cpp
Original file line number Diff line number Diff line change
@@ -1,23 +1,30 @@
//===-- Version.cpp -------------------------------------------------------===//
//===-- lldb.cpp ----------------------------------------------------------===//
//
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
// See https://llvm.org/LICENSE.txt for license information.
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
//
//===----------------------------------------------------------------------===//

#include "lldb/Version/Version.h"
#include "VCSVersion.inc"
#include "lldb/Version/Version.inc"
#include "lldb/lldb-private.h"
#include "clang/Basic/Version.h"

#ifdef LLDB_ENABLE_SWIFT
#include "swift/Basic/Version.h"
#endif // LLDB_ENABLE_SWIFT

using namespace lldb;
using namespace lldb_private;

// LLDB_VERSION_STRING is set through a define so unlike the other defines
// expanded with CMake, it lacks the double quotes.
#define QUOTE(str) #str
#define EXPAND_AND_QUOTE(str) QUOTE(str)

static const char *GetLLDBVersion() {
#ifdef LLDB_FULL_VERSION_STRING
return LLDB_FULL_VERSION_STRING;
#ifdef LLDB_VERSION_STRING
return EXPAND_AND_QUOTE(LLDB_VERSION_STRING);
#else
return "lldb version " CLANG_VERSION_STRING;
#endif
Expand All @@ -27,21 +34,20 @@ static const char *GetLLDBRevision() {
#ifdef LLDB_REVISION
return LLDB_REVISION;
#else
return nullptr;
return NULL;
#endif
}

static const char *GetLLDBRepository() {
#ifdef LLDB_REPOSITORY
return LLDB_REPOSITORY;
#else
return nullptr;
return NULL;
#endif
}

const char *lldb_private::GetVersion() {
static std::string g_version_str;

if (g_version_str.empty()) {
const char *lldb_version = GetLLDBVersion();
const char *lldb_repo = GetLLDBRepository();
Expand Down Expand Up @@ -72,14 +78,12 @@ const char *lldb_private::GetVersion() {
g_version_str += "\n clang revision ";
g_version_str += clang_rev;
}

std::string llvm_rev(clang::getLLVMRevision());
if (llvm_rev.length() > 0) {
g_version_str += "\n llvm revision ";
g_version_str += llvm_rev;
}
#endif
#endif // LLDB_ENABLE_SWIFT
}

return g_version_str.c_str();
}
2 changes: 1 addition & 1 deletion lldb/tools/lldb-server/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -46,9 +46,9 @@ add_lldb_tool(lldb-server
SystemInitializerLLGS.cpp

LINK_LIBS
lldbBase
lldbHost
lldbInitialization
lldbVersion
${LLDB_PLUGINS}
lldbPluginInstructionARM
lldbPluginInstructionMIPS
Expand Down
2 changes: 1 addition & 1 deletion lldb/tools/lldb-server/lldb-server.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@

#include "SystemInitializerLLGS.h"
#include "lldb/Initialization/SystemLifetimeManager.h"
#include "lldb/Version/Version.h"
#include "lldb/lldb-private.h"

#include "llvm/ADT/STLExtras.h"
#include "llvm/ADT/StringRef.h"
Expand Down
2 changes: 1 addition & 1 deletion lldb/tools/lldb-test/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ add_lldb_tool(lldb-test
SystemInitializerTest.cpp

LINK_LIBS
lldbBase
lldbBreakpoint
lldbCore
lldbDataFormatters
Expand All @@ -16,7 +17,6 @@ add_lldb_tool(lldb-test
lldbSymbol
lldbTarget
lldbUtility
lldbVersion
${LLDB_ALL_PLUGINS}
${host_lib}

Expand Down