diff options
author | Jonas Devlieghere <jonas@devlieghere.com> | 2019-12-10 08:54:30 -0800 |
---|---|---|
committer | Jonas Devlieghere <jonas@devlieghere.com> | 2019-12-10 11:16:52 -0800 |
commit | 59998b7b7f12c867062a4b61579511ad6c0ca144 (patch) | |
tree | 16c55c2623826dd24e5f18fbe2a4c1417c9efe2e | |
parent | e81268d03e73aef4f9c7bd8ece8ad02f5b017dcf (diff) | |
download | bcm5719-llvm-59998b7b7f12c867062a4b61579511ad6c0ca144.tar.gz bcm5719-llvm-59998b7b7f12c867062a4b61579511ad6c0ca144.zip |
[lldb/Host] Use Host/Config.h entries instead of a global define.
As suggested by Pavel in a code review:
> Can we replace this (and maybe python too, while at it) with a
> Host/Config.h entry? A global definition means that one has to
> recompile everything when these change in any way, whereas in
> practice only a handful of files need this..
Differential revision: https://reviews.llvm.org/D71280
22 files changed, 43 insertions, 30 deletions
diff --git a/lldb/cmake/modules/LLDBConfig.cmake b/lldb/cmake/modules/LLDBConfig.cmake index 54c6283d0f4..f1763f5b8bb 100644 --- a/lldb/cmake/modules/LLDBConfig.cmake +++ b/lldb/cmake/modules/LLDBConfig.cmake @@ -108,13 +108,8 @@ if ((NOT MSVC) OR MSVC12) 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 (NOT LLDB_DISABLE_PYTHON) 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 @@ if (LLDB_DISABLE_PYTHON) 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 index 5c1246751ab..b31f8d34146 100644 --- 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 index 662c07668d1..cd2cdf00af4 100644 --- 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 index e938727391e..d9dd7d423ae 100644 --- 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 index c3c92e68140..2a1d17a2413 100644 --- 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 index 0acc496ff87..ffb302d7f41 100644 --- 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 index 4eef4449165..d743900e67b 100644 --- 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 index 898468a977f..0ee526e6ade 100644 --- 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 index 7e75c008a91..265acb4ad8a 100644 --- 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 index a9114aa71b0..23c185ada1a 100644 --- 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 <curses.h> diff --git a/lldb/source/Core/ValueObject.cpp b/lldb/source/Core/ValueObject.cpp index 02453001a87..9eebea5de6a 100644 --- 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 index 5a4e466144a..ace7e4d64d6 100644 --- 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 @@ void CommandInterpreter::Initialize() { "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 <COUNT> <EXPRESSION> -- lldb will evaluate EXPRESSION " diff --git a/lldb/source/Interpreter/CommandObjectScript.cpp b/lldb/source/Interpreter/CommandObjectScript.cpp index edb1f67e7b3..d9ee30ca8ab 100644 --- 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.cpp b/lldb/source/Plugins/OperatingSystem/Python/OperatingSystemPython.cpp index 5761b39f111..3ed48e11d01 100644 --- 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/OperatingSystem/Python/OperatingSystemPython.h b/lldb/source/Plugins/OperatingSystem/Python/OperatingSystemPython.h index e76227ddb98..e38f0f8aedf 100644 --- 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/ScriptInterpreter/Python/PythonDataObjects.cpp b/lldb/source/Plugins/ScriptInterpreter/Python/PythonDataObjects.cpp index 9dee25c300a..7880c3a93df 100644 --- 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/PythonDataObjects.h b/lldb/source/Plugins/ScriptInterpreter/Python/PythonDataObjects.h index b6d63373b43..ea33d44c324 100644 --- 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/ScriptInterpreterPython.cpp b/lldb/source/Plugins/ScriptInterpreter/Python/ScriptInterpreterPython.cpp index f6b918399cd..5c668bf72f3 100644 --- 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/ScriptInterpreterPython.h b/lldb/source/Plugins/ScriptInterpreter/Python/ScriptInterpreterPython.h index 9ae4a036138..88f6975dd18 100644 --- 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/ScriptInterpreterPythonImpl.h b/lldb/source/Plugins/ScriptInterpreter/Python/ScriptInterpreterPythonImpl.h index 79830495568..281cfb174f9 100644 --- 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 index 884514da992..b2cd7a658f3 100644 --- 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 index 55845aef05c..5bbe7537416 100644 --- 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 |