Author: Jonas Devlieghere
Date: 2026-06-26T20:08:23Z
New Revision: 2ceab13545c27aa73ec37666891189456d4af11e

URL: 
https://github.com/llvm/llvm-project/commit/2ceab13545c27aa73ec37666891189456d4af11e
DIFF: 
https://github.com/llvm/llvm-project/commit/2ceab13545c27aa73ec37666891189456d4af11e.diff

LOG: [lldb] Move Diagnostics from Utility to Core (NFC) (#206152)

Nothing in the Utility or Host layers uses Diagnostics. Its only callers
are Debugger (the always-on log feeder), SBDebugger, and the
SystemInitializerCommon lifecycle. Those all live in Core or above. The
header depends only on Utility primitives (FileSpec, Log, Error), and
lldbInitialization already links lldbCore, so the move adds no new link
dependency anywhere.

Relocating it to Core lets Diagnostics reach Debugger, Target,
CommandInterpreter, and Host, which simplifies an upcoming change that
collect a richer diagnostics bundle (statistics, command snapshots,
invocation, etc) and allows us to implement that directly in the
Diagnostics class.

Added: 
    lldb/include/lldb/Core/Diagnostics.h
    lldb/source/Core/Diagnostics.cpp

Modified: 
    lldb/include/lldb/Core/Debugger.h
    lldb/source/API/SBDebugger.cpp
    lldb/source/Commands/CommandObjectDiagnostics.cpp
    lldb/source/Core/CMakeLists.txt
    lldb/source/Initialization/SystemInitializerCommon.cpp
    lldb/source/Utility/CMakeLists.txt

Removed: 
    lldb/include/lldb/Utility/Diagnostics.h
    lldb/source/Utility/Diagnostics.cpp


################################################################################
diff  --git a/lldb/include/lldb/Core/Debugger.h 
b/lldb/include/lldb/Core/Debugger.h
index b7d66f5795d43..fff514fed156d 100644
--- a/lldb/include/lldb/Core/Debugger.h
+++ b/lldb/include/lldb/Core/Debugger.h
@@ -16,6 +16,7 @@
 #include <vector>
 
 #include "lldb/Core/DebuggerEvents.h"
+#include "lldb/Core/Diagnostics.h"
 #include "lldb/Core/FormatEntity.h"
 #include "lldb/Core/IOHandler.h"
 #include "lldb/Core/SourceManager.h"
@@ -31,7 +32,6 @@
 #include "lldb/Target/TargetList.h"
 #include "lldb/Utility/Broadcaster.h"
 #include "lldb/Utility/ConstString.h"
-#include "lldb/Utility/Diagnostics.h"
 #include "lldb/Utility/FileSpec.h"
 #include "lldb/Utility/Status.h"
 #include "lldb/Utility/StructuredData.h"

diff  --git a/lldb/include/lldb/Utility/Diagnostics.h 
b/lldb/include/lldb/Core/Diagnostics.h
similarity index 95%
rename from lldb/include/lldb/Utility/Diagnostics.h
rename to lldb/include/lldb/Core/Diagnostics.h
index e32ffa5233f11..1952001084095 100644
--- a/lldb/include/lldb/Utility/Diagnostics.h
+++ b/lldb/include/lldb/Core/Diagnostics.h
@@ -6,8 +6,8 @@
 //
 
//===----------------------------------------------------------------------===//
 
-#ifndef LLDB_UTILITY_DIAGNOSTICS_H
-#define LLDB_UTILITY_DIAGNOSTICS_H
+#ifndef LLDB_CORE_DIAGNOSTICS_H
+#define LLDB_CORE_DIAGNOSTICS_H
 
 #include "lldb/Utility/FileSpec.h"
 #include "lldb/Utility/Log.h"

diff  --git a/lldb/source/API/SBDebugger.cpp b/lldb/source/API/SBDebugger.cpp
index fa2b2e465359b..5138ebb5a3305 100644
--- a/lldb/source/API/SBDebugger.cpp
+++ b/lldb/source/API/SBDebugger.cpp
@@ -37,6 +37,7 @@
 
 #include "lldb/Core/Debugger.h"
 #include "lldb/Core/DebuggerEvents.h"
+#include "lldb/Core/Diagnostics.h"
 #include "lldb/Core/PluginManager.h"
 #include "lldb/Core/Progress.h"
 #include "lldb/Core/StructuredDataImpl.h"
@@ -51,7 +52,6 @@
 #include "lldb/Target/Process.h"
 #include "lldb/Target/TargetList.h"
 #include "lldb/Utility/Args.h"
-#include "lldb/Utility/Diagnostics.h"
 #include "lldb/Utility/State.h"
 #include "lldb/Version/Version.h"
 

diff  --git a/lldb/source/Commands/CommandObjectDiagnostics.cpp 
b/lldb/source/Commands/CommandObjectDiagnostics.cpp
index 3e942c98c8180..a44d4bc90eac1 100644
--- a/lldb/source/Commands/CommandObjectDiagnostics.cpp
+++ b/lldb/source/Commands/CommandObjectDiagnostics.cpp
@@ -8,6 +8,7 @@
 
 #include "CommandObjectDiagnostics.h"
 #include "lldb/Core/Debugger.h"
+#include "lldb/Core/Diagnostics.h"
 #include "lldb/Host/OptionParser.h"
 #include "lldb/Interpreter/CommandOptionArgumentTable.h"
 #include "lldb/Interpreter/CommandReturnObject.h"
@@ -15,7 +16,6 @@
 #include "lldb/Interpreter/OptionValueEnumeration.h"
 #include "lldb/Interpreter/OptionValueUInt64.h"
 #include "lldb/Interpreter/Options.h"
-#include "lldb/Utility/Diagnostics.h"
 
 using namespace lldb;
 using namespace lldb_private;

diff  --git a/lldb/source/Core/CMakeLists.txt b/lldb/source/Core/CMakeLists.txt
index 778ae690a945a..dd25c3cc86e6d 100644
--- a/lldb/source/Core/CMakeLists.txt
+++ b/lldb/source/Core/CMakeLists.txt
@@ -32,6 +32,7 @@ add_lldb_library(lldbCore NO_PLUGIN_DEPENDENCIES
   DebuggerEvents.cpp
   Declaration.cpp
   DemangledNameInfo.cpp
+  Diagnostics.cpp
   Disassembler.cpp
   DumpDataExtractor.cpp
   DumpRegisterValue.cpp

diff  --git a/lldb/source/Utility/Diagnostics.cpp 
b/lldb/source/Core/Diagnostics.cpp
similarity index 98%
rename from lldb/source/Utility/Diagnostics.cpp
rename to lldb/source/Core/Diagnostics.cpp
index 175011783ead2..f67d03364be77 100644
--- a/lldb/source/Utility/Diagnostics.cpp
+++ b/lldb/source/Core/Diagnostics.cpp
@@ -6,7 +6,7 @@
 //
 
//===----------------------------------------------------------------------===//
 
-#include "lldb/Utility/Diagnostics.h"
+#include "lldb/Core/Diagnostics.h"
 #include "lldb/Utility/LLDBAssert.h"
 
 #include "llvm/Support/Error.h"

diff  --git a/lldb/source/Initialization/SystemInitializerCommon.cpp 
b/lldb/source/Initialization/SystemInitializerCommon.cpp
index d5be8f5e0e453..b5d1c25e15008 100644
--- a/lldb/source/Initialization/SystemInitializerCommon.cpp
+++ b/lldb/source/Initialization/SystemInitializerCommon.cpp
@@ -9,11 +9,11 @@
 #include "lldb/Initialization/SystemInitializerCommon.h"
 
 #include "Plugins/Process/gdb-remote/ProcessGDBRemoteLog.h"
+#include "lldb/Core/Diagnostics.h"
 #include "lldb/Host/FileSystem.h"
 #include "lldb/Host/Host.h"
 #include "lldb/Host/Socket.h"
 #include "lldb/Target/Statistics.h"
-#include "lldb/Utility/Diagnostics.h"
 #include "lldb/Utility/LLDBLog.h"
 #include "lldb/Utility/Timer.h"
 #include "lldb/Version/Version.h"

diff  --git a/lldb/source/Utility/CMakeLists.txt 
b/lldb/source/Utility/CMakeLists.txt
index fb38741924c19..e6d918c1ce9c7 100644
--- a/lldb/source/Utility/CMakeLists.txt
+++ b/lldb/source/Utility/CMakeLists.txt
@@ -37,7 +37,6 @@ add_lldb_library(lldbUtility NO_INTERNAL_DEPENDENCIES
   DataBufferLLVM.cpp
   DataEncoder.cpp
   DataExtractor.cpp
-  Diagnostics.cpp
   Environment.cpp
   ErrorMessages.cpp
   Event.cpp


        
_______________________________________________
lldb-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits

Reply via email to