Skip to content

[NFC][lldb-dap] Clean-up includes #113839

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

Merged
merged 1 commit into from
Oct 28, 2024

Conversation

vogelsgesang
Copy link
Member

This commit cleans up the includes in the lldb-dap subfolder. The main motivation was that I got annoyed by clangd always complaining about unused includes while working on lldb-dap.

@llvmbot
Copy link
Member

llvmbot commented Oct 27, 2024

@llvm/pr-subscribers-lldb

Author: Adrian Vogelsgesang (vogelsgesang)

Changes

This commit cleans up the includes in the lldb-dap subfolder. The main motivation was that I got annoyed by clangd always complaining about unused includes while working on lldb-dap.


Full diff: https://github.com/llvm/llvm-project/pull/113839.diff

19 Files Affected:

  • (modified) lldb/tools/lldb-dap/Breakpoint.cpp (+1)
  • (modified) lldb/tools/lldb-dap/Breakpoint.h (+1)
  • (modified) lldb/tools/lldb-dap/BreakpointBase.cpp (+1-2)
  • (modified) lldb/tools/lldb-dap/BreakpointBase.h (-2)
  • (modified) lldb/tools/lldb-dap/DAP.cpp (+4-1)
  • (modified) lldb/tools/lldb-dap/DAP.h (-17)
  • (modified) lldb/tools/lldb-dap/FifoFiles.cpp (+1-5)
  • (modified) lldb/tools/lldb-dap/FifoFiles.h (+1-2)
  • (modified) lldb/tools/lldb-dap/FunctionBreakpoint.cpp (+1)
  • (modified) lldb/tools/lldb-dap/IOStream.cpp (-1)
  • (modified) lldb/tools/lldb-dap/InstructionBreakpoint.cpp (+1)
  • (modified) lldb/tools/lldb-dap/InstructionBreakpoint.h (-1)
  • (modified) lldb/tools/lldb-dap/JSONUtils.cpp (+1-5)
  • (modified) lldb/tools/lldb-dap/LLDBUtils.cpp (+2)
  • (modified) lldb/tools/lldb-dap/OutputRedirector.h (-2)
  • (modified) lldb/tools/lldb-dap/RunInTerminal.cpp (+1-4)
  • (modified) lldb/tools/lldb-dap/RunInTerminal.h (+3-1)
  • (modified) lldb/tools/lldb-dap/SourceBreakpoint.cpp (+1)
  • (modified) lldb/tools/lldb-dap/lldb-dap.cpp (+5-5)
diff --git a/lldb/tools/lldb-dap/Breakpoint.cpp b/lldb/tools/lldb-dap/Breakpoint.cpp
index 0c33d4b114d760..9ea7a42ca85a1e 100644
--- a/lldb/tools/lldb-dap/Breakpoint.cpp
+++ b/lldb/tools/lldb-dap/Breakpoint.cpp
@@ -9,6 +9,7 @@
 #include "Breakpoint.h"
 #include "DAP.h"
 #include "JSONUtils.h"
+#include "lldb/API/SBBreakpointLocation.h"
 #include "llvm/ADT/StringExtras.h"
 
 using namespace lldb_dap;
diff --git a/lldb/tools/lldb-dap/Breakpoint.h b/lldb/tools/lldb-dap/Breakpoint.h
index 47a9d9c59ae2b7..ee9d3736d6190f 100644
--- a/lldb/tools/lldb-dap/Breakpoint.h
+++ b/lldb/tools/lldb-dap/Breakpoint.h
@@ -10,6 +10,7 @@
 #define LLDB_TOOLS_LLDB_DAP_BREAKPOINT_H
 
 #include "BreakpointBase.h"
+#include "lldb/API/SBBreakpoint.h"
 
 namespace lldb_dap {
 
diff --git a/lldb/tools/lldb-dap/BreakpointBase.cpp b/lldb/tools/lldb-dap/BreakpointBase.cpp
index 519729f5519ffc..f3cb06a3562d48 100644
--- a/lldb/tools/lldb-dap/BreakpointBase.cpp
+++ b/lldb/tools/lldb-dap/BreakpointBase.cpp
@@ -7,8 +7,7 @@
 //===----------------------------------------------------------------------===//
 
 #include "BreakpointBase.h"
-#include "DAP.h"
-#include "llvm/ADT/StringExtras.h"
+#include "JSONUtils.h"
 
 using namespace lldb_dap;
 
diff --git a/lldb/tools/lldb-dap/BreakpointBase.h b/lldb/tools/lldb-dap/BreakpointBase.h
index 5a04bb201615fc..79301480e0e588 100644
--- a/lldb/tools/lldb-dap/BreakpointBase.h
+++ b/lldb/tools/lldb-dap/BreakpointBase.h
@@ -9,10 +9,8 @@
 #ifndef LLDB_TOOLS_LLDB_DAP_BREAKPOINTBASE_H
 #define LLDB_TOOLS_LLDB_DAP_BREAKPOINTBASE_H
 
-#include "lldb/API/SBBreakpoint.h"
 #include "llvm/Support/JSON.h"
 #include <string>
-#include <vector>
 
 namespace lldb_dap {
 
diff --git a/lldb/tools/lldb-dap/DAP.cpp b/lldb/tools/lldb-dap/DAP.cpp
index 68559e382006db..283392270ba26c 100644
--- a/lldb/tools/lldb-dap/DAP.cpp
+++ b/lldb/tools/lldb-dap/DAP.cpp
@@ -10,11 +10,14 @@
 #include <cstdarg>
 #include <fstream>
 #include <mutex>
-#include <sstream>
 
 #include "DAP.h"
+#include "JSONUtils.h"
 #include "LLDBUtils.h"
 #include "lldb/API/SBCommandInterpreter.h"
+#include "lldb/API/SBLanguageRuntime.h"
+#include "lldb/API/SBListener.h"
+#include "lldb/API/SBStream.h"
 #include "llvm/ADT/StringExtras.h"
 #include "llvm/Support/FormatVariadic.h"
 
diff --git a/lldb/tools/lldb-dap/DAP.h b/lldb/tools/lldb-dap/DAP.h
index acc10ade75fd14..1f3cf4a61ccabe 100644
--- a/lldb/tools/lldb-dap/DAP.h
+++ b/lldb/tools/lldb-dap/DAP.h
@@ -11,14 +11,10 @@
 
 #include "llvm/Config/llvm-config.h" // for LLVM_ON_UNIX
 
-#include <atomic>
-#include <condition_variable>
 #include <cstdio>
-#include <future>
 #include <iosfwd>
 #include <map>
 #include <optional>
-#include <set>
 #include <thread>
 
 #include "llvm/ADT/DenseMap.h"
@@ -30,24 +26,12 @@
 #include "llvm/Support/raw_ostream.h"
 
 #include "lldb/API/SBAttachInfo.h"
-#include "lldb/API/SBBreakpoint.h"
-#include "lldb/API/SBBreakpointLocation.h"
 #include "lldb/API/SBCommandInterpreter.h"
 #include "lldb/API/SBCommandReturnObject.h"
-#include "lldb/API/SBCommunication.h"
 #include "lldb/API/SBDebugger.h"
 #include "lldb/API/SBEvent.h"
 #include "lldb/API/SBFormat.h"
-#include "lldb/API/SBHostOS.h"
-#include "lldb/API/SBInstruction.h"
-#include "lldb/API/SBInstructionList.h"
-#include "lldb/API/SBLanguageRuntime.h"
 #include "lldb/API/SBLaunchInfo.h"
-#include "lldb/API/SBLineEntry.h"
-#include "lldb/API/SBListener.h"
-#include "lldb/API/SBProcess.h"
-#include "lldb/API/SBStream.h"
-#include "lldb/API/SBStringList.h"
 #include "lldb/API/SBTarget.h"
 #include "lldb/API/SBThread.h"
 
@@ -56,7 +40,6 @@
 #include "IOStream.h"
 #include "InstructionBreakpoint.h"
 #include "ProgressEvent.h"
-#include "RunInTerminal.h"
 #include "SourceBreakpoint.h"
 
 #define VARREF_LOCALS (int64_t)1
diff --git a/lldb/tools/lldb-dap/FifoFiles.cpp b/lldb/tools/lldb-dap/FifoFiles.cpp
index 9a6423f79471a4..1f1bba80bd3b11 100644
--- a/lldb/tools/lldb-dap/FifoFiles.cpp
+++ b/lldb/tools/lldb-dap/FifoFiles.cpp
@@ -7,6 +7,7 @@
 //===----------------------------------------------------------------------===//
 
 #include "FifoFiles.h"
+#include "JSONUtils.h"
 
 #if !defined(_WIN32)
 #include <sys/stat.h>
@@ -18,11 +19,6 @@
 #include <fstream>
 #include <future>
 #include <optional>
-#include <thread>
-
-#include "llvm/Support/FileSystem.h"
-
-#include "lldb/lldb-defines.h"
 
 using namespace llvm;
 
diff --git a/lldb/tools/lldb-dap/FifoFiles.h b/lldb/tools/lldb-dap/FifoFiles.h
index 02a97cd5cbbd23..6c65e6eb30dd02 100644
--- a/lldb/tools/lldb-dap/FifoFiles.h
+++ b/lldb/tools/lldb-dap/FifoFiles.h
@@ -11,8 +11,7 @@
 
 #include "llvm/Config/llvm-config.h" // for LLVM_ON_UNIX
 #include "llvm/Support/Error.h"
-
-#include "JSONUtils.h"
+#include "llvm/Support/JSON.h"
 
 #include <chrono>
 
diff --git a/lldb/tools/lldb-dap/FunctionBreakpoint.cpp b/lldb/tools/lldb-dap/FunctionBreakpoint.cpp
index 21743bf908706d..216c685f633da8 100644
--- a/lldb/tools/lldb-dap/FunctionBreakpoint.cpp
+++ b/lldb/tools/lldb-dap/FunctionBreakpoint.cpp
@@ -8,6 +8,7 @@
 
 #include "FunctionBreakpoint.h"
 #include "DAP.h"
+#include "JSONUtils.h"
 
 namespace lldb_dap {
 
diff --git a/lldb/tools/lldb-dap/IOStream.cpp b/lldb/tools/lldb-dap/IOStream.cpp
index 96e9a1ed49532f..d2e8ec40b0a7b8 100644
--- a/lldb/tools/lldb-dap/IOStream.cpp
+++ b/lldb/tools/lldb-dap/IOStream.cpp
@@ -18,7 +18,6 @@
 
 #include <fstream>
 #include <string>
-#include <vector>
 
 using namespace lldb_dap;
 
diff --git a/lldb/tools/lldb-dap/InstructionBreakpoint.cpp b/lldb/tools/lldb-dap/InstructionBreakpoint.cpp
index de4f6f5d86717f..e3a8460bb7b301 100644
--- a/lldb/tools/lldb-dap/InstructionBreakpoint.cpp
+++ b/lldb/tools/lldb-dap/InstructionBreakpoint.cpp
@@ -9,6 +9,7 @@
 
 #include "InstructionBreakpoint.h"
 #include "DAP.h"
+#include "JSONUtils.h"
 
 namespace lldb_dap {
 
diff --git a/lldb/tools/lldb-dap/InstructionBreakpoint.h b/lldb/tools/lldb-dap/InstructionBreakpoint.h
index cf1516f46e9551..53912af46ca148 100644
--- a/lldb/tools/lldb-dap/InstructionBreakpoint.h
+++ b/lldb/tools/lldb-dap/InstructionBreakpoint.h
@@ -11,7 +11,6 @@
 #define LLDB_TOOLS_LLDB_DAP_INSTRUCTIONBREAKPOINT_H
 
 #include "Breakpoint.h"
-#include "llvm/ADT/StringRef.h"
 
 namespace lldb_dap {
 
diff --git a/lldb/tools/lldb-dap/JSONUtils.cpp b/lldb/tools/lldb-dap/JSONUtils.cpp
index e42a6d9d699804..fd09e4ae505e6d 100644
--- a/lldb/tools/lldb-dap/JSONUtils.cpp
+++ b/lldb/tools/lldb-dap/JSONUtils.cpp
@@ -6,25 +6,21 @@
 //
 //===----------------------------------------------------------------------===//
 
-#include <algorithm>
 #include <iomanip>
 #include <optional>
 #include <sstream>
 #include <string.h>
 
 #include "llvm/ADT/StringRef.h"
-#include "llvm/Support/FormatAdapters.h"
 #include "llvm/Support/FormatVariadic.h"
 #include "llvm/Support/Path.h"
 #include "llvm/Support/ScopedPrinter.h"
 
-#include "lldb/API/SBBreakpoint.h"
-#include "lldb/API/SBBreakpointLocation.h"
 #include "lldb/API/SBDeclaration.h"
+#include "lldb/API/SBStream.h"
 #include "lldb/API/SBStringList.h"
 #include "lldb/API/SBStructuredData.h"
 #include "lldb/API/SBValue.h"
-#include "lldb/Host/PosixApi.h"
 
 #include "DAP.h"
 #include "ExceptionBreakpoint.h"
diff --git a/lldb/tools/lldb-dap/LLDBUtils.cpp b/lldb/tools/lldb-dap/LLDBUtils.cpp
index b38833c0fdb6b6..2ffcba7dff4f24 100644
--- a/lldb/tools/lldb-dap/LLDBUtils.cpp
+++ b/lldb/tools/lldb-dap/LLDBUtils.cpp
@@ -8,6 +8,8 @@
 
 #include "LLDBUtils.h"
 #include "DAP.h"
+#include "JSONUtils.h"
+#include "lldb/API/SBStringList.h"
 
 #include <mutex>
 
diff --git a/lldb/tools/lldb-dap/OutputRedirector.h b/lldb/tools/lldb-dap/OutputRedirector.h
index dba51016775bf4..e26d1648b104f9 100644
--- a/lldb/tools/lldb-dap/OutputRedirector.h
+++ b/lldb/tools/lldb-dap/OutputRedirector.h
@@ -9,8 +9,6 @@
 #ifndef LLDB_TOOLS_LLDB_DAP_OUTPUT_REDIRECTOR_H
 #define LLDB_TOOLS_LLDB_DAP_OUTPUT_REDIRECTOR_H
 
-#include <thread>
-
 #include "llvm/ADT/StringRef.h"
 #include "llvm/Support/Error.h"
 
diff --git a/lldb/tools/lldb-dap/RunInTerminal.cpp b/lldb/tools/lldb-dap/RunInTerminal.cpp
index ad019b8a56a4fa..4fe09e2885a8e5 100644
--- a/lldb/tools/lldb-dap/RunInTerminal.cpp
+++ b/lldb/tools/lldb-dap/RunInTerminal.cpp
@@ -7,6 +7,7 @@
 //===----------------------------------------------------------------------===//
 
 #include "RunInTerminal.h"
+#include "JSONUtils.h"
 
 #if !defined(_WIN32)
 #include <sys/stat.h>
@@ -15,14 +16,10 @@
 #endif
 
 #include <chrono>
-#include <fstream>
 #include <future>
-#include <thread>
 
 #include "llvm/Support/FileSystem.h"
 
-#include "lldb/lldb-defines.h"
-
 using namespace llvm;
 
 namespace lldb_dap {
diff --git a/lldb/tools/lldb-dap/RunInTerminal.h b/lldb/tools/lldb-dap/RunInTerminal.h
index 2fbe3acbb40842..b20f8beb6071dd 100644
--- a/lldb/tools/lldb-dap/RunInTerminal.h
+++ b/lldb/tools/lldb-dap/RunInTerminal.h
@@ -10,9 +10,11 @@
 #define LLDB_TOOLS_LLDB_DAP_RUNINTERMINAL_H
 
 #include "FifoFiles.h"
+#include "lldb/API/SBError.h"
 
 #include <future>
-#include <thread>
+#include <memory>
+#include <string>
 
 namespace lldb_dap {
 
diff --git a/lldb/tools/lldb-dap/SourceBreakpoint.cpp b/lldb/tools/lldb-dap/SourceBreakpoint.cpp
index f5dd1346cb9e54..d1a3a5bedb0ae2 100644
--- a/lldb/tools/lldb-dap/SourceBreakpoint.cpp
+++ b/lldb/tools/lldb-dap/SourceBreakpoint.cpp
@@ -8,6 +8,7 @@
 
 #include "SourceBreakpoint.h"
 #include "DAP.h"
+#include "JSONUtils.h"
 
 namespace lldb_dap {
 
diff --git a/lldb/tools/lldb-dap/lldb-dap.cpp b/lldb/tools/lldb-dap/lldb-dap.cpp
index f70b0d3d4cbee0..a2f7be2b214e4a 100644
--- a/lldb/tools/lldb-dap/lldb-dap.cpp
+++ b/lldb/tools/lldb-dap/lldb-dap.cpp
@@ -7,9 +7,14 @@
 //===----------------------------------------------------------------------===//
 
 #include "DAP.h"
+#include "FifoFiles.h"
+#include "RunInTerminal.h"
 #include "Watchpoint.h"
 #include "lldb/API/SBDeclaration.h"
+#include "lldb/API/SBInstruction.h"
+#include "lldb/API/SBListener.h"
 #include "lldb/API/SBMemoryRegionInfo.h"
+#include "lldb/API/SBStringList.h"
 #include "llvm/Support/Base64.h"
 
 #include <cassert>
@@ -43,17 +48,12 @@
 
 #include <algorithm>
 #include <array>
-#include <chrono>
-#include <fstream>
 #include <map>
 #include <memory>
-#include <mutex>
 #include <set>
-#include <sstream>
 #include <thread>
 #include <vector>
 
-#include "lldb/API/SBEnvironment.h"
 #include "lldb/API/SBStream.h"
 #include "lldb/Host/Config.h"
 #include "llvm/ADT/ArrayRef.h"

This commit cleans up the includes in the `lldb-dap` subfolder.
The main motivation was that I got annoyed by `clangd` always
complaining about unused includes while working on lldb-dap.
@vogelsgesang vogelsgesang force-pushed the lldb-dap-cleanup-includes branch from 30f5c94 to d7dd1a1 Compare October 27, 2024 22:09
@vogelsgesang vogelsgesang merged commit 09c258e into llvm:main Oct 28, 2024
7 checks passed
#include "lldb/API/SBStringList.h"
#include "lldb/API/SBStructuredData.h"
#include "lldb/API/SBValue.h"
#include "lldb/Host/PosixApi.h"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Removing this include breaks lldb windows build because it includes lldb/Host/windows/PosixApi.h on windows. That provides the definition for PATH_MAX, used later in this file. I fixed it on 19c0a74

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for fixing! 🙂

NoumanAmir657 pushed a commit to NoumanAmir657/llvm-project that referenced this pull request Nov 4, 2024
This commit cleans up the includes in the `lldb-dap` subfolder. The main
motivation was that I got annoyed by `clangd` always complaining about
unused includes while working on lldb-dap.
NoumanAmir657 pushed a commit to NoumanAmir657/llvm-project that referenced this pull request Nov 4, 2024
JDevlieghere pushed a commit to swiftlang/llvm-project that referenced this pull request Feb 25, 2025
This commit cleans up the includes in the `lldb-dap` subfolder. The main
motivation was that I got annoyed by `clangd` always complaining about
unused includes while working on lldb-dap.

(cherry picked from commit 09c258e)
JDevlieghere pushed a commit to swiftlang/llvm-project that referenced this pull request Feb 25, 2025
@vogelsgesang vogelsgesang deleted the lldb-dap-cleanup-includes branch May 23, 2025 00:06
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants