diff --git a/lldb/cmake/modules/LLDBConfig.cmake b/lldb/cmake/modules/LLDBConfig.cmake --- a/lldb/cmake/modules/LLDBConfig.cmake +++ b/lldb/cmake/modules/LLDBConfig.cmake @@ -108,13 +108,8 @@ add_definitions( -DHAVE_ROUND ) endif() -if (LLDB_DISABLE_CURSES) - add_definitions( -DLLDB_DISABLE_CURSES ) -endif() -if (LLDB_DISABLE_LIBEDIT) - add_definitions( -DLLDB_DISABLE_LIBEDIT ) -else() +if (NOT LLDB_DISABLE_LIBEDIT) find_package(LibEdit REQUIRED) # Check if we libedit capable of handling wide characters (built with @@ -291,7 +286,6 @@ if ("${CMAKE_SYSTEM_NAME}" STREQUAL "Windows") if (NOT LLDB_RELOCATABLE_PYTHON) file(TO_CMAKE_PATH "${PYTHON_HOME}" LLDB_PYTHON_HOME) - add_definitions( -DLLDB_PYTHON_HOME="${LLDB_PYTHON_HOME}" ) endif() else() find_package(PythonInterp REQUIRED) @@ -321,7 +315,6 @@ unset(PYTHON_INCLUDE_DIR) unset(PYTHON_LIBRARY) unset(PYTHON_EXECUTABLE) - add_definitions( -DLLDB_DISABLE_PYTHON ) endif() if (LLVM_EXTERNAL_CLANG_SOURCE_DIR) diff --git a/lldb/include/lldb/Core/IOHandler.h b/lldb/include/lldb/Core/IOHandler.h --- a/lldb/include/lldb/Core/IOHandler.h +++ b/lldb/include/lldb/Core/IOHandler.h @@ -10,6 +10,7 @@ #define liblldb_IOHandler_h_ #include "lldb/Core/ValueObjectList.h" +#include "lldb/Host/Config.h" #include "lldb/Utility/CompletionRequest.h" #include "lldb/Utility/ConstString.h" #include "lldb/Utility/Flags.h" diff --git a/lldb/include/lldb/Host/Config.h.cmake b/lldb/include/lldb/Host/Config.h.cmake --- a/lldb/include/lldb/Host/Config.h.cmake +++ b/lldb/include/lldb/Host/Config.h.cmake @@ -17,8 +17,6 @@ #cmakedefine LLDB_DISABLE_POSIX -#define LLDB_LIBDIR_SUFFIX "${LLVM_LIBDIR_SUFFIX}" - #cmakedefine01 HAVE_SYS_TYPES_H #cmakedefine01 HAVE_SYS_EVENT_H @@ -37,4 +35,14 @@ #cmakedefine01 LLDB_ENABLE_LZMA +#cmakedefine LLDB_DISABLE_CURSES + +#cmakedefine LLDB_DISABLE_LIBEDIT + +#cmakedefine LLDB_DISABLE_PYTHON + +#cmakedefine LLDB_PYTHON_HOME "${LLDB_PYTHON_HOME}" + +#define LLDB_LIBDIR_SUFFIX "${LLVM_LIBDIR_SUFFIX}" + #endif // #ifndef LLDB_HOST_CONFIG_H diff --git a/lldb/source/API/SBDebugger.cpp b/lldb/source/API/SBDebugger.cpp --- a/lldb/source/API/SBDebugger.cpp +++ b/lldb/source/API/SBDebugger.cpp @@ -40,6 +40,7 @@ #include "lldb/Core/StreamFile.h" #include "lldb/Core/StructuredDataImpl.h" #include "lldb/DataFormatters/DataVisualization.h" +#include "lldb/Host/Config.h" #include "lldb/Host/XML.h" #include "lldb/Initialization/SystemLifetimeManager.h" #include "lldb/Interpreter/CommandInterpreter.h" diff --git a/lldb/source/API/SBHostOS.cpp b/lldb/source/API/SBHostOS.cpp --- a/lldb/source/API/SBHostOS.cpp +++ b/lldb/source/API/SBHostOS.cpp @@ -6,9 +6,10 @@ // //===----------------------------------------------------------------------===// +#include "lldb/API/SBHostOS.h" #include "SBReproducerPrivate.h" #include "lldb/API/SBError.h" -#include "lldb/API/SBHostOS.h" +#include "lldb/Host/Config.h" #include "lldb/Host/FileSystem.h" #include "lldb/Host/Host.h" #include "lldb/Host/HostInfo.h" diff --git a/lldb/source/API/SystemInitializerFull.cpp b/lldb/source/API/SystemInitializerFull.cpp --- a/lldb/source/API/SystemInitializerFull.cpp +++ b/lldb/source/API/SystemInitializerFull.cpp @@ -7,8 +7,8 @@ //===----------------------------------------------------------------------===// #include "SystemInitializerFull.h" - #include "lldb/API/SBCommandInterpreter.h" +#include "lldb/Host/Config.h" #if !defined(LLDB_DISABLE_PYTHON) #include "Plugins/ScriptInterpreter/Python/ScriptInterpreterPython.h" diff --git a/lldb/source/Commands/CommandObjectFrame.cpp b/lldb/source/Commands/CommandObjectFrame.cpp --- a/lldb/source/Commands/CommandObjectFrame.cpp +++ b/lldb/source/Commands/CommandObjectFrame.cpp @@ -14,6 +14,7 @@ #include "lldb/Core/ValueObjectVariable.h" #include "lldb/DataFormatters/DataVisualization.h" #include "lldb/DataFormatters/ValueObjectPrinter.h" +#include "lldb/Host/Config.h" #include "lldb/Host/Host.h" #include "lldb/Host/OptionParser.h" #include "lldb/Host/StringConvert.h" diff --git a/lldb/source/Commands/CommandObjectGUI.cpp b/lldb/source/Commands/CommandObjectGUI.cpp --- a/lldb/source/Commands/CommandObjectGUI.cpp +++ b/lldb/source/Commands/CommandObjectGUI.cpp @@ -9,6 +9,7 @@ #include "CommandObjectGUI.h" #include "lldb/Core/IOHandlerCursesGUI.h" +#include "lldb/Host/Config.h" #include "lldb/Interpreter/CommandInterpreter.h" #include "lldb/Interpreter/CommandReturnObject.h" #include "lldb/lldb-private.h" diff --git a/lldb/source/Commands/CommandObjectType.cpp b/lldb/source/Commands/CommandObjectType.cpp --- a/lldb/source/Commands/CommandObjectType.cpp +++ b/lldb/source/Commands/CommandObjectType.cpp @@ -11,6 +11,7 @@ #include "lldb/Core/Debugger.h" #include "lldb/Core/IOHandler.h" #include "lldb/DataFormatters/DataVisualization.h" +#include "lldb/Host/Config.h" #include "lldb/Host/OptionParser.h" #include "lldb/Interpreter/CommandInterpreter.h" #include "lldb/Interpreter/CommandObject.h" diff --git a/lldb/source/Core/IOHandlerCursesGUI.cpp b/lldb/source/Core/IOHandlerCursesGUI.cpp --- a/lldb/source/Core/IOHandlerCursesGUI.cpp +++ b/lldb/source/Core/IOHandlerCursesGUI.cpp @@ -7,6 +7,7 @@ //===----------------------------------------------------------------------===// #include "lldb/Core/IOHandlerCursesGUI.h" +#include "lldb/Host/Config.h" #ifndef LLDB_DISABLE_CURSES #include diff --git a/lldb/source/Core/ValueObject.cpp b/lldb/source/Core/ValueObject.cpp --- a/lldb/source/Core/ValueObject.cpp +++ b/lldb/source/Core/ValueObject.cpp @@ -25,6 +25,7 @@ #include "lldb/DataFormatters/TypeValidator.h" #include "lldb/DataFormatters/ValueObjectPrinter.h" #include "lldb/Expression/ExpressionVariable.h" +#include "lldb/Host/Config.h" #include "lldb/Symbol/ClangASTContext.h" #include "lldb/Symbol/CompileUnit.h" #include "lldb/Symbol/CompilerType.h" diff --git a/lldb/source/Interpreter/CommandInterpreter.cpp b/lldb/source/Interpreter/CommandInterpreter.cpp --- a/lldb/source/Interpreter/CommandInterpreter.cpp +++ b/lldb/source/Interpreter/CommandInterpreter.cpp @@ -48,6 +48,7 @@ #include "lldb/Utility/Stream.h" #include "lldb/Utility/Timer.h" +#include "lldb/Host/Config.h" #ifndef LLDB_DISABLE_LIBEDIT #include "lldb/Host/Editline.h" #endif @@ -362,8 +363,8 @@ "controlled by the type's author."); po->SetHelpLong(""); } - CommandAlias *parray_alias = AddAlias("parray", cmd_obj_sp, - "--element-count %1 --"); + CommandAlias *parray_alias = + AddAlias("parray", cmd_obj_sp, "--element-count %1 --"); if (parray_alias) { parray_alias->SetHelp ("parray -- lldb will evaluate EXPRESSION " diff --git a/lldb/source/Interpreter/CommandObjectScript.cpp b/lldb/source/Interpreter/CommandObjectScript.cpp --- a/lldb/source/Interpreter/CommandObjectScript.cpp +++ b/lldb/source/Interpreter/CommandObjectScript.cpp @@ -7,12 +7,9 @@ //===----------------------------------------------------------------------===// #include "CommandObjectScript.h" - - #include "lldb/Core/Debugger.h" - #include "lldb/DataFormatters/DataVisualization.h" - +#include "lldb/Host/Config.h" #include "lldb/Interpreter/CommandInterpreter.h" #include "lldb/Interpreter/CommandReturnObject.h" #include "lldb/Interpreter/ScriptInterpreter.h" diff --git a/lldb/source/Plugins/OperatingSystem/Python/OperatingSystemPython.h b/lldb/source/Plugins/OperatingSystem/Python/OperatingSystemPython.h --- a/lldb/source/Plugins/OperatingSystem/Python/OperatingSystemPython.h +++ b/lldb/source/Plugins/OperatingSystem/Python/OperatingSystemPython.h @@ -9,6 +9,8 @@ #ifndef liblldb_OperatingSystemPython_h_ #define liblldb_OperatingSystemPython_h_ +#include "lldb/Host/Config.h" + #ifndef LLDB_DISABLE_PYTHON #include "lldb/Target/OperatingSystem.h" diff --git a/lldb/source/Plugins/OperatingSystem/Python/OperatingSystemPython.cpp b/lldb/source/Plugins/OperatingSystem/Python/OperatingSystemPython.cpp --- a/lldb/source/Plugins/OperatingSystem/Python/OperatingSystemPython.cpp +++ b/lldb/source/Plugins/OperatingSystem/Python/OperatingSystemPython.cpp @@ -6,6 +6,8 @@ // //===----------------------------------------------------------------------===// +#include "lldb/Host/Config.h" + #ifndef LLDB_DISABLE_PYTHON #include "OperatingSystemPython.h" diff --git a/lldb/source/Plugins/ScriptInterpreter/Python/PythonDataObjects.h b/lldb/source/Plugins/ScriptInterpreter/Python/PythonDataObjects.h --- a/lldb/source/Plugins/ScriptInterpreter/Python/PythonDataObjects.h +++ b/lldb/source/Plugins/ScriptInterpreter/Python/PythonDataObjects.h @@ -48,6 +48,8 @@ #ifndef LLDB_PLUGINS_SCRIPTINTERPRETER_PYTHON_PYTHONDATAOBJECTS_H #define LLDB_PLUGINS_SCRIPTINTERPRETER_PYTHON_PYTHONDATAOBJECTS_H +#include "lldb/Host/Config.h" + #ifndef LLDB_DISABLE_PYTHON // LLDB Python header must be included first diff --git a/lldb/source/Plugins/ScriptInterpreter/Python/PythonDataObjects.cpp b/lldb/source/Plugins/ScriptInterpreter/Python/PythonDataObjects.cpp --- a/lldb/source/Plugins/ScriptInterpreter/Python/PythonDataObjects.cpp +++ b/lldb/source/Plugins/ScriptInterpreter/Python/PythonDataObjects.cpp @@ -6,11 +6,9 @@ // //===----------------------------------------------------------------------===// -#ifdef LLDB_DISABLE_PYTHON +#include "lldb/Host/Config.h" -// Python is disabled in this build - -#else +#ifndef LLDB_DISABLE_PYTHON #include "PythonDataObjects.h" #include "ScriptInterpreterPython.h" diff --git a/lldb/source/Plugins/ScriptInterpreter/Python/ScriptInterpreterPython.h b/lldb/source/Plugins/ScriptInterpreter/Python/ScriptInterpreterPython.h --- a/lldb/source/Plugins/ScriptInterpreter/Python/ScriptInterpreterPython.h +++ b/lldb/source/Plugins/ScriptInterpreter/Python/ScriptInterpreterPython.h @@ -9,6 +9,8 @@ #ifndef LLDB_PLUGINS_SCRIPTINTERPRETER_PYTHON_SCRIPTINTERPRETERPYTHON_H #define LLDB_PLUGINS_SCRIPTINTERPRETER_PYTHON_SCRIPTINTERPRETERPYTHON_H +#include "lldb/Host/Config.h" + #ifdef LLDB_DISABLE_PYTHON // Python is disabled in this build diff --git a/lldb/source/Plugins/ScriptInterpreter/Python/ScriptInterpreterPython.cpp b/lldb/source/Plugins/ScriptInterpreter/Python/ScriptInterpreterPython.cpp --- a/lldb/source/Plugins/ScriptInterpreter/Python/ScriptInterpreterPython.cpp +++ b/lldb/source/Plugins/ScriptInterpreter/Python/ScriptInterpreterPython.cpp @@ -6,11 +6,9 @@ // //===----------------------------------------------------------------------===// -#ifdef LLDB_DISABLE_PYTHON +#include "lldb/Host/Config.h" -// Python is disabled in this build - -#else +#ifndef LLDB_DISABLE_PYTHON // LLDB Python header must be included first #include "lldb-python.h" diff --git a/lldb/source/Plugins/ScriptInterpreter/Python/ScriptInterpreterPythonImpl.h b/lldb/source/Plugins/ScriptInterpreter/Python/ScriptInterpreterPythonImpl.h --- a/lldb/source/Plugins/ScriptInterpreter/Python/ScriptInterpreterPythonImpl.h +++ b/lldb/source/Plugins/ScriptInterpreter/Python/ScriptInterpreterPythonImpl.h @@ -6,11 +6,9 @@ // //===----------------------------------------------------------------------===// -#ifdef LLDB_DISABLE_PYTHON +#include "lldb/Host/Config.h" -// Python is disabled in this build - -#else +#ifndef LLDB_DISABLE_PYTHON #include "lldb-python.h" diff --git a/lldb/source/Plugins/ScriptInterpreter/Python/lldb-python.h b/lldb/source/Plugins/ScriptInterpreter/Python/lldb-python.h --- a/lldb/source/Plugins/ScriptInterpreter/Python/lldb-python.h +++ b/lldb/source/Plugins/ScriptInterpreter/Python/lldb-python.h @@ -9,6 +9,8 @@ #ifndef LLDB_PLUGINS_SCRIPTINTERPRETER_PYTHON_LLDB_PYTHON_H #define LLDB_PLUGINS_SCRIPTINTERPRETER_PYTHON_LLDB_PYTHON_H +#include "lldb/Host/Config.h" + // Python.h needs to be included before any system headers in order to avoid // redefinition of macros diff --git a/lldb/unittests/Editline/EditlineTest.cpp b/lldb/unittests/Editline/EditlineTest.cpp --- a/lldb/unittests/Editline/EditlineTest.cpp +++ b/lldb/unittests/Editline/EditlineTest.cpp @@ -6,6 +6,8 @@ // //===----------------------------------------------------------------------===// +#include "lldb/Host/Config.h" + #ifndef LLDB_DISABLE_LIBEDIT #define EDITLINE_TEST_DUMP_OUTPUT 0