[Lldb-commits] [lldb] 62456e5 - [lldb/CMake] Rename LLDB_DISABLE_LIBEDIT to LLDB_ENABLE_LIBEDIT
Jonas Devlieghere via lldb-commits
lldb-commits at lists.llvm.org
Thu Dec 12 09:23:22 PST 2019
Author: Jonas Devlieghere
Date: 2019-12-12T09:23:06-08:00
New Revision: 62456e579eebe012e5a6ebcf9960aef9d7babf87
URL: https://github.com/llvm/llvm-project/commit/62456e579eebe012e5a6ebcf9960aef9d7babf87
DIFF: https://github.com/llvm/llvm-project/commit/62456e579eebe012e5a6ebcf9960aef9d7babf87.diff
LOG: [lldb/CMake] Rename LLDB_DISABLE_LIBEDIT to LLDB_ENABLE_LIBEDIT
This matches the naming scheme used by LLVM.
Differential revision: https://reviews.llvm.org/D71380
Added:
Modified:
lldb/cmake/modules/LLDBConfig.cmake
lldb/docs/resources/build.rst
lldb/include/lldb/Core/IOHandler.h
lldb/include/lldb/Host/Config.h.cmake
lldb/source/Core/CMakeLists.txt
lldb/source/Core/IOHandler.cpp
lldb/source/Host/CMakeLists.txt
lldb/source/Interpreter/CMakeLists.txt
lldb/source/Interpreter/CommandInterpreter.cpp
lldb/source/Plugins/ScriptInterpreter/Python/CMakeLists.txt
lldb/source/Plugins/ScriptInterpreter/Python/PythonReadline.h
lldb/unittests/Editline/EditlineTest.cpp
Removed:
################################################################################
diff --git a/lldb/cmake/modules/LLDBConfig.cmake b/lldb/cmake/modules/LLDBConfig.cmake
index 4c0554e4cb6e..16d4d8c9c460 100644
--- a/lldb/cmake/modules/LLDBConfig.cmake
+++ b/lldb/cmake/modules/LLDBConfig.cmake
@@ -25,7 +25,7 @@ if (LLVM_COMPILER_IS_GCC_COMPATIBLE AND NOT "${CMAKE_SYSTEM_NAME}" MATCHES "Darw
endif()
set(default_disable_python OFF)
-set(default_disable_libedit OFF)
+set(default_enable_libedit ON)
set(default_enable_curses ON)
if(DEFINED LLVM_ENABLE_LIBEDIT AND NOT LLVM_ENABLE_LIBEDIT)
@@ -33,18 +33,18 @@ if(DEFINED LLVM_ENABLE_LIBEDIT AND NOT LLVM_ENABLE_LIBEDIT)
endif()
if(CMAKE_SYSTEM_NAME MATCHES "Windows")
- set(default_disable_libedit ON)
+ set(default_enable_libedit OFF)
set(default_enable_curses OFF)
elseif(CMAKE_SYSTEM_NAME MATCHES "Android")
set(default_disable_python ON)
- set(default_disable_libedit ON)
+ set(default_enable_libedit OFF)
set(default_enable_curses OFF)
elseif(IOS)
set(default_disable_python ON)
endif()
option(LLDB_DISABLE_PYTHON "Disable Python scripting integration." ${default_disable_python})
-option(LLDB_DISABLE_LIBEDIT "Disable the use of editline." ${default_disable_libedit})
+option(LLDB_ENABLE_LIBEDIT "Disable the use of editline." ${default_enable_libedit})
option(LLDB_ENABLE_CURSES "Disable Curses integration." ${default_enable_curses})
option(LLDB_RELOCATABLE_PYTHON "Use the PYTHONHOME environment variable to locate Python." OFF)
option(LLDB_USE_SYSTEM_SIX "Use six.py shipped with system and do not install a copy of it" OFF)
@@ -109,7 +109,7 @@ if ((NOT MSVC) OR MSVC12)
endif()
-if (NOT LLDB_DISABLE_LIBEDIT)
+if (LLDB_ENABLE_LIBEDIT)
find_package(LibEdit REQUIRED)
# Check if we libedit capable of handling wide characters (built with
diff --git a/lldb/docs/resources/build.rst b/lldb/docs/resources/build.rst
index 0297e65cc381..4d9850c485b3 100644
--- a/lldb/docs/resources/build.rst
+++ b/lldb/docs/resources/build.rst
@@ -401,8 +401,8 @@ further by passing the appropriate cmake options, such as:
::
- -DLLDB_DISABLE_LIBEDIT=1
-DLLDB_DISABLE_PYTHON=1
+ -DLLDB_ENABLE_LIBEDIT=0
-DLLDB_ENABLE_CURSES=0
-DLLVM_ENABLE_TERMINFO=0
@@ -454,7 +454,7 @@ to prepare the cmake build with the following parameters:
-DLLVM_TABLEGEN=<path-to-host>/bin/llvm-tblgen \
-DCLANG_TABLEGEN=<path-to-host>/bin/clang-tblgen \
-DLLDB_DISABLE_PYTHON=1 \
- -DLLDB_DISABLE_LIBEDIT=1 \
+ -DLLDB_ENABLE_LIBEDIT=0 \
-DLLDB_ENABLE_CURSES=0
An alternative (and recommended) way to compile LLDB is with clang.
diff --git a/lldb/include/lldb/Core/IOHandler.h b/lldb/include/lldb/Core/IOHandler.h
index b31f8d34146d..cf00329f7a0b 100644
--- a/lldb/include/lldb/Core/IOHandler.h
+++ b/lldb/include/lldb/Core/IOHandler.h
@@ -407,7 +407,7 @@ class IOHandlerEditline : public IOHandler {
void PrintAsync(Stream *stream, const char *s, size_t len) override;
private:
-#ifndef LLDB_DISABLE_LIBEDIT
+#if LLDB_ENABLE_LIBEDIT
static bool IsInputCompleteCallback(Editline *editline, StringList &lines,
void *baton);
@@ -418,7 +418,7 @@ class IOHandlerEditline : public IOHandler {
#endif
protected:
-#ifndef LLDB_DISABLE_LIBEDIT
+#if LLDB_ENABLE_LIBEDIT
std::unique_ptr<Editline> m_editline_up;
#endif
IOHandlerDelegate &m_delegate;
diff --git a/lldb/include/lldb/Host/Config.h.cmake b/lldb/include/lldb/Host/Config.h.cmake
index e16f36e06a70..eaa5404ce744 100644
--- a/lldb/include/lldb/Host/Config.h.cmake
+++ b/lldb/include/lldb/Host/Config.h.cmake
@@ -37,9 +37,9 @@
#cmakedefine01 LLDB_ENABLE_CURSES
-#cmakedefine LLDB_ENABLE_LIBXML2
+#cmakedefine01 LLDB_ENABLE_LIBEDIT
-#cmakedefine LLDB_DISABLE_LIBEDIT
+#cmakedefine LLDB_ENABLE_LIBXML2
#cmakedefine LLDB_DISABLE_PYTHON
diff --git a/lldb/source/Core/CMakeLists.txt b/lldb/source/Core/CMakeLists.txt
index 25ce51835715..ff2355a39275 100644
--- a/lldb/source/Core/CMakeLists.txt
+++ b/lldb/source/Core/CMakeLists.txt
@@ -98,7 +98,7 @@ add_dependencies(lldbCore
# TODO: Remove once we have better layering
set_target_properties(lldbCore PROPERTIES LINK_INTERFACE_MULTIPLICITY 4)
-if (NOT LLDB_DISABLE_LIBEDIT)
+if (LLDB_ENABLE_LIBEDIT)
target_include_directories(lldbCore PRIVATE ${libedit_INCLUDE_DIRS})
endif()
diff --git a/lldb/source/Core/IOHandler.cpp b/lldb/source/Core/IOHandler.cpp
index 38e65e63d587..b8134716f937 100644
--- a/lldb/source/Core/IOHandler.cpp
+++ b/lldb/source/Core/IOHandler.cpp
@@ -22,7 +22,7 @@
#include "lldb/Utility/StringList.h"
#include "lldb/lldb-forward.h"
-#ifndef LLDB_DISABLE_LIBEDIT
+#if LLDB_ENABLE_LIBEDIT
#include "lldb/Host/Editline.h"
#endif
#include "lldb/Interpreter/CommandCompletions.h"
@@ -234,7 +234,7 @@ IOHandlerEditline::IOHandlerEditline(
IOHandlerDelegate &delegate, repro::DataRecorder *data_recorder)
: IOHandler(debugger, type, input_sp, output_sp, error_sp, flags,
data_recorder),
-#ifndef LLDB_DISABLE_LIBEDIT
+#if LLDB_ENABLE_LIBEDIT
m_editline_up(),
#endif
m_delegate(delegate), m_prompt(), m_continuation_prompt(),
@@ -244,7 +244,7 @@ IOHandlerEditline::IOHandlerEditline(
m_editing(false) {
SetPrompt(prompt);
-#ifndef LLDB_DISABLE_LIBEDIT
+#if LLDB_ENABLE_LIBEDIT
bool use_editline = false;
use_editline = GetInputFILE() && GetOutputFILE() && GetErrorFILE() &&
@@ -272,7 +272,7 @@ IOHandlerEditline::IOHandlerEditline(
}
IOHandlerEditline::~IOHandlerEditline() {
-#ifndef LLDB_DISABLE_LIBEDIT
+#if LLDB_ENABLE_LIBEDIT
m_editline_up.reset();
#endif
}
@@ -308,7 +308,7 @@ static Optional<std::string> SplitLineEOF(std::string &line_buffer) {
}
bool IOHandlerEditline::GetLine(std::string &line, bool &interrupted) {
-#ifndef LLDB_DISABLE_LIBEDIT
+#if LLDB_ENABLE_LIBEDIT
if (m_editline_up) {
bool b = m_editline_up->GetLine(line, interrupted);
if (b && m_data_recorder)
@@ -402,7 +402,7 @@ bool IOHandlerEditline::GetLine(std::string &line, bool &interrupted) {
return (bool)got_line;
}
-#ifndef LLDB_DISABLE_LIBEDIT
+#if LLDB_ENABLE_LIBEDIT
bool IOHandlerEditline::IsInputCompleteCallback(Editline *editline,
StringList &lines,
void *baton) {
@@ -429,14 +429,14 @@ void IOHandlerEditline::AutoCompleteCallback(CompletionRequest &request,
#endif
const char *IOHandlerEditline::GetPrompt() {
-#ifndef LLDB_DISABLE_LIBEDIT
+#if LLDB_ENABLE_LIBEDIT
if (m_editline_up) {
return m_editline_up->GetPrompt();
} else {
#endif
if (m_prompt.empty())
return nullptr;
-#ifndef LLDB_DISABLE_LIBEDIT
+#if LLDB_ENABLE_LIBEDIT
}
#endif
return m_prompt.c_str();
@@ -445,7 +445,7 @@ const char *IOHandlerEditline::GetPrompt() {
bool IOHandlerEditline::SetPrompt(llvm::StringRef prompt) {
m_prompt = prompt;
-#ifndef LLDB_DISABLE_LIBEDIT
+#if LLDB_ENABLE_LIBEDIT
if (m_editline_up)
m_editline_up->SetPrompt(m_prompt.empty() ? nullptr : m_prompt.c_str());
#endif
@@ -460,7 +460,7 @@ const char *IOHandlerEditline::GetContinuationPrompt() {
void IOHandlerEditline::SetContinuationPrompt(llvm::StringRef prompt) {
m_continuation_prompt = prompt;
-#ifndef LLDB_DISABLE_LIBEDIT
+#if LLDB_ENABLE_LIBEDIT
if (m_editline_up)
m_editline_up->SetContinuationPrompt(m_continuation_prompt.empty()
? nullptr
@@ -473,7 +473,7 @@ void IOHandlerEditline::SetBaseLineNumber(uint32_t line) {
}
uint32_t IOHandlerEditline::GetCurrentLineIndex() const {
-#ifndef LLDB_DISABLE_LIBEDIT
+#if LLDB_ENABLE_LIBEDIT
if (m_editline_up)
return m_editline_up->GetCurrentLine();
#endif
@@ -484,7 +484,7 @@ bool IOHandlerEditline::GetLines(StringList &lines, bool &interrupted) {
m_current_lines_ptr = &lines;
bool success = false;
-#ifndef LLDB_DISABLE_LIBEDIT
+#if LLDB_ENABLE_LIBEDIT
if (m_editline_up) {
return m_editline_up->GetLines(m_base_line_number, lines, interrupted);
} else {
@@ -514,7 +514,7 @@ bool IOHandlerEditline::GetLines(StringList &lines, bool &interrupted) {
}
}
success = lines.GetSize() > 0;
-#ifndef LLDB_DISABLE_LIBEDIT
+#if LLDB_ENABLE_LIBEDIT
}
#endif
return success;
@@ -554,7 +554,7 @@ void IOHandlerEditline::Run() {
}
void IOHandlerEditline::Cancel() {
-#ifndef LLDB_DISABLE_LIBEDIT
+#if LLDB_ENABLE_LIBEDIT
if (m_editline_up)
m_editline_up->Cancel();
#endif
@@ -565,7 +565,7 @@ bool IOHandlerEditline::Interrupt() {
if (m_delegate.IOHandlerInterrupt(*this))
return true;
-#ifndef LLDB_DISABLE_LIBEDIT
+#if LLDB_ENABLE_LIBEDIT
if (m_editline_up)
return m_editline_up->Interrupt();
#endif
@@ -573,14 +573,14 @@ bool IOHandlerEditline::Interrupt() {
}
void IOHandlerEditline::GotEOF() {
-#ifndef LLDB_DISABLE_LIBEDIT
+#if LLDB_ENABLE_LIBEDIT
if (m_editline_up)
m_editline_up->Interrupt();
#endif
}
void IOHandlerEditline::PrintAsync(Stream *stream, const char *s, size_t len) {
-#ifndef LLDB_DISABLE_LIBEDIT
+#if LLDB_ENABLE_LIBEDIT
if (m_editline_up)
m_editline_up->PrintAsync(stream, s, len);
else
diff --git a/lldb/source/Host/CMakeLists.txt b/lldb/source/Host/CMakeLists.txt
index ff849e2743dd..2da0b939bd45 100644
--- a/lldb/source/Host/CMakeLists.txt
+++ b/lldb/source/Host/CMakeLists.txt
@@ -52,7 +52,7 @@ add_host_subdirectory(common
common/XML.cpp
)
-if (NOT LLDB_DISABLE_LIBEDIT)
+if (LLDB_ENABLE_LIBEDIT)
add_host_subdirectory(common
common/Editline.cpp
)
@@ -155,14 +155,14 @@ endif ()
if (HAVE_LIBDL)
list(APPEND EXTRA_LIBS ${CMAKE_DL_LIBS})
endif()
-if (NOT LLDB_DISABLE_LIBEDIT)
+if (LLDB_ENABLE_LIBEDIT)
list(APPEND EXTRA_LIBS ${libedit_LIBRARIES})
endif()
if (LLDB_ENABLE_LZMA)
list(APPEND EXTRA_LIBS ${LIBLZMA_LIBRARIES})
endif()
-if (NOT LLDB_DISABLE_LIBEDIT)
+if (LLDB_ENABLE_LIBEDIT)
list(APPEND LLDB_LIBEDIT_LIBS ${libedit_LIBRARIES})
if (LLVM_BUILD_STATIC)
list(APPEND LLDB_SYSTEM_LIBS gpm)
@@ -183,6 +183,6 @@ add_lldb_library(lldbHost
Support
)
-if (NOT LLDB_DISABLE_LIBEDIT)
+if (LLDB_ENABLE_LIBEDIT)
target_include_directories(lldbHost PUBLIC ${libedit_INCLUDE_DIRS})
endif()
diff --git a/lldb/source/Interpreter/CMakeLists.txt b/lldb/source/Interpreter/CMakeLists.txt
index 3900799b056d..be9843e1101b 100644
--- a/lldb/source/Interpreter/CMakeLists.txt
+++ b/lldb/source/Interpreter/CMakeLists.txt
@@ -69,6 +69,6 @@ add_dependencies(lldbInterpreter
LLDBInterpreterPropertiesGen
LLDBInterpreterPropertiesEnumGen)
-if (NOT LLDB_DISABLE_LIBEDIT)
+if (LLDB_ENABLE_LIBEDIT)
target_include_directories(lldbInterpreter PRIVATE ${libedit_INCLUDE_DIRS})
endif()
diff --git a/lldb/source/Interpreter/CommandInterpreter.cpp b/lldb/source/Interpreter/CommandInterpreter.cpp
index ace7e4d64d6d..7c2739f9dd40 100644
--- a/lldb/source/Interpreter/CommandInterpreter.cpp
+++ b/lldb/source/Interpreter/CommandInterpreter.cpp
@@ -49,7 +49,7 @@
#include "lldb/Utility/Timer.h"
#include "lldb/Host/Config.h"
-#ifndef LLDB_DISABLE_LIBEDIT
+#if LLDB_ENABLE_LIBEDIT
#include "lldb/Host/Editline.h"
#endif
#include "lldb/Host/Host.h"
diff --git a/lldb/source/Plugins/ScriptInterpreter/Python/CMakeLists.txt b/lldb/source/Plugins/ScriptInterpreter/Python/CMakeLists.txt
index 5be6934c1915..e8d1e762effa 100644
--- a/lldb/source/Plugins/ScriptInterpreter/Python/CMakeLists.txt
+++ b/lldb/source/Plugins/ScriptInterpreter/Python/CMakeLists.txt
@@ -3,7 +3,7 @@ if(NOT LLDB_PYTHON_RELATIVE_PATH)
endif()
add_definitions(-DLLDB_PYTHON_RELATIVE_LIBDIR="${LLDB_PYTHON_RELATIVE_PATH}")
-if (NOT LLDB_DISABLE_LIBEDIT)
+if (LLDB_ENABLE_LIBEDIT)
list(APPEND LLDB_LIBEDIT_LIBS ${libedit_LIBRARIES})
endif()
@@ -26,7 +26,7 @@ add_lldb_library(lldbPluginScriptInterpreterPython PLUGIN
Support
)
-if (NOT LLDB_DISABLE_LIBEDIT)
+if (LLDB_ENABLE_LIBEDIT)
target_include_directories(lldbPluginScriptInterpreterPython PUBLIC
${libedit_INCLUDE_DIRS}
)
diff --git a/lldb/source/Plugins/ScriptInterpreter/Python/PythonReadline.h b/lldb/source/Plugins/ScriptInterpreter/Python/PythonReadline.h
index 4f25c46eefa8..c0d39324e034 100644
--- a/lldb/source/Plugins/ScriptInterpreter/Python/PythonReadline.h
+++ b/lldb/source/Plugins/ScriptInterpreter/Python/PythonReadline.h
@@ -9,7 +9,7 @@
#ifndef LLDB_PLUGINS_SCRIPTINTERPRETER_PYTHON_PYTHONREADLINE_H
#define LLDB_PLUGINS_SCRIPTINTERPRETER_PYTHON_PYTHONREADLINE_H
-#if !defined(LLDB_DISABLE_LIBEDIT) && defined(__linux__)
+#if LLDB_ENABLE_LIBEDIT && defined(__linux__)
// NOTE: Since Python may define some pre-processor definitions which affect the
// standard headers on some systems, you must include Python.h before any
// standard headers are included.
diff --git a/lldb/unittests/Editline/EditlineTest.cpp b/lldb/unittests/Editline/EditlineTest.cpp
index 5bbe75374169..7fdd96657d86 100644
--- a/lldb/unittests/Editline/EditlineTest.cpp
+++ b/lldb/unittests/Editline/EditlineTest.cpp
@@ -8,7 +8,7 @@
#include "lldb/Host/Config.h"
-#ifndef LLDB_DISABLE_LIBEDIT
+#if LLDB_ENABLE_LIBEDIT
#define EDITLINE_TEST_DUMP_OUTPUT 0
More information about the lldb-commits
mailing list