Skip to content

Commit 345cc47

Browse files
authored
[NFC] Add explicit #include llvm-config.h where its macros are used, lldb part. (#107603)
(this is lldb part) Without these explicit includes, removing other headers, who implicitly include llvm-config.h, may have non-trivial side effects. For example, `clangd` may report even `llvm-config.h` as "no used" in case it defines a macro, that is explicitly used with #ifdef. It is actually amplified with different build configs which use different set of macros.
1 parent dbd81ba commit 345cc47

File tree

7 files changed

+7
-0
lines changed

7 files changed

+7
-0
lines changed

lldb/source/API/SBDebugger.cpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,7 @@
5757

5858
#include "llvm/ADT/STLExtras.h"
5959
#include "llvm/ADT/StringRef.h"
60+
#include "llvm/Config/llvm-config.h" // for LLVM_ENABLE_CURL
6061
#include "llvm/Support/DynamicLibrary.h"
6162
#include "llvm/Support/ManagedStatic.h"
6263
#include "llvm/Support/PrettyStackTrace.h"

lldb/source/Host/common/Host.cpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -63,6 +63,7 @@
6363
#include "lldb/Utility/Status.h"
6464
#include "lldb/lldb-private-forward.h"
6565
#include "llvm/ADT/SmallString.h"
66+
#include "llvm/Config/llvm-config.h" // for LLVM_ON_UNIX
6667
#include "llvm/Support/Errno.h"
6768
#include "llvm/Support/FileSystem.h"
6869

lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunication.cpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,7 @@
3131
#include "lldb/Utility/RegularExpression.h"
3232
#include "lldb/Utility/StreamString.h"
3333
#include "llvm/ADT/SmallString.h"
34+
#include "llvm/Config/llvm-config.h" // for LLVM_ENABLE_ZLIB
3435
#include "llvm/Support/ScopedPrinter.h"
3536

3637
#include "ProcessGDBRemoteLog.h"

lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationClient.cpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,7 @@
3838

3939
#include "llvm/ADT/STLExtras.h"
4040
#include "llvm/ADT/StringSwitch.h"
41+
#include "llvm/Config/llvm-config.h" // for LLVM_ENABLE_ZLIB
4142
#include "llvm/Support/JSON.h"
4243

4344
#if defined(HAVE_LIBCOMPRESSION)

lldb/source/Plugins/SymbolFile/CTF/SymbolFileCTF.cpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@
2828
#include "lldb/Utility/StreamBuffer.h"
2929
#include "lldb/Utility/StreamString.h"
3030
#include "lldb/Utility/Timer.h"
31+
#include "llvm/Config/llvm-config.h" // for LLVM_ENABLE_ZLIB
3132
#include "llvm/Support/MemoryBuffer.h"
3233

3334
#include "Plugins/ExpressionParser/Clang/ClangASTMetadata.h"

lldb/source/Plugins/SymbolFile/PDB/SymbolFilePDB.cpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@
2828
#include "lldb/Utility/Log.h"
2929
#include "lldb/Utility/RegularExpression.h"
3030

31+
#include "llvm/Config/llvm-config.h" // for LLVM_ENABLE_DIA_SDK
3132
#include "llvm/DebugInfo/PDB/ConcreteSymbolEnumerator.h"
3233
#include "llvm/DebugInfo/PDB/GenericError.h"
3334
#include "llvm/DebugInfo/PDB/IPDBDataStream.h"

lldb/unittests/Host/MainLoopTest.cpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@
1212
#include "lldb/Host/FileSystem.h"
1313
#include "lldb/Host/PseudoTerminal.h"
1414
#include "lldb/Host/common/TCPSocket.h"
15+
#include "llvm/Config/llvm-config.h" // for LLVM_ON_UNIX
1516
#include "llvm/Testing/Support/Error.h"
1617
#include "gtest/gtest.h"
1718
#include <future>

0 commit comments

Comments
 (0)