https://github.com/JDevlieghere created 
https://github.com/llvm/llvm-project/pull/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.

>From 2ecdc78013db4cf3904eff7ac83a6387ece8a5ee Mon Sep 17 00:00:00 2001
From: Jonas Devlieghere <[email protected]>
Date: Fri, 26 Jun 2026 11:46:15 -0700
Subject: [PATCH] [lldb] Move Diagnostics from Utility to Core (NFC)

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.
---
 lldb/include/lldb/Core/Debugger.h                      | 2 +-
 lldb/include/lldb/{Utility => Core}/Diagnostics.h      | 4 ++--
 lldb/source/API/SBDebugger.cpp                         | 2 +-
 lldb/source/Commands/CommandObjectDiagnostics.cpp      | 2 +-
 lldb/source/Core/CMakeLists.txt                        | 1 +
 lldb/source/{Utility => Core}/Diagnostics.cpp          | 2 +-
 lldb/source/Initialization/SystemInitializerCommon.cpp | 2 +-
 lldb/source/Utility/CMakeLists.txt                     | 1 -
 8 files changed, 8 insertions(+), 8 deletions(-)
 rename lldb/include/lldb/{Utility => Core}/Diagnostics.h (95%)
 rename lldb/source/{Utility => Core}/Diagnostics.cpp (98%)

diff --git a/lldb/include/lldb/Core/Debugger.h 
b/lldb/include/lldb/Core/Debugger.h
index b7d66f5795d43..80c0b9cf308ad 100644
--- a/lldb/include/lldb/Core/Debugger.h
+++ b/lldb/include/lldb/Core/Debugger.h
@@ -31,7 +31,7 @@
 #include "lldb/Target/TargetList.h"
 #include "lldb/Utility/Broadcaster.h"
 #include "lldb/Utility/ConstString.h"
-#include "lldb/Utility/Diagnostics.h"
+#include "lldb/Core/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..e55339a9a519f 100644
--- a/lldb/source/API/SBDebugger.cpp
+++ b/lldb/source/API/SBDebugger.cpp
@@ -51,7 +51,7 @@
 #include "lldb/Target/Process.h"
 #include "lldb/Target/TargetList.h"
 #include "lldb/Utility/Args.h"
-#include "lldb/Utility/Diagnostics.h"
+#include "lldb/Core/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..d1a154c8e2477 100644
--- a/lldb/source/Commands/CommandObjectDiagnostics.cpp
+++ b/lldb/source/Commands/CommandObjectDiagnostics.cpp
@@ -15,7 +15,7 @@
 #include "lldb/Interpreter/OptionValueEnumeration.h"
 #include "lldb/Interpreter/OptionValueUInt64.h"
 #include "lldb/Interpreter/Options.h"
-#include "lldb/Utility/Diagnostics.h"
+#include "lldb/Core/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..547c677eab95a 100644
--- a/lldb/source/Initialization/SystemInitializerCommon.cpp
+++ b/lldb/source/Initialization/SystemInitializerCommon.cpp
@@ -13,7 +13,7 @@
 #include "lldb/Host/Host.h"
 #include "lldb/Host/Socket.h"
 #include "lldb/Target/Statistics.h"
-#include "lldb/Utility/Diagnostics.h"
+#include "lldb/Core/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