From 4d7339a14df8519b48f236ea5d6439d04f00eec2 Mon Sep 17 00:00:00 2001 From: Sergei Barannikov Date: Mon, 30 Mar 2026 18:45:36 +0300 Subject: [PATCH] [lldb] Fix a circular include dependency (NFC) (#188931) `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`. --- lldb/include/lldb/Interpreter/OptionArgParser.h | 2 +- lldb/include/lldb/lldb-private-types.h | 4 +--- .../Plugins/Process/Utility/RegisterContextWindows_i386.cpp | 1 + .../Plugins/Process/Utility/RegisterContextWindows_x86_64.cpp | 1 + lldb/unittests/Utility/ArchSpecTest.cpp | 1 + 5 files changed, 5 insertions(+), 4 deletions(-) diff --git a/lldb/include/lldb/Interpreter/OptionArgParser.h b/lldb/include/lldb/Interpreter/OptionArgParser.h index 76a48fca6920..3376f1a3e601 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 namespace lldb_private { diff --git a/lldb/include/lldb/lldb-private-types.h b/lldb/include/lldb/lldb-private-types.h index 185467e91bf6..a60034314b77 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 namespace llvm { diff --git a/lldb/source/Plugins/Process/Utility/RegisterContextWindows_i386.cpp b/lldb/source/Plugins/Process/Utility/RegisterContextWindows_i386.cpp index faf4021aa499..093a43a828cd 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 c3fc2e0026bc..bd483707ef88 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 diff --git a/lldb/unittests/Utility/ArchSpecTest.cpp b/lldb/unittests/Utility/ArchSpecTest.cpp index 3bf1c3f81876..2f6cc01a315e 100644 --- a/lldb/unittests/Utility/ArchSpecTest.cpp +++ b/lldb/unittests/Utility/ArchSpecTest.cpp @@ -9,6 +9,7 @@ #include "gtest/gtest.h" #include "lldb/Utility/ArchSpec.h" +#include "lldb/lldb-defines.h" #include "llvm/BinaryFormat/ELF.h" #include "llvm/BinaryFormat/MachO.h"