[Lldb-commits] [lldb] [lldb] Fix a circular include dependency (PR #188931)

via lldb-commits lldb-commits at lists.llvm.org
Fri Mar 27 02:09:48 PDT 2026


llvmbot wrote:


<!--LLVM PR SUMMARY COMMENT-->

@llvm/pr-subscribers-lldb

Author: Sergei Barannikov (s-barannikov)

<details>
<summary>Changes</summary>

`lldb-private-types.h` includes `lldb-private.h`, which in turn includes `lldb-private-types.h`. Because of that, `lldb-public.h` included by `lldb-private.h` after `lldb-private-types.h` is not actually included.

The practical consequence of this is that types defined in `lldb-public-types.h` (for example, `addr_t` needed downstream) are not available in `lldb-private-types.h`.

Fix this by "including what you use", which is `lldb-types.h`.

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


4 Files Affected:

- (modified) lldb/include/lldb/Interpreter/OptionArgParser.h (+1-1) 
- (modified) lldb/include/lldb/lldb-private-types.h (+1-3) 
- (modified) lldb/source/Plugins/Process/Utility/RegisterContextWindows_i386.cpp (+1) 
- (modified) lldb/source/Plugins/Process/Utility/RegisterContextWindows_x86_64.cpp (+1) 


``````````diff
diff --git a/lldb/include/lldb/Interpreter/OptionArgParser.h b/lldb/include/lldb/Interpreter/OptionArgParser.h
index 76a48fca69208..3376f1a3e6012 100644
--- a/lldb/include/lldb/Interpreter/OptionArgParser.h
+++ b/lldb/include/lldb/Interpreter/OptionArgParser.h
@@ -10,7 +10,7 @@
 #define LLDB_INTERPRETER_OPTIONARGPARSER_H
 
 #include "lldb/lldb-private-types.h"
-
+#include "llvm/Support/Error.h"
 #include <optional>
 
 namespace lldb_private {
diff --git a/lldb/include/lldb/lldb-private-types.h b/lldb/include/lldb/lldb-private-types.h
index 185467e91bf62..a60034314b77e 100644
--- a/lldb/include/lldb/lldb-private-types.h
+++ b/lldb/include/lldb/lldb-private-types.h
@@ -9,11 +9,9 @@
 #ifndef LLDB_LLDB_PRIVATE_TYPES_H
 #define LLDB_LLDB_PRIVATE_TYPES_H
 
-#include "lldb/lldb-private.h"
-
+#include "lldb/lldb-types.h"
 #include "llvm/ADT/ArrayRef.h"
 #include "llvm/ADT/SmallString.h"
-
 #include <type_traits>
 
 namespace llvm {
diff --git a/lldb/source/Plugins/Process/Utility/RegisterContextWindows_i386.cpp b/lldb/source/Plugins/Process/Utility/RegisterContextWindows_i386.cpp
index faf4021aa4993..093a43a828cdc 100644
--- a/lldb/source/Plugins/Process/Utility/RegisterContextWindows_i386.cpp
+++ b/lldb/source/Plugins/Process/Utility/RegisterContextWindows_i386.cpp
@@ -9,6 +9,7 @@
 #include "RegisterContextWindows_i386.h"
 #include "RegisterContext_x86.h"
 #include "lldb-x86-register-enums.h"
+#include "lldb/lldb-defines.h"
 
 using namespace lldb_private;
 using namespace lldb;
diff --git a/lldb/source/Plugins/Process/Utility/RegisterContextWindows_x86_64.cpp b/lldb/source/Plugins/Process/Utility/RegisterContextWindows_x86_64.cpp
index c3fc2e0026bc8..bd483707ef88f 100644
--- a/lldb/source/Plugins/Process/Utility/RegisterContextWindows_x86_64.cpp
+++ b/lldb/source/Plugins/Process/Utility/RegisterContextWindows_x86_64.cpp
@@ -9,6 +9,7 @@
 #include "RegisterContextWindows_x86_64.h"
 #include "RegisterContext_x86.h"
 #include "lldb-x86-register-enums.h"
+#include "lldb/lldb-defines.h"
 
 #include <vector>
 

``````````

</details>


https://github.com/llvm/llvm-project/pull/188931


More information about the lldb-commits mailing list