[Lldb-commits] [lldb] Add a _regexp-break-add and some more tests for the b alias. (PR #171236)

2025-12-08 Thread via lldb-commits

https://github.com/jimingham updated 
https://github.com/llvm/llvm-project/pull/171236

>From b9ebcb580ea13ee2f1a6491e03249062889eb12d Mon Sep 17 00:00:00 2001
From: Jim Ingham 
Date: Mon, 8 Dec 2025 16:26:51 -0800
Subject: [PATCH 1/2] Add a _regexp-break-add and some more tests for the b
 alias. This commit leaves "b" aliased to the old _regexp-break for now.

---
 .../source/Interpreter/CommandInterpreter.cpp | 90 ++-
 .../TestRegexpBreakCommand.py | 33 +--
 .../API/terminal/TestEditlineCompletions.py   |  2 +-
 3 files changed, 117 insertions(+), 8 deletions(-)

diff --git a/lldb/source/Interpreter/CommandInterpreter.cpp 
b/lldb/source/Interpreter/CommandInterpreter.cpp
index ffcc9ceeb2a93..28b868da26740 100644
--- a/lldb/source/Interpreter/CommandInterpreter.cpp
+++ b/lldb/source/Interpreter/CommandInterpreter.cpp
@@ -316,6 +316,11 @@ void CommandInterpreter::Initialize() {
 AddAlias("continue", cmd_obj_sp);
   }
 
+  // At this point, I'm leaving "b" command aliased to "_regexp-break".  
There's
+  // a catch-all regexp in the command that takes any unrecognized input and
+  // runs it as `break set ` and switching the command to break add 
+  // would change that behavior.  People who want to use the break add for the
+  // "b" alias can do so in their .lldbinit.
   cmd_obj_sp = GetCommandSPExact("_regexp-break");
   if (cmd_obj_sp)
 AddAlias("b", cmd_obj_sp)->SetSyntax(cmd_obj_sp->GetSyntax());
@@ -610,7 +615,7 @@ void CommandInterpreter::LoadCommandDictionary() {
   {"^[\"']?(.*[^[:space:]\"'])[\"']?[[:space:]]*$",
"breakpoint set --name '%1'"}};
   // clang-format on
-
+  
   size_t num_regexes = std::size(break_regexes);
 
   std::unique_ptr break_regex_cmd_up(
@@ -668,6 +673,89 @@ void CommandInterpreter::LoadCommandDictionary() {
 }
   }
 
+  // clang-format off
+  // FIXME: It would be simpler to just use the linespec's directly here, but
+  // the `b` alias allows "foo.c   :   12   :   45" but the linespec parser
+  // is more rigorous, and doesn't strip spaces, so the two are not equivalent.
+  const char *break_add_regexes[][2] = {
+  
{"^(.*[^[:space:]])[[:space:]]*:[[:space:]]*([[:digit:]]+)[[:space:]]*:[[:space:]]*([[:digit:]]+)[[:space:]]*$",
+   "breakpoint add file --file '%1' --line %2 --column %3"},
+  {"^(.*[^[:space:]])[[:space:]]*:[[:space:]]*([[:digit:]]+)[[:space:]]*$",
+   "breakpoint add file --file '%1' --line %2"},
+  {"^/([^/]+)/$", "breakpoint add pattern -- %1"},
+  {"^([[:digit:]]+)[[:space:]]*$",
+  "breakpoint add file --line %1"},
+  {"^\\*?(0x[[:xdigit:]]+)[[:space:]]*$",
+  "breakpoint add address %1"},
+  {"^[\"']?([-+]?\\[.*\\])[\"']?[[:space:]]*$",
+   "breakpoint add name '%1'"},
+  {"^(-.*)$",
+  "breakpoint add name '%1'"},
+  {"^(.*[^[:space:]])`(.*[^[:space:]])[[:space:]]*$",
+   "breakpoint add name '%2' --shlib '%1'"},
+  {"^\\&(.*[^[:space:]])[[:space:]]*$",
+   "breakpoint add name '%1' --skip-prologue=0"},
+  {"^[\"']?(.*[^[:space:]\"'])[\"']?[[:space:]]*$",
+   "breakpoint add name '%1'"}};
+  // clang-format on
+
+  size_t num_add_regexes = std::size(break_add_regexes);
+
+  std::unique_ptr break_add_regex_cmd_up(
+  new CommandObjectRegexCommand(
+  *this, "_regexp-break-add",
+  "Set a breakpoint using one of several shorthand formats, or list "
+  "the existing breakpoints if no arguments are provided.",
+  "\n"
+  "_regexp-break-add ::\n"
+  "  main.c:12:21  // Break at line 12 and column "
+  "21 of main.c\n\n"
+  "_regexp-break-add :\n"
+  "  main.c:12 // Break at line 12 of "
+  "main.c\n\n"
+  "_regexp-break-add \n"
+  "  12// Break at line 12 of current "
+  "file\n\n"
+  "_regexp-break-add 0x\n"
+  "  0x1234000 // Break at address "
+  "0x1234000\n\n"
+  "_regexp-break-add \n"
+  "  main  // Break in 'main' after the "
+  "prologue\n\n"
+  "_regexp-break-add &\n"
+  "  &main // Break at first instruction "
+  "in 'main'\n\n"
+  "_regexp-break-add `\n"
+  "  libc.so`malloc// Break in 'malloc' from "
+  "'libc.so'\n\n"
+  "_regexp-break-add //\n"
+  "  /break here/  // Break on source lines in "
+  "current file\n"
+  "// containing text 'break "
+  "here'.\n"
+  "_regexp-break-add\n"
+  "// List the existing "
+  "breakpoints\n",
+  lldb::eSymbolCompletion | lldb::eSourceFileCompletion, false));
+
+  if (break_add_regex_cmd_up) {
+bool success = true;
+for (size_t i

[Lldb-commits] [lldb] [lldb-dap] Migrate locations request to structured types (PR #171099)

2025-12-08 Thread via lldb-commits

llvmbot wrote:




@llvm/pr-subscribers-lldb

Author: Sergei Druzhkov (DrSergei)


Changes

This patch migrates `locations` request into structured types and adds test for 
it.

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


5 Files Affected:

- (modified) lldb/tools/lldb-dap/Handler/LocationsRequestHandler.cpp (+30-132) 
- (modified) lldb/tools/lldb-dap/Handler/RequestHandler.h (+6-3) 
- (modified) lldb/tools/lldb-dap/Protocol/ProtocolRequests.cpp (+19) 
- (modified) lldb/tools/lldb-dap/Protocol/ProtocolRequests.h (+35) 
- (modified) lldb/unittests/DAP/ProtocolRequestsTest.cpp (+50) 


``diff
diff --git a/lldb/tools/lldb-dap/Handler/LocationsRequestHandler.cpp 
b/lldb/tools/lldb-dap/Handler/LocationsRequestHandler.cpp
index cf9b5a3dbd06b..10a6dcf4d8305 100644
--- a/lldb/tools/lldb-dap/Handler/LocationsRequestHandler.cpp
+++ b/lldb/tools/lldb-dap/Handler/LocationsRequestHandler.cpp
@@ -7,6 +7,7 @@
 
//===--===//
 
 #include "DAP.h"
+#include "DAPError.h"
 #include "EventHelper.h"
 #include "JSONUtils.h"
 #include "LLDBUtils.h"
@@ -18,167 +19,64 @@
 
 namespace lldb_dap {
 
-// "LocationsRequest": {
-//   "allOf": [ { "$ref": "#/definitions/Request" }, {
-// "type": "object",
-// "description": "Looks up information about a location reference
-// previously returned by the debug adapter.",
-// "properties": {
-//   "command": {
-// "type": "string",
-// "enum": [ "locations" ]
-//   },
-//   "arguments": {
-// "$ref": "#/definitions/LocationsArguments"
-//   }
-// },
-// "required": [ "command", "arguments" ]
-//   }]
-// },
-// "LocationsArguments": {
-//   "type": "object",
-//   "description": "Arguments for `locations` request.",
-//   "properties": {
-// "locationReference": {
-//   "type": "integer",
-//   "description": "Location reference to resolve."
-// }
-//   },
-//   "required": [ "locationReference" ]
-// },
-// "LocationsResponse": {
-//   "allOf": [ { "$ref": "#/definitions/Response" }, {
-// "type": "object",
-// "description": "Response to `locations` request.",
-// "properties": {
-//   "body": {
-// "type": "object",
-// "properties": {
-//   "source": {
-// "$ref": "#/definitions/Source",
-// "description": "The source containing the location; either
-// `source.path` or `source.sourceReference` must 
be
-// specified."
-//   },
-//   "line": {
-// "type": "integer",
-// "description": "The line number of the location. The client
-// capability `linesStartAt1` determines whether it
-// is 0- or 1-based."
-//   },
-//   "column": {
-// "type": "integer",
-// "description": "Position of the location within the `line`. It 
is
-// measured in UTF-16 code units and the client
-// capability `columnsStartAt1` determines whether
-// it is 0- or 1-based. If no column is given, the
-// first position in the start line is assumed."
-//   },
-//   "endLine": {
-// "type": "integer",
-// "description": "End line of the location, present if the 
location
-// refers to a range.  The client capability
-// `linesStartAt1` determines whether it is 0- or
-// 1-based."
-//   },
-//   "endColumn": {
-// "type": "integer",
-// "description": "End position of the location within `endLine`,
-// present if the location refers to a range. It is
-// measured in UTF-16 code units and the client
-// capability `columnsStartAt1` determines whether
-// it is 0- or 1-based."
-//   }
-// },
-// "required": [ "source", "line" ]
-//   }
-// }
-//   }]
-// },
-void LocationsRequestHandler::operator()(
-const llvm::json::Object &request) const {
-  llvm::json::Object response;
-  FillResponse(request, response);
-  auto *arguments = request.getObject("arguments");
-
-  const auto location_id =
-  GetInteger(arguments, "locationReference").value_or(0);
+// Looks up information about a location reference previously returned by the
+// debug adapter.
+llvm::Expected
+LocationsRequestHandler::Run(const protocol::LocationsArguments &args) const {
+  protocol::LocationsResponseBody response;
   // We use the lowest bit to distinguish between value location and 
declaration
   // location
-  auto [var_ref, is_value_location] = UnpackLocation(location_id);
+  auto [

[Lldb-commits] [lldb] [lldb-dap] Migrate locations request to structured types (PR #171099)

2025-12-08 Thread Sergei Druzhkov via lldb-commits

https://github.com/DrSergei created 
https://github.com/llvm/llvm-project/pull/171099

This patch migrates `locations` request into structured types and adds test for 
it.

>From 5a8427e3a9e515a47d68588d05d6147660c98b2f Mon Sep 17 00:00:00 2001
From: Druzhkov Sergei 
Date: Sun, 7 Dec 2025 17:23:49 +0300
Subject: [PATCH] [lldb-dap] Migrate locations request to structured types

---
 .../Handler/LocationsRequestHandler.cpp   | 162 --
 lldb/tools/lldb-dap/Handler/RequestHandler.h  |   9 +-
 .../lldb-dap/Protocol/ProtocolRequests.cpp|  19 ++
 .../lldb-dap/Protocol/ProtocolRequests.h  |  35 
 lldb/unittests/DAP/ProtocolRequestsTest.cpp   |  50 ++
 5 files changed, 140 insertions(+), 135 deletions(-)

diff --git a/lldb/tools/lldb-dap/Handler/LocationsRequestHandler.cpp 
b/lldb/tools/lldb-dap/Handler/LocationsRequestHandler.cpp
index cf9b5a3dbd06b..10a6dcf4d8305 100644
--- a/lldb/tools/lldb-dap/Handler/LocationsRequestHandler.cpp
+++ b/lldb/tools/lldb-dap/Handler/LocationsRequestHandler.cpp
@@ -7,6 +7,7 @@
 
//===--===//
 
 #include "DAP.h"
+#include "DAPError.h"
 #include "EventHelper.h"
 #include "JSONUtils.h"
 #include "LLDBUtils.h"
@@ -18,167 +19,64 @@
 
 namespace lldb_dap {
 
-// "LocationsRequest": {
-//   "allOf": [ { "$ref": "#/definitions/Request" }, {
-// "type": "object",
-// "description": "Looks up information about a location reference
-// previously returned by the debug adapter.",
-// "properties": {
-//   "command": {
-// "type": "string",
-// "enum": [ "locations" ]
-//   },
-//   "arguments": {
-// "$ref": "#/definitions/LocationsArguments"
-//   }
-// },
-// "required": [ "command", "arguments" ]
-//   }]
-// },
-// "LocationsArguments": {
-//   "type": "object",
-//   "description": "Arguments for `locations` request.",
-//   "properties": {
-// "locationReference": {
-//   "type": "integer",
-//   "description": "Location reference to resolve."
-// }
-//   },
-//   "required": [ "locationReference" ]
-// },
-// "LocationsResponse": {
-//   "allOf": [ { "$ref": "#/definitions/Response" }, {
-// "type": "object",
-// "description": "Response to `locations` request.",
-// "properties": {
-//   "body": {
-// "type": "object",
-// "properties": {
-//   "source": {
-// "$ref": "#/definitions/Source",
-// "description": "The source containing the location; either
-// `source.path` or `source.sourceReference` must 
be
-// specified."
-//   },
-//   "line": {
-// "type": "integer",
-// "description": "The line number of the location. The client
-// capability `linesStartAt1` determines whether it
-// is 0- or 1-based."
-//   },
-//   "column": {
-// "type": "integer",
-// "description": "Position of the location within the `line`. It 
is
-// measured in UTF-16 code units and the client
-// capability `columnsStartAt1` determines whether
-// it is 0- or 1-based. If no column is given, the
-// first position in the start line is assumed."
-//   },
-//   "endLine": {
-// "type": "integer",
-// "description": "End line of the location, present if the 
location
-// refers to a range.  The client capability
-// `linesStartAt1` determines whether it is 0- or
-// 1-based."
-//   },
-//   "endColumn": {
-// "type": "integer",
-// "description": "End position of the location within `endLine`,
-// present if the location refers to a range. It is
-// measured in UTF-16 code units and the client
-// capability `columnsStartAt1` determines whether
-// it is 0- or 1-based."
-//   }
-// },
-// "required": [ "source", "line" ]
-//   }
-// }
-//   }]
-// },
-void LocationsRequestHandler::operator()(
-const llvm::json::Object &request) const {
-  llvm::json::Object response;
-  FillResponse(request, response);
-  auto *arguments = request.getObject("arguments");
-
-  const auto location_id =
-  GetInteger(arguments, "locationReference").value_or(0);
+// Looks up information about a location reference previously returned by the
+// debug adapter.
+llvm::Expected
+LocationsRequestHandler::Run(const protocol::LocationsArguments &args) const {
+  protocol::LocationsResponseBody response;
   // We use the lowest bit to distinguish between value location a

[Lldb-commits] [lldb] [lldb-dap] Migrate pause request to structured types (PR #171096)

2025-12-08 Thread Sergei Druzhkov via lldb-commits

https://github.com/DrSergei updated 
https://github.com/llvm/llvm-project/pull/171096

>From 679bb3f40b7c8961841b8d73bae0c8fa7e8cd904 Mon Sep 17 00:00:00 2001
From: Druzhkov Sergei 
Date: Sun, 7 Dec 2025 13:55:04 +0300
Subject: [PATCH 1/2] [lldb-dap] Migrate pause request to structured types

---
 .../lldb-dap/Handler/PauseRequestHandler.cpp  | 48 +++
 lldb/tools/lldb-dap/Handler/RequestHandler.h  |  7 +--
 .../lldb-dap/Protocol/ProtocolRequests.cpp|  6 +++
 .../lldb-dap/Protocol/ProtocolRequests.h  | 11 +
 lldb/unittests/DAP/ProtocolRequestsTest.cpp   | 11 +
 5 files changed, 39 insertions(+), 44 deletions(-)

diff --git a/lldb/tools/lldb-dap/Handler/PauseRequestHandler.cpp 
b/lldb/tools/lldb-dap/Handler/PauseRequestHandler.cpp
index 99917b2e28223..1589c7c1142e9 100644
--- a/lldb/tools/lldb-dap/Handler/PauseRequestHandler.cpp
+++ b/lldb/tools/lldb-dap/Handler/PauseRequestHandler.cpp
@@ -8,53 +8,19 @@
 
 #include "DAP.h"
 #include "EventHelper.h"
-#include "JSONUtils.h"
+#include "Protocol/ProtocolRequests.h"
 #include "RequestHandler.h"
 
 namespace lldb_dap {
 
-// "PauseRequest": {
-//   "allOf": [ { "$ref": "#/definitions/Request" }, {
-// "type": "object",
-// "description": "Pause request; value of command field is 'pause'. The
-// request suspenses the debuggee. The debug adapter first sends the
-// PauseResponse and then a StoppedEvent (event type 'pause') after the
-// thread has been paused successfully.", "properties": {
-//   "command": {
-// "type": "string",
-// "enum": [ "pause" ]
-//   },
-//   "arguments": {
-// "$ref": "#/definitions/PauseArguments"
-//   }
-// },
-// "required": [ "command", "arguments"  ]
-//   }]
-// },
-// "PauseArguments": {
-//   "type": "object",
-//   "description": "Arguments for 'pause' request.",
-//   "properties": {
-// "threadId": {
-//   "type": "integer",
-//   "description": "Pause execution for this thread."
-// }
-//   },
-//   "required": [ "threadId" ]
-// },
-// "PauseResponse": {
-//   "allOf": [ { "$ref": "#/definitions/Response" }, {
-// "type": "object",
-// "description": "Response to 'pause' request. This is just an
-// acknowledgement, so no body field is required."
-//   }]
-// }
-void PauseRequestHandler::operator()(const llvm::json::Object &request) const {
-  llvm::json::Object response;
-  FillResponse(request, response);
+/// The request suspenses the debuggee. The debug adapter first sends the
+/// PauseResponse and then a StoppedEvent (event type 'pause') after the thread
+/// has been paused successfully.
+llvm::Error
+PauseRequestHandler::Run(const protocol::PauseArguments &args) const {
   lldb::SBProcess process = dap.target.GetProcess();
   lldb::SBError error = process.Stop();
-  dap.SendJSON(llvm::json::Value(std::move(response)));
+  return llvm::Error::success();
 }
 
 } // namespace lldb_dap
diff --git a/lldb/tools/lldb-dap/Handler/RequestHandler.h 
b/lldb/tools/lldb-dap/Handler/RequestHandler.h
index 5d235352b7738..fdce33de3f680 100644
--- a/lldb/tools/lldb-dap/Handler/RequestHandler.h
+++ b/lldb/tools/lldb-dap/Handler/RequestHandler.h
@@ -492,11 +492,12 @@ class ModulesRequestHandler final
   Run(const std::optional &args) const override;
 };
 
-class PauseRequestHandler : public LegacyRequestHandler {
+class PauseRequestHandler
+: public RequestHandler 
{
 public:
-  using LegacyRequestHandler::LegacyRequestHandler;
+  using RequestHandler::RequestHandler;
   static llvm::StringLiteral GetCommand() { return "pause"; }
-  void operator()(const llvm::json::Object &request) const override;
+  llvm::Error Run(const protocol::PauseArguments &args) const override;
 };
 
 class ScopesRequestHandler final
diff --git a/lldb/tools/lldb-dap/Protocol/ProtocolRequests.cpp 
b/lldb/tools/lldb-dap/Protocol/ProtocolRequests.cpp
index 0a1d580bffd68..95ecc7e4e7e40 100644
--- a/lldb/tools/lldb-dap/Protocol/ProtocolRequests.cpp
+++ b/lldb/tools/lldb-dap/Protocol/ProtocolRequests.cpp
@@ -695,4 +695,10 @@ llvm::json::Value toJSON(const EvaluateResponseBody &Body) 
{
   return result;
 }
 
+bool fromJSON(const llvm::json::Value &Params, PauseArguments &Args,
+  llvm::json::Path Path) {
+  json::ObjectMapper O(Params, Path);
+  return O && O.map("threadId", Args.threadId);
+}
+
 } // namespace lldb_dap::protocol
diff --git a/lldb/tools/lldb-dap/Protocol/ProtocolRequests.h 
b/lldb/tools/lldb-dap/Protocol/ProtocolRequests.h
index 6a85033ae7ef2..dc84e90ae03b4 100644
--- a/lldb/tools/lldb-dap/Protocol/ProtocolRequests.h
+++ b/lldb/tools/lldb-dap/Protocol/ProtocolRequests.h
@@ -1184,6 +1184,17 @@ struct EvaluateResponseBody {
 };
 llvm::json::Value toJSON(const EvaluateResponseBody &);
 
+/// Arguments for `pause` request.
+struct PauseArguments {
+  /// Pause execution for this thread.
+  lldb::tid_t threadId = LLDB_INVALID_THREAD_ID;
+};
+bool fromJSON(const llvm::json::Value &, PauseArguments &, llvm::json:

[Lldb-commits] [clang] [compiler-rt] [flang] [libc] [libcxx] [lldb] [llvm] [mlir] [openmp] [libc++] Implement P2242R1: `std::views::chunk` (PR #171109)

2025-12-08 Thread via lldb-commits
Nicolai =?utf-8?q?Hähnle?= ,jimingham
 ,Matt Arsenault ,Priyanshu
 Kumar <[email protected]>,Aiden Grossman 
,Maksim
 Levental 
Message-ID:
In-Reply-To: 


https://github.com/anonymouspc converted_to_draft 
https://github.com/llvm/llvm-project/pull/171109
___
lldb-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [clang] [compiler-rt] [flang] [libc] [libcxx] [lldb] [llvm] [mlir] [openmp] [libc++] Implement P2242R1: `std::views::chunk` (PR #171109)

2025-12-08 Thread via lldb-commits
Nicolai =?utf-8?q?Hähnle?= ,jimingham
 ,Matt Arsenault ,Priyanshu
 Kumar <[email protected]>,Aiden Grossman 
,Maksim
 Levental 
Message-ID:
In-Reply-To: 


github-actions[bot] wrote:




:warning: C/C++ code formatter, clang-format found issues in your code. 
:warning:



You can test this locally with the following command:


``bash
git-clang-format --diff origin/main HEAD --extensions ,inc,cpp,h -- 
libcxx/include/__ranges/chunk_view.h 
libcxx/test/std/ranges/range.adaptors/range.chunk/adaptor.pass.cpp 
libcxx/test/std/ranges/range.adaptors/range.chunk/base.pass.cpp 
libcxx/test/std/ranges/range.adaptors/range.chunk/begin.pass.cpp 
libcxx/test/std/ranges/range.adaptors/range.chunk/ctad.compile.pass.cpp 
libcxx/test/std/ranges/range.adaptors/range.chunk/end.pass.cpp 
libcxx/test/std/ranges/range.adaptors/range.chunk/general.pass.cpp 
libcxx/test/std/ranges/range.adaptors/range.chunk/types.h libcxx/include/ranges 
libcxx/modules/std/ranges.inc --diff_from_common_commit
``

:warning:
The reproduction instructions above might return results for more than one PR
in a stack if you are using a stacked PR workflow. You can limit the results by
changing `origin/main` to the base branch/commit you want to compare against.
:warning:





View the diff from clang-format here.


``diff
diff --git a/libcxx/include/__ranges/chunk_view.h 
b/libcxx/include/__ranges/chunk_view.h
index b1c96223a..ae37c9784 100644
--- a/libcxx/include/__ranges/chunk_view.h
+++ b/libcxx/include/__ranges/chunk_view.h
@@ -113,7 +113,8 @@ class chunk_view<_View>::__outer_iterator {
 
   chunk_view* __parent_;
 
-  _LIBCPP_HIDE_FROM_ABI constexpr explicit __outer_iterator(chunk_view& 
__parent) : __parent_(std::addressof(__parent)) {}
+  _LIBCPP_HIDE_FROM_ABI constexpr explicit __outer_iterator(chunk_view& 
__parent)
+  : __parent_(std::addressof(__parent)) {}
 
 public:
   class value_type;
@@ -325,7 +326,7 @@ class chunk_view<_View>::__iterator {
   friend chunk_view;
 
   using _Parent _LIBCPP_NODEBUG = __maybe_const<_Const, chunk_view>;
-  using _Base   _LIBCPP_NODEBUG = __maybe_const<_Const, _View>;
+  using _Base _LIBCPP_NODEBUG   = __maybe_const<_Const, _View>;
 
   iterator_t<_Base> __current_ = iterator_t<_Base>();
   sentinel_t<_Base> __end_ = sentinel_t<_Base>();

``




https://github.com/llvm/llvm-project/pull/171109
___
lldb-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [lldb] [lldb] Fix command line of `target frame-provider register` (PR #167803)

2025-12-08 Thread Adrian Vogelsgesang via lldb-commits

https://github.com/vogelsgesang auto_merge_enabled 
https://github.com/llvm/llvm-project/pull/167803
___
lldb-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [lldb] [lldb][TypeSystemClang] Set SuppressInlineNamespace to 'All' (PR #171138)

2025-12-08 Thread Michael Buch via lldb-commits

https://github.com/Michael137 created 
https://github.com/llvm/llvm-project/pull/171138

We used to set it to `true` up until recently, see TBD. That's incorrect 
because `SuppressInlineNamespace` is actually an enum. What probably happened 
is that `SuppressInlineNamespace` used to be a boolean but got turned into an 
enum. But the assignment in LLDB wasn't updated. But because the bitfield is an 
`unsigned`, the compiler never complained.

This meant that ever since `SuppressInlineNamespace` became an enum, we've been 
setting it to `SuppressInlineNamespaceMode::Redundant`. Which means we would 
only omit the inline namespace when displaying typenames if Clang deemed it 
unambiguous. This is probably a rare situtation but the attached test-case is 
one such scenario. Here, `target var t1` followed by `target var t2` would 
print the inline namespace for `t2`, because in that context, the type is 
otherwise ambiguous. But because LLDB's context is lazily constructed, 
evaluating `t2` first would omit the inline namespace, because `t1` isn't in 
the context yet to make it ambiguous.

This patch sets the `SuppressInlineNamespace` to 
`SuppressInlineNamespaceMode::All`, which is most likely what was intended in 
the first place, and also removes the above-mentioned non-determinism from our 
typename printing.

>From ef123fccb13b4f41f54f9fb202cdfca7e6a206f4 Mon Sep 17 00:00:00 2001
From: Michael Buch 
Date: Mon, 8 Dec 2025 19:07:48 +0800
Subject: [PATCH] [lldb][TypeSystemClang] Set SuppressInlineNamespace to 'All'

We used to set it to `true` up until recently, see TBD. That's incorrect 
because `SuppressInlineNamespace` is actually an enum. What probably happened 
is that `SuppressInlineNamespace` used to be a boolean but got turned into an 
enum. But the assignment in LLDB wasn't updated. But because the bitfield is an 
`unsigned`, the compiler never complained.

This meant that ever since `SuppressInlineNamespace` became an enum, we've been 
setting it to `SuppressInlineNamespaceMode::Redundant`. Which means we would 
only omit the inline namespace when displaying typenames if Clang deemed it 
unambiguous. This is probably a rare situtation but the attached test-case is 
one such scenario. Here, `target var t1` followed by `target var t2` would 
print the inline namespace for `t2`, because in that context, the type is 
otherwise ambiguous. But because LLDB's context is lazily constructed, 
evaluating `t2` first would omit the inline namespace, because `t1` isn't in 
the context yet to make it ambiguous.

This patch sets the `SuppressInlineNamespace` to 
`SuppressInlineNamespaceMode::All`, which is most likely what was intended in 
the first place, and also removes the above-mentioned non-determinism from our 
typename printing.
---
 .../TypeSystem/Clang/TypeSystemClang.cpp  |  5 ++--
 .../cpp/inline-namespace-in-typename/Makefile |  3 ++
 .../TestInlineNamespaceInTypename.py  | 30 +++
 .../cpp/inline-namespace-in-typename/main.cpp | 13 
 4 files changed, 48 insertions(+), 3 deletions(-)
 create mode 100644 lldb/test/API/lang/cpp/inline-namespace-in-typename/Makefile
 create mode 100644 
lldb/test/API/lang/cpp/inline-namespace-in-typename/TestInlineNamespaceInTypename.py
 create mode 100644 lldb/test/API/lang/cpp/inline-namespace-in-typename/main.cpp

diff --git a/lldb/source/Plugins/TypeSystem/Clang/TypeSystemClang.cpp 
b/lldb/source/Plugins/TypeSystem/Clang/TypeSystemClang.cpp
index 2cb4a46130c84..625d0e546ad3b 100644
--- a/lldb/source/Plugins/TypeSystem/Clang/TypeSystemClang.cpp
+++ b/lldb/source/Plugins/TypeSystem/Clang/TypeSystemClang.cpp
@@ -3871,9 +3871,8 @@ 
TypeSystemClang::GetDisplayTypeName(lldb::opaque_compiler_type_t type) {
   printing_policy.SuppressTagKeyword = true;
   printing_policy.SuppressScope = false;
   printing_policy.SuppressUnwrittenScope = true;
-  // FIXME: should we suppress "All" inline namespaces?
-  printing_policy.SuppressInlineNamespace = llvm::to_underlying(
-  PrintingPolicy::SuppressInlineNamespaceMode::Redundant);
+  printing_policy.SuppressInlineNamespace =
+  llvm::to_underlying(PrintingPolicy::SuppressInlineNamespaceMode::All);
   return ConstString(qual_type.getAsString(printing_policy));
 }
 
diff --git a/lldb/test/API/lang/cpp/inline-namespace-in-typename/Makefile 
b/lldb/test/API/lang/cpp/inline-namespace-in-typename/Makefile
new file mode 100644
index 0..8b20bcb05
--- /dev/null
+++ b/lldb/test/API/lang/cpp/inline-namespace-in-typename/Makefile
@@ -0,0 +1,3 @@
+CXX_SOURCES := main.cpp
+
+include Makefile.rules
diff --git 
a/lldb/test/API/lang/cpp/inline-namespace-in-typename/TestInlineNamespaceInTypename.py
 
b/lldb/test/API/lang/cpp/inline-namespace-in-typename/TestInlineNamespaceInTypename.py
new file mode 100644
index 0..19681364466ce
--- /dev/null
+++ 
b/lldb/test/API/lang/cpp/inline-namespace-in-typename/TestInlineNamespaceInTypename.py
@@ -0,0 +1,30 @@
+import lldb
+from lldbsuite.tes

[Lldb-commits] [lldb] [lldb][TypeSystemClang] Set SuppressInlineNamespace to 'All' (PR #171138)

2025-12-08 Thread via lldb-commits

llvmbot wrote:




@llvm/pr-subscribers-lldb

Author: Michael Buch (Michael137)


Changes

We used to set it to `true` up until recently, see TBD. That's incorrect 
because `SuppressInlineNamespace` is actually an enum. What probably happened 
is that `SuppressInlineNamespace` used to be a boolean but got turned into an 
enum. But the assignment in LLDB wasn't updated. But because the bitfield is an 
`unsigned`, the compiler never complained.

This meant that ever since `SuppressInlineNamespace` became an enum, we've been 
setting it to `SuppressInlineNamespaceMode::Redundant`. Which means we would 
only omit the inline namespace when displaying typenames if Clang deemed it 
unambiguous. This is probably a rare situtation but the attached test-case is 
one such scenario. Here, `target var t1` followed by `target var t2` would 
print the inline namespace for `t2`, because in that context, the type is 
otherwise ambiguous. But because LLDB's context is lazily constructed, 
evaluating `t2` first would omit the inline namespace, because `t1` isn't in 
the context yet to make it ambiguous.

This patch sets the `SuppressInlineNamespace` to 
`SuppressInlineNamespaceMode::All`, which is most likely what was intended in 
the first place, and also removes the above-mentioned non-determinism from our 
typename printing.

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


4 Files Affected:

- (modified) lldb/source/Plugins/TypeSystem/Clang/TypeSystemClang.cpp (+2-3) 
- (added) lldb/test/API/lang/cpp/inline-namespace-in-typename/Makefile (+3) 
- (added) 
lldb/test/API/lang/cpp/inline-namespace-in-typename/TestInlineNamespaceInTypename.py
 (+30) 
- (added) lldb/test/API/lang/cpp/inline-namespace-in-typename/main.cpp (+13) 


``diff
diff --git a/lldb/source/Plugins/TypeSystem/Clang/TypeSystemClang.cpp 
b/lldb/source/Plugins/TypeSystem/Clang/TypeSystemClang.cpp
index 2cb4a46130c84..625d0e546ad3b 100644
--- a/lldb/source/Plugins/TypeSystem/Clang/TypeSystemClang.cpp
+++ b/lldb/source/Plugins/TypeSystem/Clang/TypeSystemClang.cpp
@@ -3871,9 +3871,8 @@ 
TypeSystemClang::GetDisplayTypeName(lldb::opaque_compiler_type_t type) {
   printing_policy.SuppressTagKeyword = true;
   printing_policy.SuppressScope = false;
   printing_policy.SuppressUnwrittenScope = true;
-  // FIXME: should we suppress "All" inline namespaces?
-  printing_policy.SuppressInlineNamespace = llvm::to_underlying(
-  PrintingPolicy::SuppressInlineNamespaceMode::Redundant);
+  printing_policy.SuppressInlineNamespace =
+  llvm::to_underlying(PrintingPolicy::SuppressInlineNamespaceMode::All);
   return ConstString(qual_type.getAsString(printing_policy));
 }
 
diff --git a/lldb/test/API/lang/cpp/inline-namespace-in-typename/Makefile 
b/lldb/test/API/lang/cpp/inline-namespace-in-typename/Makefile
new file mode 100644
index 0..8b20bcb05
--- /dev/null
+++ b/lldb/test/API/lang/cpp/inline-namespace-in-typename/Makefile
@@ -0,0 +1,3 @@
+CXX_SOURCES := main.cpp
+
+include Makefile.rules
diff --git 
a/lldb/test/API/lang/cpp/inline-namespace-in-typename/TestInlineNamespaceInTypename.py
 
b/lldb/test/API/lang/cpp/inline-namespace-in-typename/TestInlineNamespaceInTypename.py
new file mode 100644
index 0..19681364466ce
--- /dev/null
+++ 
b/lldb/test/API/lang/cpp/inline-namespace-in-typename/TestInlineNamespaceInTypename.py
@@ -0,0 +1,30 @@
+import lldb
+from lldbsuite.test.lldbtest import *
+from lldbsuite.test import lldbutil
+
+
+class TestInlineNamespaceInTypename(TestBase):
+def test(self):
+"""
+Tests that we correctly omit the inline namespace when printing
+the type name for "display", even if omitting the inline namespace
+would be ambiguous in the current context.
+"""
+self.build()
+target = self.dbg.CreateTarget(self.getBuildArtifact("a.out"))
+
+t1 = target.FindGlobalVariables("t1", 1)
+self.assertTrue(len(t1), 1)
+self.assertEqual(t1[0].GetDisplayTypeName(), "foo::Duplicate")
+
+# 'foo::Duplicate' would be an ambiguous reference, but we still
+# omit the inline namespace when displaying the type.
+t2 = target.FindGlobalVariables("t2", 1)
+self.assertTrue(len(t2), 1)
+self.assertEqual(t2[0].GetDisplayTypeName(), "foo::Duplicate")
+self.assertEqual(t2[0].GetTypeName(), "foo::bar::Duplicate")
+
+t3 = target.FindGlobalVariables("t3", 1)
+self.assertTrue(len(t3), 1)
+self.assertEqual(t3[0].GetDisplayTypeName(), "foo::Unique")
+self.assertEqual(t3[0].GetTypeName(), "foo::bar::Unique")
diff --git a/lldb/test/API/lang/cpp/inline-namespace-in-typename/main.cpp 
b/lldb/test/API/lang/cpp/inline-namespace-in-typename/main.cpp
new file mode 100644
index 0..eabd93c050e7a
--- /dev/null
+++ b/lldb/test/API/lang/cpp/inline-namespace-in-typename/main.cpp
@@ -0,0 +1,13 @@
+namespace foo {
+struct Duplicate {
+} t1;
+
+inline namespace bar {
+str

[Lldb-commits] [lldb] [lldb][TypeSystemClang] Set SuppressInlineNamespace to 'All' (PR #171138)

2025-12-08 Thread Michael Buch via lldb-commits

https://github.com/Michael137 edited 
https://github.com/llvm/llvm-project/pull/171138
___
lldb-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [lldb] [lldb] Dump build configuration with `version -v` (PR #170772)

2025-12-08 Thread Jonas Devlieghere via lldb-commits

https://github.com/JDevlieghere updated 
https://github.com/llvm/llvm-project/pull/170772

>From 38d27e4313ba38b5a54ffaab2ee68f53b21a3f2e Mon Sep 17 00:00:00 2001
From: Jonas Devlieghere 
Date: Thu, 4 Dec 2025 12:00:11 -0800
Subject: [PATCH 1/4] Move GetBuildConfiguration from SBDebugger -> Debugger

---
 lldb/include/lldb/Core/Debugger.h |  3 ++
 lldb/source/API/SBDebugger.cpp| 52 +
 lldb/source/Core/Debugger.cpp | 55 +++
 3 files changed, 59 insertions(+), 51 deletions(-)

diff --git a/lldb/include/lldb/Core/Debugger.h 
b/lldb/include/lldb/Core/Debugger.h
index ead2ed35fadd4..a39413c06340c 100644
--- a/lldb/include/lldb/Core/Debugger.h
+++ b/lldb/include/lldb/Core/Debugger.h
@@ -107,6 +107,9 @@ class Debugger : public 
std::enable_shared_from_this,
 
   static void Destroy(lldb::DebuggerSP &debugger_sp);
 
+  /// Get the build configuration as structured data.
+  static StructuredData::DictionarySP GetBuildConfiguration();
+
   static lldb::DebuggerSP FindDebuggerWithID(lldb::user_id_t id);
 
   static lldb::DebuggerSP
diff --git a/lldb/source/API/SBDebugger.cpp b/lldb/source/API/SBDebugger.cpp
index f939955ba57c8..3f34e7acb0673 100644
--- a/lldb/source/API/SBDebugger.cpp
+++ b/lldb/source/API/SBDebugger.cpp
@@ -709,61 +709,11 @@ const char *SBDebugger::StateAsCString(StateType state) {
   return lldb_private::StateAsCString(state);
 }
 
-static void AddBoolConfigEntry(StructuredData::Dictionary &dict,
-   llvm::StringRef name, bool value,
-   llvm::StringRef description) {
-  auto entry_up = std::make_unique();
-  entry_up->AddBooleanItem("value", value);
-  entry_up->AddStringItem("description", description);
-  dict.AddItem(name, std::move(entry_up));
-}
-
-static void AddLLVMTargets(StructuredData::Dictionary &dict) {
-  auto array_up = std::make_unique();
-#define LLVM_TARGET(target)
\
-  array_up->AddItem(std::make_unique(#target));
-#include "llvm/Config/Targets.def"
-  auto entry_up = std::make_unique();
-  entry_up->AddItem("value", std::move(array_up));
-  entry_up->AddStringItem("description", "A list of configured LLVM targets.");
-  dict.AddItem("targets", std::move(entry_up));
-}
-
 SBStructuredData SBDebugger::GetBuildConfiguration() {
   LLDB_INSTRUMENT();
 
-  auto config_up = std::make_unique();
-  AddBoolConfigEntry(
-  *config_up, "xml", XMLDocument::XMLEnabled(),
-  "A boolean value that indicates if XML support is enabled in LLDB");
-  AddBoolConfigEntry(
-  *config_up, "curl", LLVM_ENABLE_CURL,
-  "A boolean value that indicates if CURL support is enabled in LLDB");
-  AddBoolConfigEntry(
-  *config_up, "curses", LLDB_ENABLE_CURSES,
-  "A boolean value that indicates if curses support is enabled in LLDB");
-  AddBoolConfigEntry(
-  *config_up, "editline", LLDB_ENABLE_LIBEDIT,
-  "A boolean value that indicates if editline support is enabled in LLDB");
-  AddBoolConfigEntry(*config_up, "editline_wchar", LLDB_EDITLINE_USE_WCHAR,
- "A boolean value that indicates if editline wide "
- "characters support is enabled in LLDB");
-  AddBoolConfigEntry(
-  *config_up, "lzma", LLDB_ENABLE_LZMA,
-  "A boolean value that indicates if lzma support is enabled in LLDB");
-  AddBoolConfigEntry(
-  *config_up, "python", LLDB_ENABLE_PYTHON,
-  "A boolean value that indicates if python support is enabled in LLDB");
-  AddBoolConfigEntry(
-  *config_up, "lua", LLDB_ENABLE_LUA,
-  "A boolean value that indicates if lua support is enabled in LLDB");
-  AddBoolConfigEntry(*config_up, "fbsdvmcore", LLDB_ENABLE_FBSDVMCORE,
- "A boolean value that indicates if fbsdvmcore support is "
- "enabled in LLDB");
-  AddLLVMTargets(*config_up);
-
   SBStructuredData data;
-  data.m_impl_up->SetObjectSP(std::move(config_up));
+  data.m_impl_up->SetObjectSP(Debugger::GetBuildConfiguration());
   return data;
 }
 
diff --git a/lldb/source/Core/Debugger.cpp b/lldb/source/Core/Debugger.cpp
index 02f38e9094ec5..99f4a728e3f17 100644
--- a/lldb/source/Core/Debugger.cpp
+++ b/lldb/source/Core/Debugger.cpp
@@ -21,12 +21,14 @@
 #include "lldb/Core/Telemetry.h"
 #include "lldb/DataFormatters/DataVisualization.h"
 #include "lldb/Expression/REPL.h"
+#include "lldb/Host/Config.h"
 #include "lldb/Host/File.h"
 #include "lldb/Host/FileSystem.h"
 #include "lldb/Host/HostInfo.h"
 #include "lldb/Host/StreamFile.h"
 #include "lldb/Host/Terminal.h"
 #include "lldb/Host/ThreadLauncher.h"
+#include "lldb/Host/XML.h"
 #include "lldb/Interpreter/CommandInterpreter.h"
 #include "lldb/Interpreter/CommandReturnObject.h"
 #include "lldb/Interpreter/OptionValue.h"
@@ -2442,3 +2444,56 @@ llvm::ThreadPoolInterface &Debugger::GetThreadPool() {
  "Debugger::GetThreadPool called before Debugger::Initialize");
   return *g_thread_pool;
 }
+

[Lldb-commits] [lldb] [lldb-dap] Migrate pause request to structured types (PR #171096)

2025-12-08 Thread Jonas Devlieghere via lldb-commits

https://github.com/JDevlieghere approved this pull request.


https://github.com/llvm/llvm-project/pull/171096
___
lldb-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [lldb] [lldb] Dump build configuration with `version -v` (PR #170772)

2025-12-08 Thread Jonas Devlieghere via lldb-commits


@@ -8,21 +8,71 @@
 
 #include "CommandObjectVersion.h"
 
+#include "lldb/Core/Debugger.h"
 #include "lldb/Interpreter/CommandReturnObject.h"
 #include "lldb/Version/Version.h"
 
 using namespace lldb;
 using namespace lldb_private;
 
-// CommandObjectVersion
+#define LLDB_OPTIONS_version
+#include "CommandOptions.inc"
+
+llvm::ArrayRef
+CommandObjectVersion::CommandOptions::GetDefinitions() {
+  return llvm::ArrayRef(g_version_options);
+}
 
 CommandObjectVersion::CommandObjectVersion(CommandInterpreter &interpreter)
 : CommandObjectParsed(interpreter, "version",
   "Show the LLDB debugger version.", "version") {}
 
 CommandObjectVersion::~CommandObjectVersion() = default;
 
+// Dump the array values on a single line.
+static void dump(const StructuredData::Array &array, Stream &s) {
+  s << '[';
+
+  bool add_separator = false;
+  array.ForEach([&](StructuredData::Object *object) -> bool {
+if (add_separator)
+  s << ", ";
+s << object->GetStringValue();
+add_separator = true;
+return true;

JDevlieghere wrote:

I considered it and was on the fence, but I think the resulting code looks 
marginally better.

https://github.com/llvm/llvm-project/pull/170772
___
lldb-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [lldb] bc9f96a - [lldb] Dump build configuration with `version -v` (#170772)

2025-12-08 Thread via lldb-commits

Author: Jonas Devlieghere
Date: 2025-12-08T10:11:39-08:00
New Revision: bc9f96a5e62d0b89588092343d137995811a9b80

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

LOG: [lldb] Dump build configuration with `version -v` (#170772)

Add a verbose option to the version command and include the "build
configuration" in the command output. This allows users to quickly
identify if their version of LLDB was built with support for
xml/curl/python/lua etc. This data is already available through the SB
API using SBDebugger::GetBuildConfiguration, but this makes it more
discoverable.

```
(lldb) version -v
lldb version 22.0.0git ([email protected]:llvm/llvm-project.git revision 
21a2aac5e5456f9181384406f3b3fcad621a7076)
  clang revision 21a2aac5e5456f9181384406f3b3fcad621a7076
  llvm revision 21a2aac5e5456f9181384406f3b3fcad621a7076
  editline_wchar: yes
  lzma: yes
  curses: yes
  editline: yes
  fbsdvmcore: yes
  xml: yes
  lua: yes
  python: yes
  targets: [AArch64, AMDGPU, ARM, AVR, BPF, Hexagon, Lanai, LoongArch, Mips, 
MSP430, NVPTX, PowerPC, RISCV, Sparc, SPIRV, SystemZ, VE, WebAssembly, X86, 
XCore]
  curl: yes
```

Resolves #170727

Added: 
lldb/test/Shell/Commands/command-version.test

Modified: 
lldb/include/lldb/Core/Debugger.h
lldb/source/API/SBDebugger.cpp
lldb/source/Commands/CommandObjectVersion.cpp
lldb/source/Commands/CommandObjectVersion.h
lldb/source/Commands/Options.td
lldb/source/Core/Debugger.cpp

Removed: 




diff  --git a/lldb/include/lldb/Core/Debugger.h 
b/lldb/include/lldb/Core/Debugger.h
index ead2ed35fadd4..a39413c06340c 100644
--- a/lldb/include/lldb/Core/Debugger.h
+++ b/lldb/include/lldb/Core/Debugger.h
@@ -107,6 +107,9 @@ class Debugger : public 
std::enable_shared_from_this,
 
   static void Destroy(lldb::DebuggerSP &debugger_sp);
 
+  /// Get the build configuration as structured data.
+  static StructuredData::DictionarySP GetBuildConfiguration();
+
   static lldb::DebuggerSP FindDebuggerWithID(lldb::user_id_t id);
 
   static lldb::DebuggerSP

diff  --git a/lldb/source/API/SBDebugger.cpp b/lldb/source/API/SBDebugger.cpp
index f939955ba57c8..3f34e7acb0673 100644
--- a/lldb/source/API/SBDebugger.cpp
+++ b/lldb/source/API/SBDebugger.cpp
@@ -709,61 +709,11 @@ const char *SBDebugger::StateAsCString(StateType state) {
   return lldb_private::StateAsCString(state);
 }
 
-static void AddBoolConfigEntry(StructuredData::Dictionary &dict,
-   llvm::StringRef name, bool value,
-   llvm::StringRef description) {
-  auto entry_up = std::make_unique();
-  entry_up->AddBooleanItem("value", value);
-  entry_up->AddStringItem("description", description);
-  dict.AddItem(name, std::move(entry_up));
-}
-
-static void AddLLVMTargets(StructuredData::Dictionary &dict) {
-  auto array_up = std::make_unique();
-#define LLVM_TARGET(target)
\
-  array_up->AddItem(std::make_unique(#target));
-#include "llvm/Config/Targets.def"
-  auto entry_up = std::make_unique();
-  entry_up->AddItem("value", std::move(array_up));
-  entry_up->AddStringItem("description", "A list of configured LLVM targets.");
-  dict.AddItem("targets", std::move(entry_up));
-}
-
 SBStructuredData SBDebugger::GetBuildConfiguration() {
   LLDB_INSTRUMENT();
 
-  auto config_up = std::make_unique();
-  AddBoolConfigEntry(
-  *config_up, "xml", XMLDocument::XMLEnabled(),
-  "A boolean value that indicates if XML support is enabled in LLDB");
-  AddBoolConfigEntry(
-  *config_up, "curl", LLVM_ENABLE_CURL,
-  "A boolean value that indicates if CURL support is enabled in LLDB");
-  AddBoolConfigEntry(
-  *config_up, "curses", LLDB_ENABLE_CURSES,
-  "A boolean value that indicates if curses support is enabled in LLDB");
-  AddBoolConfigEntry(
-  *config_up, "editline", LLDB_ENABLE_LIBEDIT,
-  "A boolean value that indicates if editline support is enabled in LLDB");
-  AddBoolConfigEntry(*config_up, "editline_wchar", LLDB_EDITLINE_USE_WCHAR,
- "A boolean value that indicates if editline wide "
- "characters support is enabled in LLDB");
-  AddBoolConfigEntry(
-  *config_up, "lzma", LLDB_ENABLE_LZMA,
-  "A boolean value that indicates if lzma support is enabled in LLDB");
-  AddBoolConfigEntry(
-  *config_up, "python", LLDB_ENABLE_PYTHON,
-  "A boolean value that indicates if python support is enabled in LLDB");
-  AddBoolConfigEntry(
-  *config_up, "lua", LLDB_ENABLE_LUA,
-  "A boolean value that indicates if lua support is enabled in LLDB");
-  AddBoolConfigEntry(*config_up, "fbsdvmcore", LLDB_ENABLE_FBSDVMCORE,
- "A boolean value that indicates if fbsdvmcore support is "
-

[Lldb-commits] [lldb] [lldb] Dump build configuration with `version -v` (PR #170772)

2025-12-08 Thread Jonas Devlieghere via lldb-commits

https://github.com/JDevlieghere closed 
https://github.com/llvm/llvm-project/pull/170772
___
lldb-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [lldb] [lldb-dap] Migrate locations request to structured types (PR #171099)

2025-12-08 Thread Ebuka Ezike via lldb-commits


@@ -1184,6 +1184,41 @@ struct EvaluateResponseBody {
 };
 llvm::json::Value toJSON(const EvaluateResponseBody &);
 
+/// Arguments for `locations` request.
+struct LocationsArguments {
+  /// Location reference to resolve.
+  uint64_t locationReference = LLDB_DAP_INVALID_VALUE_LOC;
+};
+bool fromJSON(const llvm::json::Value &, LocationsArguments &,
+  llvm::json::Path);
+
+/// Response to 'locations' request.
+struct LocationsResponseBody {
+  /// The source containing the location; either `source.path` or
+  /// `source.sourceReference` must be specified.
+  Source source;
+
+  /// The line number of the location. The client capability `linesStartAt1`
+  /// determines whether it is 0- or 1-based.
+  uint32_t line = 0;

da-viper wrote:

```suggestion
  uint32_t line = LLDB_INVALID_LINE_NUMBER;
```

https://github.com/llvm/llvm-project/pull/171099
___
lldb-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [lldb] [lldb-dap] Migrate locations request to structured types (PR #171099)

2025-12-08 Thread Ebuka Ezike via lldb-commits


@@ -18,167 +19,64 @@
 
 namespace lldb_dap {
 
-// "LocationsRequest": {
-//   "allOf": [ { "$ref": "#/definitions/Request" }, {
-// "type": "object",
-// "description": "Looks up information about a location reference
-// previously returned by the debug adapter.",
-// "properties": {
-//   "command": {
-// "type": "string",
-// "enum": [ "locations" ]
-//   },
-//   "arguments": {
-// "$ref": "#/definitions/LocationsArguments"
-//   }
-// },
-// "required": [ "command", "arguments" ]
-//   }]
-// },
-// "LocationsArguments": {
-//   "type": "object",
-//   "description": "Arguments for `locations` request.",
-//   "properties": {
-// "locationReference": {
-//   "type": "integer",
-//   "description": "Location reference to resolve."
-// }
-//   },
-//   "required": [ "locationReference" ]
-// },
-// "LocationsResponse": {
-//   "allOf": [ { "$ref": "#/definitions/Response" }, {
-// "type": "object",
-// "description": "Response to `locations` request.",
-// "properties": {
-//   "body": {
-// "type": "object",
-// "properties": {
-//   "source": {
-// "$ref": "#/definitions/Source",
-// "description": "The source containing the location; either
-// `source.path` or `source.sourceReference` must 
be
-// specified."
-//   },
-//   "line": {
-// "type": "integer",
-// "description": "The line number of the location. The client
-// capability `linesStartAt1` determines whether it
-// is 0- or 1-based."
-//   },
-//   "column": {
-// "type": "integer",
-// "description": "Position of the location within the `line`. It 
is
-// measured in UTF-16 code units and the client
-// capability `columnsStartAt1` determines whether
-// it is 0- or 1-based. If no column is given, the
-// first position in the start line is assumed."
-//   },
-//   "endLine": {
-// "type": "integer",
-// "description": "End line of the location, present if the 
location
-// refers to a range.  The client capability
-// `linesStartAt1` determines whether it is 0- or
-// 1-based."
-//   },
-//   "endColumn": {
-// "type": "integer",
-// "description": "End position of the location within `endLine`,
-// present if the location refers to a range. It is
-// measured in UTF-16 code units and the client
-// capability `columnsStartAt1` determines whether
-// it is 0- or 1-based."
-//   }
-// },
-// "required": [ "source", "line" ]
-//   }
-// }
-//   }]
-// },
-void LocationsRequestHandler::operator()(
-const llvm::json::Object &request) const {
-  llvm::json::Object response;
-  FillResponse(request, response);
-  auto *arguments = request.getObject("arguments");
-
-  const auto location_id =
-  GetInteger(arguments, "locationReference").value_or(0);
+// Looks up information about a location reference previously returned by the
+// debug adapter.
+llvm::Expected
+LocationsRequestHandler::Run(const protocol::LocationsArguments &args) const {
+  protocol::LocationsResponseBody response;
   // We use the lowest bit to distinguish between value location and 
declaration
   // location
-  auto [var_ref, is_value_location] = UnpackLocation(location_id);
+  auto [var_ref, is_value_location] = UnpackLocation(args.locationReference);
   lldb::SBValue variable = dap.variables.GetVariable(var_ref);
-  if (!variable.IsValid()) {
-response["success"] = false;
-response["message"] = "Invalid variable reference";
-dap.SendJSON(llvm::json::Value(std::move(response)));
-return;
-  }
+  if (!variable.IsValid())
+return llvm::make_error("Invalid variable reference");
 
-  llvm::json::Object body;
   if (is_value_location) {
 // Get the value location
 if (!variable.GetType().IsPointerType() &&
-!variable.GetType().IsReferenceType()) {
-  response["success"] = false;
-  response["message"] =
-  "Value locations are only available for pointers and references";
-  dap.SendJSON(llvm::json::Value(std::move(response)));
-  return;
-}
+!variable.GetType().IsReferenceType())
+  return llvm::make_error(
+  "Value locations are only available for pointers and references");
 
 lldb::addr_t raw_addr = variable.GetValueAsAddress();
 lldb::SBAddress addr = dap.target.ResolveLoadAddress(raw_addr);
 l

[Lldb-commits] [lldb] [lldb-dap] Migrate locations request to structured types (PR #171099)

2025-12-08 Thread Ebuka Ezike via lldb-commits


@@ -18,167 +19,64 @@
 
 namespace lldb_dap {
 
-// "LocationsRequest": {
-//   "allOf": [ { "$ref": "#/definitions/Request" }, {
-// "type": "object",
-// "description": "Looks up information about a location reference
-// previously returned by the debug adapter.",
-// "properties": {
-//   "command": {
-// "type": "string",
-// "enum": [ "locations" ]
-//   },
-//   "arguments": {
-// "$ref": "#/definitions/LocationsArguments"
-//   }
-// },
-// "required": [ "command", "arguments" ]
-//   }]
-// },
-// "LocationsArguments": {
-//   "type": "object",
-//   "description": "Arguments for `locations` request.",
-//   "properties": {
-// "locationReference": {
-//   "type": "integer",
-//   "description": "Location reference to resolve."
-// }
-//   },
-//   "required": [ "locationReference" ]
-// },
-// "LocationsResponse": {
-//   "allOf": [ { "$ref": "#/definitions/Response" }, {
-// "type": "object",
-// "description": "Response to `locations` request.",
-// "properties": {
-//   "body": {
-// "type": "object",
-// "properties": {
-//   "source": {
-// "$ref": "#/definitions/Source",
-// "description": "The source containing the location; either
-// `source.path` or `source.sourceReference` must 
be
-// specified."
-//   },
-//   "line": {
-// "type": "integer",
-// "description": "The line number of the location. The client
-// capability `linesStartAt1` determines whether it
-// is 0- or 1-based."
-//   },
-//   "column": {
-// "type": "integer",
-// "description": "Position of the location within the `line`. It 
is
-// measured in UTF-16 code units and the client
-// capability `columnsStartAt1` determines whether
-// it is 0- or 1-based. If no column is given, the
-// first position in the start line is assumed."
-//   },
-//   "endLine": {
-// "type": "integer",
-// "description": "End line of the location, present if the 
location
-// refers to a range.  The client capability
-// `linesStartAt1` determines whether it is 0- or
-// 1-based."
-//   },
-//   "endColumn": {
-// "type": "integer",
-// "description": "End position of the location within `endLine`,
-// present if the location refers to a range. It is
-// measured in UTF-16 code units and the client
-// capability `columnsStartAt1` determines whether
-// it is 0- or 1-based."
-//   }
-// },
-// "required": [ "source", "line" ]
-//   }
-// }
-//   }]
-// },
-void LocationsRequestHandler::operator()(
-const llvm::json::Object &request) const {
-  llvm::json::Object response;
-  FillResponse(request, response);
-  auto *arguments = request.getObject("arguments");
-
-  const auto location_id =
-  GetInteger(arguments, "locationReference").value_or(0);
+// Looks up information about a location reference previously returned by the
+// debug adapter.
+llvm::Expected
+LocationsRequestHandler::Run(const protocol::LocationsArguments &args) const {
+  protocol::LocationsResponseBody response;
   // We use the lowest bit to distinguish between value location and 
declaration
   // location
-  auto [var_ref, is_value_location] = UnpackLocation(location_id);
+  auto [var_ref, is_value_location] = UnpackLocation(args.locationReference);
   lldb::SBValue variable = dap.variables.GetVariable(var_ref);
-  if (!variable.IsValid()) {
-response["success"] = false;
-response["message"] = "Invalid variable reference";
-dap.SendJSON(llvm::json::Value(std::move(response)));
-return;
-  }
+  if (!variable.IsValid())
+return llvm::make_error("Invalid variable reference");
 
-  llvm::json::Object body;
   if (is_value_location) {
 // Get the value location
 if (!variable.GetType().IsPointerType() &&
-!variable.GetType().IsReferenceType()) {
-  response["success"] = false;
-  response["message"] =
-  "Value locations are only available for pointers and references";
-  dap.SendJSON(llvm::json::Value(std::move(response)));
-  return;
-}
+!variable.GetType().IsReferenceType())
+  return llvm::make_error(
+  "Value locations are only available for pointers and references");
 
 lldb::addr_t raw_addr = variable.GetValueAsAddress();
 lldb::SBAddress addr = dap.target.ResolveLoadAddress(raw_addr);
 l

[Lldb-commits] [lldb] [lldb-dap] Migrate locations request to structured types (PR #171099)

2025-12-08 Thread Ebuka Ezike via lldb-commits


@@ -18,167 +19,64 @@
 
 namespace lldb_dap {
 
-// "LocationsRequest": {
-//   "allOf": [ { "$ref": "#/definitions/Request" }, {
-// "type": "object",
-// "description": "Looks up information about a location reference
-// previously returned by the debug adapter.",
-// "properties": {
-//   "command": {
-// "type": "string",
-// "enum": [ "locations" ]
-//   },
-//   "arguments": {
-// "$ref": "#/definitions/LocationsArguments"
-//   }
-// },
-// "required": [ "command", "arguments" ]
-//   }]
-// },
-// "LocationsArguments": {
-//   "type": "object",
-//   "description": "Arguments for `locations` request.",
-//   "properties": {
-// "locationReference": {
-//   "type": "integer",
-//   "description": "Location reference to resolve."
-// }
-//   },
-//   "required": [ "locationReference" ]
-// },
-// "LocationsResponse": {
-//   "allOf": [ { "$ref": "#/definitions/Response" }, {
-// "type": "object",
-// "description": "Response to `locations` request.",
-// "properties": {
-//   "body": {
-// "type": "object",
-// "properties": {
-//   "source": {
-// "$ref": "#/definitions/Source",
-// "description": "The source containing the location; either
-// `source.path` or `source.sourceReference` must 
be
-// specified."
-//   },
-//   "line": {
-// "type": "integer",
-// "description": "The line number of the location. The client
-// capability `linesStartAt1` determines whether it
-// is 0- or 1-based."
-//   },
-//   "column": {
-// "type": "integer",
-// "description": "Position of the location within the `line`. It 
is
-// measured in UTF-16 code units and the client
-// capability `columnsStartAt1` determines whether
-// it is 0- or 1-based. If no column is given, the
-// first position in the start line is assumed."
-//   },
-//   "endLine": {
-// "type": "integer",
-// "description": "End line of the location, present if the 
location
-// refers to a range.  The client capability
-// `linesStartAt1` determines whether it is 0- or
-// 1-based."
-//   },
-//   "endColumn": {
-// "type": "integer",
-// "description": "End position of the location within `endLine`,
-// present if the location refers to a range. It is
-// measured in UTF-16 code units and the client
-// capability `columnsStartAt1` determines whether
-// it is 0- or 1-based."
-//   }
-// },
-// "required": [ "source", "line" ]
-//   }
-// }
-//   }]
-// },
-void LocationsRequestHandler::operator()(
-const llvm::json::Object &request) const {
-  llvm::json::Object response;
-  FillResponse(request, response);
-  auto *arguments = request.getObject("arguments");
-
-  const auto location_id =
-  GetInteger(arguments, "locationReference").value_or(0);
+// Looks up information about a location reference previously returned by the
+// debug adapter.
+llvm::Expected
+LocationsRequestHandler::Run(const protocol::LocationsArguments &args) const {
+  protocol::LocationsResponseBody response;
   // We use the lowest bit to distinguish between value location and 
declaration
   // location
-  auto [var_ref, is_value_location] = UnpackLocation(location_id);
+  auto [var_ref, is_value_location] = UnpackLocation(args.locationReference);
   lldb::SBValue variable = dap.variables.GetVariable(var_ref);
-  if (!variable.IsValid()) {
-response["success"] = false;
-response["message"] = "Invalid variable reference";
-dap.SendJSON(llvm::json::Value(std::move(response)));
-return;
-  }
+  if (!variable.IsValid())
+return llvm::make_error("Invalid variable reference");
 
-  llvm::json::Object body;
   if (is_value_location) {
 // Get the value location
 if (!variable.GetType().IsPointerType() &&
-!variable.GetType().IsReferenceType()) {
-  response["success"] = false;
-  response["message"] =
-  "Value locations are only available for pointers and references";
-  dap.SendJSON(llvm::json::Value(std::move(response)));
-  return;
-}
+!variable.GetType().IsReferenceType())
+  return llvm::make_error(
+  "Value locations are only available for pointers and references");
 
 lldb::addr_t raw_addr = variable.GetValueAsAddress();
 lldb::SBAddress addr = dap.target.ResolveLoadAddress(raw_addr);
 l

[Lldb-commits] [lldb] [lldb-dap] Migrate locations request to structured types (PR #171099)

2025-12-08 Thread Ebuka Ezike via lldb-commits


@@ -18,167 +19,64 @@
 
 namespace lldb_dap {
 
-// "LocationsRequest": {
-//   "allOf": [ { "$ref": "#/definitions/Request" }, {
-// "type": "object",
-// "description": "Looks up information about a location reference
-// previously returned by the debug adapter.",
-// "properties": {
-//   "command": {
-// "type": "string",
-// "enum": [ "locations" ]
-//   },
-//   "arguments": {
-// "$ref": "#/definitions/LocationsArguments"
-//   }
-// },
-// "required": [ "command", "arguments" ]
-//   }]
-// },
-// "LocationsArguments": {
-//   "type": "object",
-//   "description": "Arguments for `locations` request.",
-//   "properties": {
-// "locationReference": {
-//   "type": "integer",
-//   "description": "Location reference to resolve."
-// }
-//   },
-//   "required": [ "locationReference" ]
-// },
-// "LocationsResponse": {
-//   "allOf": [ { "$ref": "#/definitions/Response" }, {
-// "type": "object",
-// "description": "Response to `locations` request.",
-// "properties": {
-//   "body": {
-// "type": "object",
-// "properties": {
-//   "source": {
-// "$ref": "#/definitions/Source",
-// "description": "The source containing the location; either
-// `source.path` or `source.sourceReference` must 
be
-// specified."
-//   },
-//   "line": {
-// "type": "integer",
-// "description": "The line number of the location. The client
-// capability `linesStartAt1` determines whether it
-// is 0- or 1-based."
-//   },
-//   "column": {
-// "type": "integer",
-// "description": "Position of the location within the `line`. It 
is
-// measured in UTF-16 code units and the client
-// capability `columnsStartAt1` determines whether
-// it is 0- or 1-based. If no column is given, the
-// first position in the start line is assumed."
-//   },
-//   "endLine": {
-// "type": "integer",
-// "description": "End line of the location, present if the 
location
-// refers to a range.  The client capability
-// `linesStartAt1` determines whether it is 0- or
-// 1-based."
-//   },
-//   "endColumn": {
-// "type": "integer",
-// "description": "End position of the location within `endLine`,
-// present if the location refers to a range. It is
-// measured in UTF-16 code units and the client
-// capability `columnsStartAt1` determines whether
-// it is 0- or 1-based."
-//   }
-// },
-// "required": [ "source", "line" ]
-//   }
-// }
-//   }]
-// },
-void LocationsRequestHandler::operator()(
-const llvm::json::Object &request) const {
-  llvm::json::Object response;
-  FillResponse(request, response);
-  auto *arguments = request.getObject("arguments");
-
-  const auto location_id =
-  GetInteger(arguments, "locationReference").value_or(0);
+// Looks up information about a location reference previously returned by the
+// debug adapter.
+llvm::Expected
+LocationsRequestHandler::Run(const protocol::LocationsArguments &args) const {
+  protocol::LocationsResponseBody response;
   // We use the lowest bit to distinguish between value location and 
declaration
   // location
-  auto [var_ref, is_value_location] = UnpackLocation(location_id);
+  auto [var_ref, is_value_location] = UnpackLocation(args.locationReference);
   lldb::SBValue variable = dap.variables.GetVariable(var_ref);
-  if (!variable.IsValid()) {
-response["success"] = false;
-response["message"] = "Invalid variable reference";
-dap.SendJSON(llvm::json::Value(std::move(response)));
-return;
-  }
+  if (!variable.IsValid())
+return llvm::make_error("Invalid variable reference");
 
-  llvm::json::Object body;
   if (is_value_location) {
 // Get the value location
 if (!variable.GetType().IsPointerType() &&
-!variable.GetType().IsReferenceType()) {
-  response["success"] = false;
-  response["message"] =
-  "Value locations are only available for pointers and references";
-  dap.SendJSON(llvm::json::Value(std::move(response)));
-  return;
-}
+!variable.GetType().IsReferenceType())
+  return llvm::make_error(
+  "Value locations are only available for pointers and references");
 
 lldb::addr_t raw_addr = variable.GetValueAsAddress();
 lldb::SBAddress addr = dap.target.ResolveLoadAddress(raw_addr);
 l

[Lldb-commits] [lldb] [lldb-dap] Migrate locations request to structured types (PR #171099)

2025-12-08 Thread Ebuka Ezike via lldb-commits


@@ -1184,6 +1184,41 @@ struct EvaluateResponseBody {
 };
 llvm::json::Value toJSON(const EvaluateResponseBody &);
 
+/// Arguments for `locations` request.
+struct LocationsArguments {
+  /// Location reference to resolve.
+  uint64_t locationReference = LLDB_DAP_INVALID_VALUE_LOC;
+};
+bool fromJSON(const llvm::json::Value &, LocationsArguments &,
+  llvm::json::Path);
+
+/// Response to 'locations' request.
+struct LocationsResponseBody {
+  /// The source containing the location; either `source.path` or
+  /// `source.sourceReference` must be specified.
+  Source source;
+
+  /// The line number of the location. The client capability `linesStartAt1`
+  /// determines whether it is 0- or 1-based.
+  uint32_t line = 0;
+
+  /// Position of the location within the `line`. It is measured in UTF-16 code
+  /// units and the client capability `columnsStartAt1` determines whether it 
is
+  /// 0- or 1-based. If no column is given, the first position in the start 
line
+  /// is assumed.
+  std::optional column;

da-viper wrote:

to the optional types, could we use the `uint32_t` directly and check for 
`LLDB_INVALID_*` and 0  during the `toJSON` 

https://github.com/llvm/llvm-project/pull/171099
___
lldb-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [lldb] [lldb-dap] Increase DAP default timeout (PR #170890)

2025-12-08 Thread Sergei Druzhkov via lldb-commits

https://github.com/DrSergei approved this pull request.


https://github.com/llvm/llvm-project/pull/170890
___
lldb-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [lldb] [lldb-dap] Migrate pause request to structured types (PR #171096)

2025-12-08 Thread Sergei Druzhkov via lldb-commits

https://github.com/DrSergei created 
https://github.com/llvm/llvm-project/pull/171096

This patch migrates `pause` request into structured types and adds test for it.

>From 679bb3f40b7c8961841b8d73bae0c8fa7e8cd904 Mon Sep 17 00:00:00 2001
From: Druzhkov Sergei 
Date: Sun, 7 Dec 2025 13:55:04 +0300
Subject: [PATCH] [lldb-dap] Migrate pause request to structured types

---
 .../lldb-dap/Handler/PauseRequestHandler.cpp  | 48 +++
 lldb/tools/lldb-dap/Handler/RequestHandler.h  |  7 +--
 .../lldb-dap/Protocol/ProtocolRequests.cpp|  6 +++
 .../lldb-dap/Protocol/ProtocolRequests.h  | 11 +
 lldb/unittests/DAP/ProtocolRequestsTest.cpp   | 11 +
 5 files changed, 39 insertions(+), 44 deletions(-)

diff --git a/lldb/tools/lldb-dap/Handler/PauseRequestHandler.cpp 
b/lldb/tools/lldb-dap/Handler/PauseRequestHandler.cpp
index 99917b2e28223..1589c7c1142e9 100644
--- a/lldb/tools/lldb-dap/Handler/PauseRequestHandler.cpp
+++ b/lldb/tools/lldb-dap/Handler/PauseRequestHandler.cpp
@@ -8,53 +8,19 @@
 
 #include "DAP.h"
 #include "EventHelper.h"
-#include "JSONUtils.h"
+#include "Protocol/ProtocolRequests.h"
 #include "RequestHandler.h"
 
 namespace lldb_dap {
 
-// "PauseRequest": {
-//   "allOf": [ { "$ref": "#/definitions/Request" }, {
-// "type": "object",
-// "description": "Pause request; value of command field is 'pause'. The
-// request suspenses the debuggee. The debug adapter first sends the
-// PauseResponse and then a StoppedEvent (event type 'pause') after the
-// thread has been paused successfully.", "properties": {
-//   "command": {
-// "type": "string",
-// "enum": [ "pause" ]
-//   },
-//   "arguments": {
-// "$ref": "#/definitions/PauseArguments"
-//   }
-// },
-// "required": [ "command", "arguments"  ]
-//   }]
-// },
-// "PauseArguments": {
-//   "type": "object",
-//   "description": "Arguments for 'pause' request.",
-//   "properties": {
-// "threadId": {
-//   "type": "integer",
-//   "description": "Pause execution for this thread."
-// }
-//   },
-//   "required": [ "threadId" ]
-// },
-// "PauseResponse": {
-//   "allOf": [ { "$ref": "#/definitions/Response" }, {
-// "type": "object",
-// "description": "Response to 'pause' request. This is just an
-// acknowledgement, so no body field is required."
-//   }]
-// }
-void PauseRequestHandler::operator()(const llvm::json::Object &request) const {
-  llvm::json::Object response;
-  FillResponse(request, response);
+/// The request suspenses the debuggee. The debug adapter first sends the
+/// PauseResponse and then a StoppedEvent (event type 'pause') after the thread
+/// has been paused successfully.
+llvm::Error
+PauseRequestHandler::Run(const protocol::PauseArguments &args) const {
   lldb::SBProcess process = dap.target.GetProcess();
   lldb::SBError error = process.Stop();
-  dap.SendJSON(llvm::json::Value(std::move(response)));
+  return llvm::Error::success();
 }
 
 } // namespace lldb_dap
diff --git a/lldb/tools/lldb-dap/Handler/RequestHandler.h 
b/lldb/tools/lldb-dap/Handler/RequestHandler.h
index 5d235352b7738..fdce33de3f680 100644
--- a/lldb/tools/lldb-dap/Handler/RequestHandler.h
+++ b/lldb/tools/lldb-dap/Handler/RequestHandler.h
@@ -492,11 +492,12 @@ class ModulesRequestHandler final
   Run(const std::optional &args) const override;
 };
 
-class PauseRequestHandler : public LegacyRequestHandler {
+class PauseRequestHandler
+: public RequestHandler 
{
 public:
-  using LegacyRequestHandler::LegacyRequestHandler;
+  using RequestHandler::RequestHandler;
   static llvm::StringLiteral GetCommand() { return "pause"; }
-  void operator()(const llvm::json::Object &request) const override;
+  llvm::Error Run(const protocol::PauseArguments &args) const override;
 };
 
 class ScopesRequestHandler final
diff --git a/lldb/tools/lldb-dap/Protocol/ProtocolRequests.cpp 
b/lldb/tools/lldb-dap/Protocol/ProtocolRequests.cpp
index 0a1d580bffd68..95ecc7e4e7e40 100644
--- a/lldb/tools/lldb-dap/Protocol/ProtocolRequests.cpp
+++ b/lldb/tools/lldb-dap/Protocol/ProtocolRequests.cpp
@@ -695,4 +695,10 @@ llvm::json::Value toJSON(const EvaluateResponseBody &Body) 
{
   return result;
 }
 
+bool fromJSON(const llvm::json::Value &Params, PauseArguments &Args,
+  llvm::json::Path Path) {
+  json::ObjectMapper O(Params, Path);
+  return O && O.map("threadId", Args.threadId);
+}
+
 } // namespace lldb_dap::protocol
diff --git a/lldb/tools/lldb-dap/Protocol/ProtocolRequests.h 
b/lldb/tools/lldb-dap/Protocol/ProtocolRequests.h
index 6a85033ae7ef2..dc84e90ae03b4 100644
--- a/lldb/tools/lldb-dap/Protocol/ProtocolRequests.h
+++ b/lldb/tools/lldb-dap/Protocol/ProtocolRequests.h
@@ -1184,6 +1184,17 @@ struct EvaluateResponseBody {
 };
 llvm::json::Value toJSON(const EvaluateResponseBody &);
 
+/// Arguments for `pause` request.
+struct PauseArguments {
+  /// Pause execution for this thread.
+  lldb::tid_t threadId = LLDB_INVALID_THREAD_ID

[Lldb-commits] [lldb] [lldb-dap] Migrate pause request to structured types (PR #171096)

2025-12-08 Thread via lldb-commits

llvmbot wrote:




@llvm/pr-subscribers-lldb

Author: Sergei Druzhkov (DrSergei)


Changes

This patch migrates `pause` request into structured types and adds test for it.

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


5 Files Affected:

- (modified) lldb/tools/lldb-dap/Handler/PauseRequestHandler.cpp (+7-41) 
- (modified) lldb/tools/lldb-dap/Handler/RequestHandler.h (+4-3) 
- (modified) lldb/tools/lldb-dap/Protocol/ProtocolRequests.cpp (+6) 
- (modified) lldb/tools/lldb-dap/Protocol/ProtocolRequests.h (+11) 
- (modified) lldb/unittests/DAP/ProtocolRequestsTest.cpp (+11) 


``diff
diff --git a/lldb/tools/lldb-dap/Handler/PauseRequestHandler.cpp 
b/lldb/tools/lldb-dap/Handler/PauseRequestHandler.cpp
index 99917b2e28223..1589c7c1142e9 100644
--- a/lldb/tools/lldb-dap/Handler/PauseRequestHandler.cpp
+++ b/lldb/tools/lldb-dap/Handler/PauseRequestHandler.cpp
@@ -8,53 +8,19 @@
 
 #include "DAP.h"
 #include "EventHelper.h"
-#include "JSONUtils.h"
+#include "Protocol/ProtocolRequests.h"
 #include "RequestHandler.h"
 
 namespace lldb_dap {
 
-// "PauseRequest": {
-//   "allOf": [ { "$ref": "#/definitions/Request" }, {
-// "type": "object",
-// "description": "Pause request; value of command field is 'pause'. The
-// request suspenses the debuggee. The debug adapter first sends the
-// PauseResponse and then a StoppedEvent (event type 'pause') after the
-// thread has been paused successfully.", "properties": {
-//   "command": {
-// "type": "string",
-// "enum": [ "pause" ]
-//   },
-//   "arguments": {
-// "$ref": "#/definitions/PauseArguments"
-//   }
-// },
-// "required": [ "command", "arguments"  ]
-//   }]
-// },
-// "PauseArguments": {
-//   "type": "object",
-//   "description": "Arguments for 'pause' request.",
-//   "properties": {
-// "threadId": {
-//   "type": "integer",
-//   "description": "Pause execution for this thread."
-// }
-//   },
-//   "required": [ "threadId" ]
-// },
-// "PauseResponse": {
-//   "allOf": [ { "$ref": "#/definitions/Response" }, {
-// "type": "object",
-// "description": "Response to 'pause' request. This is just an
-// acknowledgement, so no body field is required."
-//   }]
-// }
-void PauseRequestHandler::operator()(const llvm::json::Object &request) const {
-  llvm::json::Object response;
-  FillResponse(request, response);
+/// The request suspenses the debuggee. The debug adapter first sends the
+/// PauseResponse and then a StoppedEvent (event type 'pause') after the thread
+/// has been paused successfully.
+llvm::Error
+PauseRequestHandler::Run(const protocol::PauseArguments &args) const {
   lldb::SBProcess process = dap.target.GetProcess();
   lldb::SBError error = process.Stop();
-  dap.SendJSON(llvm::json::Value(std::move(response)));
+  return llvm::Error::success();
 }
 
 } // namespace lldb_dap
diff --git a/lldb/tools/lldb-dap/Handler/RequestHandler.h 
b/lldb/tools/lldb-dap/Handler/RequestHandler.h
index 5d235352b7738..fdce33de3f680 100644
--- a/lldb/tools/lldb-dap/Handler/RequestHandler.h
+++ b/lldb/tools/lldb-dap/Handler/RequestHandler.h
@@ -492,11 +492,12 @@ class ModulesRequestHandler final
   Run(const std::optional &args) const override;
 };
 
-class PauseRequestHandler : public LegacyRequestHandler {
+class PauseRequestHandler
+: public RequestHandler 
{
 public:
-  using LegacyRequestHandler::LegacyRequestHandler;
+  using RequestHandler::RequestHandler;
   static llvm::StringLiteral GetCommand() { return "pause"; }
-  void operator()(const llvm::json::Object &request) const override;
+  llvm::Error Run(const protocol::PauseArguments &args) const override;
 };
 
 class ScopesRequestHandler final
diff --git a/lldb/tools/lldb-dap/Protocol/ProtocolRequests.cpp 
b/lldb/tools/lldb-dap/Protocol/ProtocolRequests.cpp
index 0a1d580bffd68..95ecc7e4e7e40 100644
--- a/lldb/tools/lldb-dap/Protocol/ProtocolRequests.cpp
+++ b/lldb/tools/lldb-dap/Protocol/ProtocolRequests.cpp
@@ -695,4 +695,10 @@ llvm::json::Value toJSON(const EvaluateResponseBody &Body) 
{
   return result;
 }
 
+bool fromJSON(const llvm::json::Value &Params, PauseArguments &Args,
+  llvm::json::Path Path) {
+  json::ObjectMapper O(Params, Path);
+  return O && O.map("threadId", Args.threadId);
+}
+
 } // namespace lldb_dap::protocol
diff --git a/lldb/tools/lldb-dap/Protocol/ProtocolRequests.h 
b/lldb/tools/lldb-dap/Protocol/ProtocolRequests.h
index 6a85033ae7ef2..dc84e90ae03b4 100644
--- a/lldb/tools/lldb-dap/Protocol/ProtocolRequests.h
+++ b/lldb/tools/lldb-dap/Protocol/ProtocolRequests.h
@@ -1184,6 +1184,17 @@ struct EvaluateResponseBody {
 };
 llvm::json::Value toJSON(const EvaluateResponseBody &);
 
+/// Arguments for `pause` request.
+struct PauseArguments {
+  /// Pause execution for this thread.
+  lldb::tid_t threadId = LLDB_INVALID_THREAD_ID;
+};
+bool fromJSON(const llvm::json::Value &, PauseArguments &, llvm::json::Path);
+
+/// Response to `pa

[Lldb-commits] [lldb] [lldb-dap] Migrate locations request to structured types (PR #171099)

2025-12-08 Thread Sergei Druzhkov via lldb-commits


@@ -1184,6 +1184,41 @@ struct EvaluateResponseBody {
 };
 llvm::json::Value toJSON(const EvaluateResponseBody &);
 
+/// Arguments for `locations` request.
+struct LocationsArguments {
+  /// Location reference to resolve.
+  uint64_t locationReference = LLDB_DAP_INVALID_VALUE_LOC;
+};
+bool fromJSON(const llvm::json::Value &, LocationsArguments &,
+  llvm::json::Path);
+
+/// Response to 'locations' request.
+struct LocationsResponseBody {
+  /// The source containing the location; either `source.path` or
+  /// `source.sourceReference` must be specified.
+  Source source;
+
+  /// The line number of the location. The client capability `linesStartAt1`
+  /// determines whether it is 0- or 1-based.
+  uint32_t line = 0;
+
+  /// Position of the location within the `line`. It is measured in UTF-16 code
+  /// units and the client capability `columnsStartAt1` determines whether it 
is
+  /// 0- or 1-based. If no column is given, the first position in the start 
line
+  /// is assumed.
+  std::optional column;

DrSergei wrote:

It sounds reasonable for me, but we already  use this pattern in `Breakpoint` 
and `DisassembledInstruction`. I can update them in the further MR, if you wish.

https://github.com/llvm/llvm-project/pull/171099
___
lldb-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [lldb] [lldb-dap] Migrate locations request to structured types (PR #171099)

2025-12-08 Thread Sergei Druzhkov via lldb-commits

https://github.com/DrSergei updated 
https://github.com/llvm/llvm-project/pull/171099

>From 5a8427e3a9e515a47d68588d05d6147660c98b2f Mon Sep 17 00:00:00 2001
From: Druzhkov Sergei 
Date: Sun, 7 Dec 2025 17:23:49 +0300
Subject: [PATCH 1/2] [lldb-dap] Migrate locations request to structured types

---
 .../Handler/LocationsRequestHandler.cpp   | 162 --
 lldb/tools/lldb-dap/Handler/RequestHandler.h  |   9 +-
 .../lldb-dap/Protocol/ProtocolRequests.cpp|  19 ++
 .../lldb-dap/Protocol/ProtocolRequests.h  |  35 
 lldb/unittests/DAP/ProtocolRequestsTest.cpp   |  50 ++
 5 files changed, 140 insertions(+), 135 deletions(-)

diff --git a/lldb/tools/lldb-dap/Handler/LocationsRequestHandler.cpp 
b/lldb/tools/lldb-dap/Handler/LocationsRequestHandler.cpp
index cf9b5a3dbd06b..10a6dcf4d8305 100644
--- a/lldb/tools/lldb-dap/Handler/LocationsRequestHandler.cpp
+++ b/lldb/tools/lldb-dap/Handler/LocationsRequestHandler.cpp
@@ -7,6 +7,7 @@
 
//===--===//
 
 #include "DAP.h"
+#include "DAPError.h"
 #include "EventHelper.h"
 #include "JSONUtils.h"
 #include "LLDBUtils.h"
@@ -18,167 +19,64 @@
 
 namespace lldb_dap {
 
-// "LocationsRequest": {
-//   "allOf": [ { "$ref": "#/definitions/Request" }, {
-// "type": "object",
-// "description": "Looks up information about a location reference
-// previously returned by the debug adapter.",
-// "properties": {
-//   "command": {
-// "type": "string",
-// "enum": [ "locations" ]
-//   },
-//   "arguments": {
-// "$ref": "#/definitions/LocationsArguments"
-//   }
-// },
-// "required": [ "command", "arguments" ]
-//   }]
-// },
-// "LocationsArguments": {
-//   "type": "object",
-//   "description": "Arguments for `locations` request.",
-//   "properties": {
-// "locationReference": {
-//   "type": "integer",
-//   "description": "Location reference to resolve."
-// }
-//   },
-//   "required": [ "locationReference" ]
-// },
-// "LocationsResponse": {
-//   "allOf": [ { "$ref": "#/definitions/Response" }, {
-// "type": "object",
-// "description": "Response to `locations` request.",
-// "properties": {
-//   "body": {
-// "type": "object",
-// "properties": {
-//   "source": {
-// "$ref": "#/definitions/Source",
-// "description": "The source containing the location; either
-// `source.path` or `source.sourceReference` must 
be
-// specified."
-//   },
-//   "line": {
-// "type": "integer",
-// "description": "The line number of the location. The client
-// capability `linesStartAt1` determines whether it
-// is 0- or 1-based."
-//   },
-//   "column": {
-// "type": "integer",
-// "description": "Position of the location within the `line`. It 
is
-// measured in UTF-16 code units and the client
-// capability `columnsStartAt1` determines whether
-// it is 0- or 1-based. If no column is given, the
-// first position in the start line is assumed."
-//   },
-//   "endLine": {
-// "type": "integer",
-// "description": "End line of the location, present if the 
location
-// refers to a range.  The client capability
-// `linesStartAt1` determines whether it is 0- or
-// 1-based."
-//   },
-//   "endColumn": {
-// "type": "integer",
-// "description": "End position of the location within `endLine`,
-// present if the location refers to a range. It is
-// measured in UTF-16 code units and the client
-// capability `columnsStartAt1` determines whether
-// it is 0- or 1-based."
-//   }
-// },
-// "required": [ "source", "line" ]
-//   }
-// }
-//   }]
-// },
-void LocationsRequestHandler::operator()(
-const llvm::json::Object &request) const {
-  llvm::json::Object response;
-  FillResponse(request, response);
-  auto *arguments = request.getObject("arguments");
-
-  const auto location_id =
-  GetInteger(arguments, "locationReference").value_or(0);
+// Looks up information about a location reference previously returned by the
+// debug adapter.
+llvm::Expected
+LocationsRequestHandler::Run(const protocol::LocationsArguments &args) const {
+  protocol::LocationsResponseBody response;
   // We use the lowest bit to distinguish between value location and 
declaration
   // location
-  auto [var_ref, is_value_location] = UnpackLocati

[Lldb-commits] [lldb] [LLDB] Improve error handling in TypeSystemClang::GetChildCompilerTypeAtIndex (PR #170932)

2025-12-08 Thread David Spickett via lldb-commits

https://github.com/DavidSpickett edited 
https://github.com/llvm/llvm-project/pull/170932
___
lldb-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [lldb] [lldb-dap] Migrate pause request to structured types (PR #171096)

2025-12-08 Thread Ebuka Ezike via lldb-commits


@@ -8,53 +8,19 @@
 
 #include "DAP.h"
 #include "EventHelper.h"
-#include "JSONUtils.h"
+#include "Protocol/ProtocolRequests.h"
 #include "RequestHandler.h"
 
 namespace lldb_dap {
 
-// "PauseRequest": {
-//   "allOf": [ { "$ref": "#/definitions/Request" }, {
-// "type": "object",
-// "description": "Pause request; value of command field is 'pause'. The
-// request suspenses the debuggee. The debug adapter first sends the
-// PauseResponse and then a StoppedEvent (event type 'pause') after the
-// thread has been paused successfully.", "properties": {
-//   "command": {
-// "type": "string",
-// "enum": [ "pause" ]
-//   },
-//   "arguments": {
-// "$ref": "#/definitions/PauseArguments"
-//   }
-// },
-// "required": [ "command", "arguments"  ]
-//   }]
-// },
-// "PauseArguments": {
-//   "type": "object",
-//   "description": "Arguments for 'pause' request.",
-//   "properties": {
-// "threadId": {
-//   "type": "integer",
-//   "description": "Pause execution for this thread."
-// }
-//   },
-//   "required": [ "threadId" ]
-// },
-// "PauseResponse": {
-//   "allOf": [ { "$ref": "#/definitions/Response" }, {
-// "type": "object",
-// "description": "Response to 'pause' request. This is just an
-// acknowledgement, so no body field is required."
-//   }]
-// }
-void PauseRequestHandler::operator()(const llvm::json::Object &request) const {
-  llvm::json::Object response;
-  FillResponse(request, response);
+/// The request suspenses the debuggee. The debug adapter first sends the
+/// PauseResponse and then a StoppedEvent (event type 'pause') after the thread
+/// has been paused successfully.
+llvm::Error
+PauseRequestHandler::Run(const protocol::PauseArguments &args) const {
   lldb::SBProcess process = dap.target.GetProcess();
   lldb::SBError error = process.Stop();
-  dap.SendJSON(llvm::json::Value(std::move(response)));
+  return llvm::Error::success();

da-viper wrote:

```suggestion
  return ToError(error);
```

https://github.com/llvm/llvm-project/pull/171096
___
lldb-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [lldb] [LLDB] Improve error handling in TypeSystemClang::GetChildCompilerTypeAtIndex (PR #170932)

2025-12-08 Thread David Spickett via lldb-commits

https://github.com/DavidSpickett edited 
https://github.com/llvm/llvm-project/pull/170932
___
lldb-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [lldb] [lldb] Document the behaviour of IsValid for SBError (PR #170862)

2025-12-08 Thread David Spickett via lldb-commits

DavidSpickett wrote:

> We're describing it as empty, but the documentation does imply that empty can 
> equal success. This confuses me a bit because if I pass an SBError to a 
> function that is expected to return an Status it should populate the 
> underlying status and thus IsValid() would return true if there is is an 
> error or a success correct?

This is the assumption I made, but in at least one instance we do not do this, 
the one I changed. It's not invalid to return a IsValid true success, but 
evidence points to it not being required.

I think you're right that ideally if the API knows something succeeded it 
should return a valid error object. This fits the mental model of IsValid 
meaning "can I trust this" (or like our internal enum `eYes eNo eDontknow`). 
Which I'd like to do I just need to find a reasonably systematic way to find 
places where we don't do this right now.

An alternative @JDevlieghere suggested was to have SBError default construct to 
something valid. Problem with that is:
```
err = SBError() # I'd expect IsValid to be false here
target.Whatever(err) # This may or may not make it valid, intuition says it 
would make it valid whether success or failure
```
Which I think takes SBError from one special case to another.

https://github.com/llvm/llvm-project/pull/170862
___
lldb-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [lldb] [lldb-dap] Increase DAP default timeout (PR #170890)

2025-12-08 Thread Ebuka Ezike via lldb-commits

da-viper wrote:

>My intention here is that a big timeout can cause problems on CI when flaky 
>tests are failed (e.g. waiting for events)

The goal is to make the test no longer flaky, IMO if there is a wait for event 
longer than 50 seconds there is something else wrong with the test than the 
timeout itself.

>  Maybe we can do it only for mentioned tests.
I noticed this timeouts on a stressed `M4 pro` which is quite a fast machine. 
so I assume no not so fast machines the issue is more prevalent. This could be 
higher on windows as the windows defender normally scans new binaries. 

the unified timeouts was completed 
[here](https://github.com/llvm/llvm-project/commit/25c62bca9bc671ae5ce18a79fdef8d6e948c1064)
 

https://github.com/llvm/llvm-project/pull/170890
___
lldb-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [lldb] [lldb] Document the behaviour of IsValid for SBError (PR #170862)

2025-12-08 Thread David Spickett via lldb-commits

DavidSpickett wrote:

> Thus that makes SBError kinda weird where IsValid() only returns false if it 
> hasn't been exercised?

Yes.

Though if you don't have the API source code to read, it can look like 
IsValid() can be false *even if* it has been exercised.

https://github.com/llvm/llvm-project/pull/170862
___
lldb-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [lldb] 371da58 - [lldb-dap] Migrate pause request to structured types (#171096)

2025-12-08 Thread via lldb-commits

Author: Sergei Druzhkov
Date: 2025-12-08T21:35:24+03:00
New Revision: 371da58cfa05caa6ff654e538b913b059d9a1f44

URL: 
https://github.com/llvm/llvm-project/commit/371da58cfa05caa6ff654e538b913b059d9a1f44
DIFF: 
https://github.com/llvm/llvm-project/commit/371da58cfa05caa6ff654e538b913b059d9a1f44.diff

LOG: [lldb-dap] Migrate pause request to structured types (#171096)

This patch migrates `pause` request into structured types and adds test
for it.

Added: 


Modified: 
lldb/tools/lldb-dap/Handler/PauseRequestHandler.cpp
lldb/tools/lldb-dap/Handler/RequestHandler.h
lldb/tools/lldb-dap/Protocol/ProtocolRequests.cpp
lldb/tools/lldb-dap/Protocol/ProtocolRequests.h
lldb/unittests/DAP/ProtocolRequestsTest.cpp

Removed: 




diff  --git a/lldb/tools/lldb-dap/Handler/PauseRequestHandler.cpp 
b/lldb/tools/lldb-dap/Handler/PauseRequestHandler.cpp
index 99917b2e28223..9419f1acf2735 100644
--- a/lldb/tools/lldb-dap/Handler/PauseRequestHandler.cpp
+++ b/lldb/tools/lldb-dap/Handler/PauseRequestHandler.cpp
@@ -8,53 +8,20 @@
 
 #include "DAP.h"
 #include "EventHelper.h"
-#include "JSONUtils.h"
+#include "LLDBUtils.h"
+#include "Protocol/ProtocolRequests.h"
 #include "RequestHandler.h"
 
 namespace lldb_dap {
 
-// "PauseRequest": {
-//   "allOf": [ { "$ref": "#/definitions/Request" }, {
-// "type": "object",
-// "description": "Pause request; value of command field is 'pause'. The
-// request suspenses the debuggee. The debug adapter first sends the
-// PauseResponse and then a StoppedEvent (event type 'pause') after the
-// thread has been paused successfully.", "properties": {
-//   "command": {
-// "type": "string",
-// "enum": [ "pause" ]
-//   },
-//   "arguments": {
-// "$ref": "#/definitions/PauseArguments"
-//   }
-// },
-// "required": [ "command", "arguments"  ]
-//   }]
-// },
-// "PauseArguments": {
-//   "type": "object",
-//   "description": "Arguments for 'pause' request.",
-//   "properties": {
-// "threadId": {
-//   "type": "integer",
-//   "description": "Pause execution for this thread."
-// }
-//   },
-//   "required": [ "threadId" ]
-// },
-// "PauseResponse": {
-//   "allOf": [ { "$ref": "#/definitions/Response" }, {
-// "type": "object",
-// "description": "Response to 'pause' request. This is just an
-// acknowledgement, so no body field is required."
-//   }]
-// }
-void PauseRequestHandler::operator()(const llvm::json::Object &request) const {
-  llvm::json::Object response;
-  FillResponse(request, response);
+/// The request suspenses the debuggee. The debug adapter first sends the
+/// PauseResponse and then a StoppedEvent (event type 'pause') after the thread
+/// has been paused successfully.
+llvm::Error
+PauseRequestHandler::Run(const protocol::PauseArguments &args) const {
   lldb::SBProcess process = dap.target.GetProcess();
   lldb::SBError error = process.Stop();
-  dap.SendJSON(llvm::json::Value(std::move(response)));
+  return ToError(error);
 }
 
 } // namespace lldb_dap

diff  --git a/lldb/tools/lldb-dap/Handler/RequestHandler.h 
b/lldb/tools/lldb-dap/Handler/RequestHandler.h
index 5d235352b7738..fdce33de3f680 100644
--- a/lldb/tools/lldb-dap/Handler/RequestHandler.h
+++ b/lldb/tools/lldb-dap/Handler/RequestHandler.h
@@ -492,11 +492,12 @@ class ModulesRequestHandler final
   Run(const std::optional &args) const override;
 };
 
-class PauseRequestHandler : public LegacyRequestHandler {
+class PauseRequestHandler
+: public RequestHandler 
{
 public:
-  using LegacyRequestHandler::LegacyRequestHandler;
+  using RequestHandler::RequestHandler;
   static llvm::StringLiteral GetCommand() { return "pause"; }
-  void operator()(const llvm::json::Object &request) const override;
+  llvm::Error Run(const protocol::PauseArguments &args) const override;
 };
 
 class ScopesRequestHandler final

diff  --git a/lldb/tools/lldb-dap/Protocol/ProtocolRequests.cpp 
b/lldb/tools/lldb-dap/Protocol/ProtocolRequests.cpp
index 0a1d580bffd68..95ecc7e4e7e40 100644
--- a/lldb/tools/lldb-dap/Protocol/ProtocolRequests.cpp
+++ b/lldb/tools/lldb-dap/Protocol/ProtocolRequests.cpp
@@ -695,4 +695,10 @@ llvm::json::Value toJSON(const EvaluateResponseBody &Body) 
{
   return result;
 }
 
+bool fromJSON(const llvm::json::Value &Params, PauseArguments &Args,
+  llvm::json::Path Path) {
+  json::ObjectMapper O(Params, Path);
+  return O && O.map("threadId", Args.threadId);
+}
+
 } // namespace lldb_dap::protocol

diff  --git a/lldb/tools/lldb-dap/Protocol/ProtocolRequests.h 
b/lldb/tools/lldb-dap/Protocol/ProtocolRequests.h
index 6a85033ae7ef2..dc84e90ae03b4 100644
--- a/lldb/tools/lldb-dap/Protocol/ProtocolRequests.h
+++ b/lldb/tools/lldb-dap/Protocol/ProtocolRequests.h
@@ -1184,6 +1184,17 @@ struct EvaluateResponseBody {
 };
 llvm::json::Value toJSON(const EvaluateResponseBody &);
 
+/// Arguments for `

[Lldb-commits] [lldb] [lldb-dap] Migrate pause request to structured types (PR #171096)

2025-12-08 Thread Ebuka Ezike via lldb-commits

https://github.com/da-viper approved this pull request.


https://github.com/llvm/llvm-project/pull/171096
___
lldb-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [lldb] [lldb-dap] Fix running dap_server.py directly for debugging tests. (PR #167754)

2025-12-08 Thread John Harrison via lldb-commits


@@ -1646,326 +1730,317 @@ def __str__(self):
 return f"lldb-dap returned non-zero exit status {self.returncode}."
 
 
-def attach_options_specified(options):
-if options.pid is not None:
+def attach_options_specified(opts):
+if opts.pid is not None:
 return True
-if options.waitFor:
+if opts.wait_for:
 return True
-if options.attach:
+if opts.attach:
 return True
-if options.attachCmds:
+if opts.attach_command:
 return True
 return False
 
 
-def run_vscode(dbg, args, options):
-dbg.request_initialize(options.sourceInitFile)
+def run_adapter(dbg: DebugCommunication, opts: argparse.Namespace) -> None:
+dbg.request_initialize(opts.source_init_file)
 
-if options.sourceBreakpoints:
-source_to_lines = {}
-for file_line in options.sourceBreakpoints:
-(path, line) = file_line.split(":")
-if len(path) == 0 or len(line) == 0:
-print('error: invalid source with line "%s"' % (file_line))
-
-else:
-if path in source_to_lines:
-source_to_lines[path].append(int(line))
-else:
-source_to_lines[path] = [int(line)]
-for source in source_to_lines:
-dbg.request_setBreakpoints(Source(source), source_to_lines[source])
-if options.funcBreakpoints:
-dbg.request_setFunctionBreakpoints(options.funcBreakpoints)
+source_to_lines: Dict[str, List[int]] = {}
+for sbp in cast(List[str], opts.source_bp):
+if ":" not in sbp:
+print(f"error: invalid source with line {sbp!r}", file=sys.stderr)
+continue
+path, line = sbp.split(":")
+if path in source_to_lines:
+source_to_lines[path].append(int(line))
+else:
+source_to_lines[path] = [int(line)]
+for source in source_to_lines:
+dbg.request_setBreakpoints(Source.build(path=source), 
source_to_lines[source])
+if opts.function_bp:
+dbg.request_setFunctionBreakpoints(opts.function_bp)
 
 dbg.request_configurationDone()
 
-if attach_options_specified(options):
+if attach_options_specified(opts):
 response = dbg.request_attach(
-program=options.program,
-pid=options.pid,
-waitFor=options.waitFor,
-attachCommands=options.attachCmds,
-initCommands=options.initCmds,
-preRunCommands=options.preRunCmds,
-stopCommands=options.stopCmds,
-exitCommands=options.exitCmds,
-terminateCommands=options.terminateCmds,
+program=opts.program,
+pid=opts.pid,
+waitFor=opts.wait_for,
+attachCommands=opts.attach_command,
+initCommands=opts.init_command,
+preRunCommands=opts.pre_run_command,
+stopCommands=opts.stop_command,
+terminateCommands=opts.terminate_command,
+exitCommands=opts.exit_command,
 )
 else:
 response = dbg.request_launch(
-options.program,
-args=args,
-env=options.envs,
-cwd=options.workingDir,
-debuggerRoot=options.debuggerRoot,
-sourcePath=options.sourcePath,
-initCommands=options.initCmds,
-preRunCommands=options.preRunCmds,
-stopCommands=options.stopCmds,
-exitCommands=options.exitCmds,
-terminateCommands=options.terminateCmds,
+opts.program,
+args=opts.args,
+env=opts.env,
+cwd=opts.working_dir,
+debuggerRoot=opts.debugger_root,
+sourceMap=opts.source_map,
+initCommands=opts.init_command,
+preRunCommands=opts.pre_run_command,
+stopCommands=opts.stop_command,
+exitCommands=opts.exit_command,
+terminateCommands=opts.terminate_command,
 )
 
 if response["success"]:
 dbg.wait_for_stopped()
 else:
-if "message" in response:
-print(response["message"])
+print("failed to launch/attach: ", response)

ashgti wrote:

Done.

https://github.com/llvm/llvm-project/pull/167754
___
lldb-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [lldb] [lldb-dap] Migrate locations request to structured types (PR #171099)

2025-12-08 Thread Sergei Druzhkov via lldb-commits

https://github.com/DrSergei updated 
https://github.com/llvm/llvm-project/pull/171099

>From c2d2546e4631f47150db7a0957d61f108d633760 Mon Sep 17 00:00:00 2001
From: Druzhkov Sergei 
Date: Sun, 7 Dec 2025 17:23:49 +0300
Subject: [PATCH 1/3] [lldb-dap] Migrate locations request to structured types

---
 .../Handler/LocationsRequestHandler.cpp   | 162 --
 lldb/tools/lldb-dap/Handler/RequestHandler.h  |   9 +-
 .../lldb-dap/Protocol/ProtocolRequests.cpp|  19 ++
 .../lldb-dap/Protocol/ProtocolRequests.h  |  35 
 lldb/unittests/DAP/ProtocolRequestsTest.cpp   |  50 ++
 5 files changed, 140 insertions(+), 135 deletions(-)

diff --git a/lldb/tools/lldb-dap/Handler/LocationsRequestHandler.cpp 
b/lldb/tools/lldb-dap/Handler/LocationsRequestHandler.cpp
index cf9b5a3dbd06b..10a6dcf4d8305 100644
--- a/lldb/tools/lldb-dap/Handler/LocationsRequestHandler.cpp
+++ b/lldb/tools/lldb-dap/Handler/LocationsRequestHandler.cpp
@@ -7,6 +7,7 @@
 
//===--===//
 
 #include "DAP.h"
+#include "DAPError.h"
 #include "EventHelper.h"
 #include "JSONUtils.h"
 #include "LLDBUtils.h"
@@ -18,167 +19,64 @@
 
 namespace lldb_dap {
 
-// "LocationsRequest": {
-//   "allOf": [ { "$ref": "#/definitions/Request" }, {
-// "type": "object",
-// "description": "Looks up information about a location reference
-// previously returned by the debug adapter.",
-// "properties": {
-//   "command": {
-// "type": "string",
-// "enum": [ "locations" ]
-//   },
-//   "arguments": {
-// "$ref": "#/definitions/LocationsArguments"
-//   }
-// },
-// "required": [ "command", "arguments" ]
-//   }]
-// },
-// "LocationsArguments": {
-//   "type": "object",
-//   "description": "Arguments for `locations` request.",
-//   "properties": {
-// "locationReference": {
-//   "type": "integer",
-//   "description": "Location reference to resolve."
-// }
-//   },
-//   "required": [ "locationReference" ]
-// },
-// "LocationsResponse": {
-//   "allOf": [ { "$ref": "#/definitions/Response" }, {
-// "type": "object",
-// "description": "Response to `locations` request.",
-// "properties": {
-//   "body": {
-// "type": "object",
-// "properties": {
-//   "source": {
-// "$ref": "#/definitions/Source",
-// "description": "The source containing the location; either
-// `source.path` or `source.sourceReference` must 
be
-// specified."
-//   },
-//   "line": {
-// "type": "integer",
-// "description": "The line number of the location. The client
-// capability `linesStartAt1` determines whether it
-// is 0- or 1-based."
-//   },
-//   "column": {
-// "type": "integer",
-// "description": "Position of the location within the `line`. It 
is
-// measured in UTF-16 code units and the client
-// capability `columnsStartAt1` determines whether
-// it is 0- or 1-based. If no column is given, the
-// first position in the start line is assumed."
-//   },
-//   "endLine": {
-// "type": "integer",
-// "description": "End line of the location, present if the 
location
-// refers to a range.  The client capability
-// `linesStartAt1` determines whether it is 0- or
-// 1-based."
-//   },
-//   "endColumn": {
-// "type": "integer",
-// "description": "End position of the location within `endLine`,
-// present if the location refers to a range. It is
-// measured in UTF-16 code units and the client
-// capability `columnsStartAt1` determines whether
-// it is 0- or 1-based."
-//   }
-// },
-// "required": [ "source", "line" ]
-//   }
-// }
-//   }]
-// },
-void LocationsRequestHandler::operator()(
-const llvm::json::Object &request) const {
-  llvm::json::Object response;
-  FillResponse(request, response);
-  auto *arguments = request.getObject("arguments");
-
-  const auto location_id =
-  GetInteger(arguments, "locationReference").value_or(0);
+// Looks up information about a location reference previously returned by the
+// debug adapter.
+llvm::Expected
+LocationsRequestHandler::Run(const protocol::LocationsArguments &args) const {
+  protocol::LocationsResponseBody response;
   // We use the lowest bit to distinguish between value location and 
declaration
   // location
-  auto [var_ref, is_value_location] = UnpackLocati

[Lldb-commits] [lldb] [lldb-dap] Migrate locations request to structured types (PR #171099)

2025-12-08 Thread Sergei Druzhkov via lldb-commits


@@ -695,4 +695,23 @@ llvm::json::Value toJSON(const EvaluateResponseBody &Body) 
{
   return result;
 }
 
+bool fromJSON(const llvm::json::Value &Params, LocationsArguments &Args,
+  llvm::json::Path Path) {
+  json::ObjectMapper O(Params, Path);
+  return O && O.map("locationReference", Args.locationReference);
+}
+
+llvm::json::Value toJSON(const LocationsResponseBody &Body) {
+  json::Object result{{"source", Body.source}, {"line", Body.line}};

DrSergei wrote:

Added

https://github.com/llvm/llvm-project/pull/171099
___
lldb-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [lldb] [lldb-dap] Migrate pause request to structured types (PR #171096)

2025-12-08 Thread Sergei Druzhkov via lldb-commits

https://github.com/DrSergei closed 
https://github.com/llvm/llvm-project/pull/171096
___
lldb-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [lldb] 7fbd443 - [lldb] Remove printf in breakpoint add command

2025-12-08 Thread David Spickett via lldb-commits

Author: David Spickett
Date: 2025-12-08T13:53:55Z
New Revision: 7fbd443491db62a3fe316f9cc4e3e47036f5730b

URL: 
https://github.com/llvm/llvm-project/commit/7fbd443491db62a3fe316f9cc4e3e47036f5730b
DIFF: 
https://github.com/llvm/llvm-project/commit/7fbd443491db62a3fe316f9cc4e3e47036f5730b.diff

LOG: [lldb] Remove printf in breakpoint add command

Added in 2110db0f49593 / #156067.

Added: 


Modified: 
lldb/source/Commands/CommandObjectBreakpoint.cpp

Removed: 




diff  --git a/lldb/source/Commands/CommandObjectBreakpoint.cpp 
b/lldb/source/Commands/CommandObjectBreakpoint.cpp
index 78bbd23744293..fbd6ca44db950 100644
--- a/lldb/source/Commands/CommandObjectBreakpoint.cpp
+++ b/lldb/source/Commands/CommandObjectBreakpoint.cpp
@@ -1274,7 +1274,6 @@ class CommandObjectBreakpointAddPattern : public 
CommandObjectRaw {
   result.AppendError("no pattern to seek");
   return;
 }
-printf("Pattern: '%s'\n", pattern.str().c_str());
 
 Target &target =
 m_dummy_options.m_use_dummy ? GetDummyTarget() : GetTarget();



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


[Lldb-commits] [clang] [clang-tools-extra] [lldb] [clang][TypePrinter][NFC] Turn SuppressTagKeyword into an enum (PR #171160)

2025-12-08 Thread Matheus Izvekov via lldb-commits

mizvekov wrote:

As I pointed out in the original patch, maybe there was a confusion on my part 
where I assumed we would have a three valued enum, but the direction actually 
would make it four valued, and these would be controlling the suppression of 
the keyword in orthogonal places.

Can you clarify?

I don't mind bool vs two valued enum, if that's your preference, but the tying 
up of two separate conditions into one variable is making the other patch look 
awkward.

https://github.com/llvm/llvm-project/pull/171160
___
lldb-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [lldb] [lldb-dap] Migrate locations request to structured types (PR #171099)

2025-12-08 Thread John Harrison via lldb-commits

https://github.com/ashgti approved this pull request.


https://github.com/llvm/llvm-project/pull/171099
___
lldb-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [lldb] [lldb-dap] Migrate locations request to structured types (PR #171099)

2025-12-08 Thread John Harrison via lldb-commits


@@ -695,4 +695,23 @@ llvm::json::Value toJSON(const EvaluateResponseBody &Body) 
{
   return result;
 }
 
+bool fromJSON(const llvm::json::Value &Params, LocationsArguments &Args,
+  llvm::json::Path Path) {
+  json::ObjectMapper O(Params, Path);
+  return O && O.map("locationReference", Args.locationReference);
+}
+
+llvm::json::Value toJSON(const LocationsResponseBody &Body) {
+  json::Object result{{"source", Body.source}, {"line", Body.line}};

ashgti wrote:

Can we add an assert that `line` is `!= LLDB_INVALID_LINE_NUMBER`, that 
indicates the response wasn't filled in correctly.

https://github.com/llvm/llvm-project/pull/171099
___
lldb-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [lldb] [lldb-dap] Migrate pause request to structured types (PR #171096)

2025-12-08 Thread John Harrison via lldb-commits

https://github.com/ashgti approved this pull request.


https://github.com/llvm/llvm-project/pull/171096
___
lldb-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [clang] [clang-tools-extra] [lldb] [clang][TypePrinter][NFC] Turn SuppressTagKeyword into an enum (PR #171160)

2025-12-08 Thread via lldb-commits

llvmbot wrote:




@llvm/pr-subscribers-clang-tools-extra

Author: Michael Buch (Michael137)


Changes

Split out from https://github.com/llvm/llvm-project/pull/169445 where we 
introduce an additional mode to `SuppressTagKeywordMode`.

Prepares `PrintingPolicy::SuppressTagKeyword` to take enum values. Currently 
the main use of this flag is to prevent the tag keyword from being printed when 
we already printed it for the outer elaborated type. Hence I chose the name 
`SuppressTagKeywordMode::InElaboratedNames`. But happy to consider other names

---

Patch is 22.65 KiB, truncated to 20.00 KiB below, full version: 
https://github.com/llvm/llvm-project/pull/171160.diff


17 Files Affected:

- (modified) clang-tools-extra/clang-tidy/performance/MoveConstArgCheck.cpp 
(+2-1) 
- (modified) 
clang-tools-extra/clang-tidy/readability/StaticAccessedThroughInstanceCheck.cpp 
(+2-1) 
- (modified) clang-tools-extra/clang-tidy/utils/Matchers.cpp (+2-1) 
- (modified) clang-tools-extra/clangd/AST.cpp (+2-1) 
- (modified) clang-tools-extra/clangd/Hover.cpp (+4-1) 
- (modified) clang/include/clang/AST/PrettyPrinter.h (+18-7) 
- (modified) clang/lib/AST/Expr.cpp (+4-1) 
- (modified) clang/lib/AST/InferAlloc.cpp (+2-1) 
- (modified) clang/lib/AST/NestedNameSpecifier.cpp (+2-1) 
- (modified) clang/lib/AST/TypePrinter.cpp (+9-5) 
- (modified) clang/lib/CIR/CodeGen/CIRGenTypes.cpp (+2-1) 
- (modified) clang/lib/Index/USRGeneration.cpp (+2-1) 
- (modified) clang/tools/libclang/CIndex.cpp (+8-3) 
- (modified) clang/unittests/AST/DeclPrinterTest.cpp (+54-37) 
- (modified) clang/unittests/AST/TypePrinterTest.cpp (+6-5) 
- (modified) 
lldb/source/Plugins/ExpressionParser/Clang/ClangExpressionParser.cpp (+2-1) 
- (modified) lldb/source/Plugins/TypeSystem/Clang/TypeSystemClang.cpp (+4-2) 


``diff
diff --git a/clang-tools-extra/clang-tidy/performance/MoveConstArgCheck.cpp 
b/clang-tools-extra/clang-tidy/performance/MoveConstArgCheck.cpp
index 4d26c39fcbd18..5aa25e44d8735 100644
--- a/clang-tools-extra/clang-tidy/performance/MoveConstArgCheck.cpp
+++ b/clang-tools-extra/clang-tidy/performance/MoveConstArgCheck.cpp
@@ -187,7 +187,8 @@ void MoveConstArgCheck::check(const 
MatchFinder::MatchResult &Result) {
 
   QualType NoRefType = (*InvocationParmType)->getPointeeType();
   PrintingPolicy PolicyWithSuppressedTag(getLangOpts());
-  PolicyWithSuppressedTag.SuppressTagKeyword = true;
+  PolicyWithSuppressedTag.SuppressTagKeyword = llvm::to_underlying(
+  PrintingPolicy::SuppressTagKeywordMode::InElaboratedNames);
   PolicyWithSuppressedTag.SuppressUnwrittenScope = true;
   std::string ExpectParmTypeName =
   NoRefType.getAsString(PolicyWithSuppressedTag);
diff --git 
a/clang-tools-extra/clang-tidy/readability/StaticAccessedThroughInstanceCheck.cpp
 
b/clang-tools-extra/clang-tidy/readability/StaticAccessedThroughInstanceCheck.cpp
index 7ef8ef3d947f3..6acbb9bf12fa6 100644
--- 
a/clang-tools-extra/clang-tidy/readability/StaticAccessedThroughInstanceCheck.cpp
+++ 
b/clang-tools-extra/clang-tidy/readability/StaticAccessedThroughInstanceCheck.cpp
@@ -72,7 +72,8 @@ void StaticAccessedThroughInstanceCheck::check(
 
   const ASTContext *AstContext = Result.Context;
   PrintingPolicy PrintingPolicyWithSuppressedTag(AstContext->getLangOpts());
-  PrintingPolicyWithSuppressedTag.SuppressTagKeyword = true;
+  PrintingPolicyWithSuppressedTag.SuppressTagKeyword = llvm::to_underlying(
+  PrintingPolicy::SuppressTagKeywordMode::InElaboratedNames);
   PrintingPolicyWithSuppressedTag.SuppressUnwrittenScope = true;
 
   PrintingPolicyWithSuppressedTag.PrintAsCanonical =
diff --git a/clang-tools-extra/clang-tidy/utils/Matchers.cpp 
b/clang-tools-extra/clang-tidy/utils/Matchers.cpp
index b1591fb8e3619..6d6ca0b36335e 100644
--- a/clang-tools-extra/clang-tidy/utils/Matchers.cpp
+++ b/clang-tools-extra/clang-tidy/utils/Matchers.cpp
@@ -35,7 +35,8 @@ bool MatchesAnyListedTypeNameMatcher::matches(
   PrintingPolicyWithSuppressedTag.PrintAsCanonical = CanonicalTypes;
   PrintingPolicyWithSuppressedTag.FullyQualifiedName = true;
   PrintingPolicyWithSuppressedTag.SuppressScope = false;
-  PrintingPolicyWithSuppressedTag.SuppressTagKeyword = true;
+  PrintingPolicyWithSuppressedTag.SuppressTagKeyword = llvm::to_underlying(
+  PrintingPolicy::SuppressTagKeywordMode::InElaboratedNames);
   PrintingPolicyWithSuppressedTag.SuppressUnwrittenScope = true;
   std::string TypeName =
   Node.getUnqualifiedType().getAsString(PrintingPolicyWithSuppressedTag);
diff --git a/clang-tools-extra/clangd/AST.cpp b/clang-tools-extra/clangd/AST.cpp
index 0dcff2eae05e7..a4677efe63b7a 100644
--- a/clang-tools-extra/clangd/AST.cpp
+++ b/clang-tools-extra/clangd/AST.cpp
@@ -419,7 +419,8 @@ std::string printType(const QualType QT, const DeclContext 
&CurContext,
   std::string Result;
   llvm::raw_string_ostream OS(Result);
   PrintingPolicy PP(CurContext.getParentASTContext().getPrintingPolicy());
-  PP.SuppressTagKeyword = true;

[Lldb-commits] [clang] [clang-tools-extra] [lldb] [clang][TypePrinter][NFC] Turn SuppressTagKeyword into an enum (PR #171160)

2025-12-08 Thread Michael Buch via lldb-commits

https://github.com/Michael137 created 
https://github.com/llvm/llvm-project/pull/171160

Split out from https://github.com/llvm/llvm-project/pull/169445 where we 
introduce an additional mode to `SuppressTagKeywordMode`.

Prepares `PrintingPolicy::SuppressTagKeyword` to take enum values. Currently 
the main use of this flag is to prevent the tag keyword from being printed when 
we already printed it for the outer elaborated type. Hence I chose the name 
`SuppressTagKeywordMode::InElaboratedNames`. But happy to consider other names

>From b111e73c03d84d1315ba9e52c4e6348d5dc866ca Mon Sep 17 00:00:00 2001
From: Michael Buch 
Date: Fri, 5 Dec 2025 15:10:42 +0800
Subject: [PATCH] [clang][TypePrinter][NFC] Turn SuppressTagKeyword into an
 enum

In preparation for a follow-up patch that adds a new mode to this enum.
---
 .../performance/MoveConstArgCheck.cpp |  3 +-
 .../StaticAccessedThroughInstanceCheck.cpp|  3 +-
 .../clang-tidy/utils/Matchers.cpp |  3 +-
 clang-tools-extra/clangd/AST.cpp  |  3 +-
 clang-tools-extra/clangd/Hover.cpp|  5 +-
 clang/include/clang/AST/PrettyPrinter.h   | 25 +++--
 clang/lib/AST/Expr.cpp|  5 +-
 clang/lib/AST/InferAlloc.cpp  |  3 +-
 clang/lib/AST/NestedNameSpecifier.cpp |  3 +-
 clang/lib/AST/TypePrinter.cpp | 14 ++-
 clang/lib/CIR/CodeGen/CIRGenTypes.cpp |  3 +-
 clang/lib/Index/USRGeneration.cpp |  3 +-
 clang/tools/libclang/CIndex.cpp   | 11 ++-
 clang/unittests/AST/DeclPrinterTest.cpp   | 91 +++
 clang/unittests/AST/TypePrinterTest.cpp   | 11 ++-
 .../Clang/ClangExpressionParser.cpp   |  3 +-
 .../TypeSystem/Clang/TypeSystemClang.cpp  |  6 +-
 17 files changed, 125 insertions(+), 70 deletions(-)

diff --git a/clang-tools-extra/clang-tidy/performance/MoveConstArgCheck.cpp 
b/clang-tools-extra/clang-tidy/performance/MoveConstArgCheck.cpp
index 4d26c39fcbd18..5aa25e44d8735 100644
--- a/clang-tools-extra/clang-tidy/performance/MoveConstArgCheck.cpp
+++ b/clang-tools-extra/clang-tidy/performance/MoveConstArgCheck.cpp
@@ -187,7 +187,8 @@ void MoveConstArgCheck::check(const 
MatchFinder::MatchResult &Result) {
 
   QualType NoRefType = (*InvocationParmType)->getPointeeType();
   PrintingPolicy PolicyWithSuppressedTag(getLangOpts());
-  PolicyWithSuppressedTag.SuppressTagKeyword = true;
+  PolicyWithSuppressedTag.SuppressTagKeyword = llvm::to_underlying(
+  PrintingPolicy::SuppressTagKeywordMode::InElaboratedNames);
   PolicyWithSuppressedTag.SuppressUnwrittenScope = true;
   std::string ExpectParmTypeName =
   NoRefType.getAsString(PolicyWithSuppressedTag);
diff --git 
a/clang-tools-extra/clang-tidy/readability/StaticAccessedThroughInstanceCheck.cpp
 
b/clang-tools-extra/clang-tidy/readability/StaticAccessedThroughInstanceCheck.cpp
index 7ef8ef3d947f3..6acbb9bf12fa6 100644
--- 
a/clang-tools-extra/clang-tidy/readability/StaticAccessedThroughInstanceCheck.cpp
+++ 
b/clang-tools-extra/clang-tidy/readability/StaticAccessedThroughInstanceCheck.cpp
@@ -72,7 +72,8 @@ void StaticAccessedThroughInstanceCheck::check(
 
   const ASTContext *AstContext = Result.Context;
   PrintingPolicy PrintingPolicyWithSuppressedTag(AstContext->getLangOpts());
-  PrintingPolicyWithSuppressedTag.SuppressTagKeyword = true;
+  PrintingPolicyWithSuppressedTag.SuppressTagKeyword = llvm::to_underlying(
+  PrintingPolicy::SuppressTagKeywordMode::InElaboratedNames);
   PrintingPolicyWithSuppressedTag.SuppressUnwrittenScope = true;
 
   PrintingPolicyWithSuppressedTag.PrintAsCanonical =
diff --git a/clang-tools-extra/clang-tidy/utils/Matchers.cpp 
b/clang-tools-extra/clang-tidy/utils/Matchers.cpp
index b1591fb8e3619..6d6ca0b36335e 100644
--- a/clang-tools-extra/clang-tidy/utils/Matchers.cpp
+++ b/clang-tools-extra/clang-tidy/utils/Matchers.cpp
@@ -35,7 +35,8 @@ bool MatchesAnyListedTypeNameMatcher::matches(
   PrintingPolicyWithSuppressedTag.PrintAsCanonical = CanonicalTypes;
   PrintingPolicyWithSuppressedTag.FullyQualifiedName = true;
   PrintingPolicyWithSuppressedTag.SuppressScope = false;
-  PrintingPolicyWithSuppressedTag.SuppressTagKeyword = true;
+  PrintingPolicyWithSuppressedTag.SuppressTagKeyword = llvm::to_underlying(
+  PrintingPolicy::SuppressTagKeywordMode::InElaboratedNames);
   PrintingPolicyWithSuppressedTag.SuppressUnwrittenScope = true;
   std::string TypeName =
   Node.getUnqualifiedType().getAsString(PrintingPolicyWithSuppressedTag);
diff --git a/clang-tools-extra/clangd/AST.cpp b/clang-tools-extra/clangd/AST.cpp
index 0dcff2eae05e7..a4677efe63b7a 100644
--- a/clang-tools-extra/clangd/AST.cpp
+++ b/clang-tools-extra/clangd/AST.cpp
@@ -419,7 +419,8 @@ std::string printType(const QualType QT, const DeclContext 
&CurContext,
   std::string Result;
   llvm::raw_string_ostream OS(Result);
   PrintingPolicy PP(CurContext.getParentASTContext().getPrintingPolicy());
-  P

[Lldb-commits] [clang] [clang-tools-extra] [lldb] [clang][TypePrinter][NFC] Turn SuppressTagKeyword into an enum (PR #171160)

2025-12-08 Thread Michael Buch via lldb-commits

https://github.com/Michael137 updated 
https://github.com/llvm/llvm-project/pull/171160

>From b111e73c03d84d1315ba9e52c4e6348d5dc866ca Mon Sep 17 00:00:00 2001
From: Michael Buch 
Date: Fri, 5 Dec 2025 15:10:42 +0800
Subject: [PATCH 1/2] [clang][TypePrinter][NFC] Turn SuppressTagKeyword into an
 enum

In preparation for a follow-up patch that adds a new mode to this enum.
---
 .../performance/MoveConstArgCheck.cpp |  3 +-
 .../StaticAccessedThroughInstanceCheck.cpp|  3 +-
 .../clang-tidy/utils/Matchers.cpp |  3 +-
 clang-tools-extra/clangd/AST.cpp  |  3 +-
 clang-tools-extra/clangd/Hover.cpp|  5 +-
 clang/include/clang/AST/PrettyPrinter.h   | 25 +++--
 clang/lib/AST/Expr.cpp|  5 +-
 clang/lib/AST/InferAlloc.cpp  |  3 +-
 clang/lib/AST/NestedNameSpecifier.cpp |  3 +-
 clang/lib/AST/TypePrinter.cpp | 14 ++-
 clang/lib/CIR/CodeGen/CIRGenTypes.cpp |  3 +-
 clang/lib/Index/USRGeneration.cpp |  3 +-
 clang/tools/libclang/CIndex.cpp   | 11 ++-
 clang/unittests/AST/DeclPrinterTest.cpp   | 91 +++
 clang/unittests/AST/TypePrinterTest.cpp   | 11 ++-
 .../Clang/ClangExpressionParser.cpp   |  3 +-
 .../TypeSystem/Clang/TypeSystemClang.cpp  |  6 +-
 17 files changed, 125 insertions(+), 70 deletions(-)

diff --git a/clang-tools-extra/clang-tidy/performance/MoveConstArgCheck.cpp 
b/clang-tools-extra/clang-tidy/performance/MoveConstArgCheck.cpp
index 4d26c39fcbd18..5aa25e44d8735 100644
--- a/clang-tools-extra/clang-tidy/performance/MoveConstArgCheck.cpp
+++ b/clang-tools-extra/clang-tidy/performance/MoveConstArgCheck.cpp
@@ -187,7 +187,8 @@ void MoveConstArgCheck::check(const 
MatchFinder::MatchResult &Result) {
 
   QualType NoRefType = (*InvocationParmType)->getPointeeType();
   PrintingPolicy PolicyWithSuppressedTag(getLangOpts());
-  PolicyWithSuppressedTag.SuppressTagKeyword = true;
+  PolicyWithSuppressedTag.SuppressTagKeyword = llvm::to_underlying(
+  PrintingPolicy::SuppressTagKeywordMode::InElaboratedNames);
   PolicyWithSuppressedTag.SuppressUnwrittenScope = true;
   std::string ExpectParmTypeName =
   NoRefType.getAsString(PolicyWithSuppressedTag);
diff --git 
a/clang-tools-extra/clang-tidy/readability/StaticAccessedThroughInstanceCheck.cpp
 
b/clang-tools-extra/clang-tidy/readability/StaticAccessedThroughInstanceCheck.cpp
index 7ef8ef3d947f3..6acbb9bf12fa6 100644
--- 
a/clang-tools-extra/clang-tidy/readability/StaticAccessedThroughInstanceCheck.cpp
+++ 
b/clang-tools-extra/clang-tidy/readability/StaticAccessedThroughInstanceCheck.cpp
@@ -72,7 +72,8 @@ void StaticAccessedThroughInstanceCheck::check(
 
   const ASTContext *AstContext = Result.Context;
   PrintingPolicy PrintingPolicyWithSuppressedTag(AstContext->getLangOpts());
-  PrintingPolicyWithSuppressedTag.SuppressTagKeyword = true;
+  PrintingPolicyWithSuppressedTag.SuppressTagKeyword = llvm::to_underlying(
+  PrintingPolicy::SuppressTagKeywordMode::InElaboratedNames);
   PrintingPolicyWithSuppressedTag.SuppressUnwrittenScope = true;
 
   PrintingPolicyWithSuppressedTag.PrintAsCanonical =
diff --git a/clang-tools-extra/clang-tidy/utils/Matchers.cpp 
b/clang-tools-extra/clang-tidy/utils/Matchers.cpp
index b1591fb8e3619..6d6ca0b36335e 100644
--- a/clang-tools-extra/clang-tidy/utils/Matchers.cpp
+++ b/clang-tools-extra/clang-tidy/utils/Matchers.cpp
@@ -35,7 +35,8 @@ bool MatchesAnyListedTypeNameMatcher::matches(
   PrintingPolicyWithSuppressedTag.PrintAsCanonical = CanonicalTypes;
   PrintingPolicyWithSuppressedTag.FullyQualifiedName = true;
   PrintingPolicyWithSuppressedTag.SuppressScope = false;
-  PrintingPolicyWithSuppressedTag.SuppressTagKeyword = true;
+  PrintingPolicyWithSuppressedTag.SuppressTagKeyword = llvm::to_underlying(
+  PrintingPolicy::SuppressTagKeywordMode::InElaboratedNames);
   PrintingPolicyWithSuppressedTag.SuppressUnwrittenScope = true;
   std::string TypeName =
   Node.getUnqualifiedType().getAsString(PrintingPolicyWithSuppressedTag);
diff --git a/clang-tools-extra/clangd/AST.cpp b/clang-tools-extra/clangd/AST.cpp
index 0dcff2eae05e7..a4677efe63b7a 100644
--- a/clang-tools-extra/clangd/AST.cpp
+++ b/clang-tools-extra/clangd/AST.cpp
@@ -419,7 +419,8 @@ std::string printType(const QualType QT, const DeclContext 
&CurContext,
   std::string Result;
   llvm::raw_string_ostream OS(Result);
   PrintingPolicy PP(CurContext.getParentASTContext().getPrintingPolicy());
-  PP.SuppressTagKeyword = true;
+  PP.SuppressTagKeyword = llvm::to_underlying(
+  PrintingPolicy::SuppressTagKeywordMode::InElaboratedNames);
   PP.SuppressUnwrittenScope = true;
   PP.FullyQualifiedName = FullyQualify;
 
diff --git a/clang-tools-extra/clangd/Hover.cpp 
b/clang-tools-extra/clangd/Hover.cpp
index 34369e188d4ec..b00eb5c8ed9d4 100644
--- a/clang-tools-extra/clangd/Hover.cpp
+++ b/clang-tools-extra/clangd/Hover.cpp
@@ -176,7 +

[Lldb-commits] [clang] [clang-tools-extra] [lldb] [clang][TypePrinter] Unify printing of anonymous/unnamed tag types (PR #169445)

2025-12-08 Thread Matheus Izvekov via lldb-commits


@@ -121,6 +123,7 @@ struct PrintingPolicy {
   /// \endcode
   LLVM_PREFERRED_TYPE(bool)
   unsigned SuppressTagKeyword : 1;
+  unsigned SuppressTagKeywordInAnonymousTagNames : 1;

mizvekov wrote:

Yeah hold on, I thought this would be a three valued enum, but I see it is 
actually a four valued one.

These are controlling two separate things and we are tying them up 
unnecessarily.

Maybe two bools instead then, named:
* SuppressTagKeywordInAnonNames
* SuppressTagKeywordInElaboratedNames

Sorry for the confusion!

https://github.com/llvm/llvm-project/pull/169445
___
lldb-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [lldb] [lldb] Fix command line of `target frame-provider register` (PR #167803)

2025-12-08 Thread Adrian Vogelsgesang via lldb-commits

https://github.com/vogelsgesang updated 
https://github.com/llvm/llvm-project/pull/167803

>From 27934f7d6c5ed7f421c7864918c5f2d398cc7fe7 Mon Sep 17 00:00:00 2001
From: Adrian Vogelsgesang 
Date: Thu, 13 Nov 2025 01:10:09 +
Subject: [PATCH] [lldb] Fix command line of `target frame-provider register`

So far, the syntax was
> target frame-provider register  []

Note the optional `run-args` at the end. They are completely ignored by
the actual command, but the command line parser still accepts them.

This commit removes them.

They were probably a copy-paste error from `CommandObjectProcessLaunch`
which was probably used as a blue-print for `target frame-provider
register`.
---
 lldb/source/Commands/CommandObjectTarget.cpp | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)

diff --git a/lldb/source/Commands/CommandObjectTarget.cpp 
b/lldb/source/Commands/CommandObjectTarget.cpp
index 86373f5280271..e019264cafda3 100644
--- a/lldb/source/Commands/CommandObjectTarget.cpp
+++ b/lldb/source/Commands/CommandObjectTarget.cpp
@@ -5419,8 +5419,6 @@ class CommandObjectTargetFrameProviderRegister : public 
CommandObjectParsed {
 m_all_options.Append(&m_class_options, LLDB_OPT_SET_1 | LLDB_OPT_SET_2,
  LLDB_OPT_SET_ALL);
 m_all_options.Finalize();
-
-AddSimpleArgumentList(eArgTypeRunArgs, eArgRepeatOptional);
   }
 
   ~CommandObjectTargetFrameProviderRegister() override = default;
@@ -5433,7 +5431,7 @@ class CommandObjectTargetFrameProviderRegister : public 
CommandObjectParsed {
   }
 
 protected:
-  void DoExecute(Args &launch_args, CommandReturnObject &result) override {
+  void DoExecute(Args &command, CommandReturnObject &result) override {
 ScriptedMetadataSP metadata_sp = std::make_shared(
 m_class_options.GetName(), m_class_options.GetStructuredData());
 

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


[Lldb-commits] [lldb] [lldb][test] Add basic API tests for DW_TAG_template_alias (PR #170804)

2025-12-08 Thread Adrian Prantl via lldb-commits

https://github.com/adrian-prantl approved this pull request.

You may need to add a minimum clang version to these test decorators?

https://github.com/llvm/llvm-project/pull/170804
___
lldb-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [lldb] [lldb][TypeSystemClang] Set SuppressInlineNamespace to 'All' (PR #171138)

2025-12-08 Thread Adrian Prantl via lldb-commits

https://github.com/adrian-prantl approved this pull request.


https://github.com/llvm/llvm-project/pull/171138
___
lldb-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [lldb] [lldb][NFC] Replace const std::vector& with ArrayRef in APIs (PR #170834)

2025-12-08 Thread Felipe de Azevedo Piovezan via lldb-commits

https://github.com/felipepiovezan closed 
https://github.com/llvm/llvm-project/pull/170834
___
lldb-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [lldb] f27fbca - [lldb][NFC] Replace const std::vector& with ArrayRef in APIs (#170834)

2025-12-08 Thread via lldb-commits

Author: Felipe de Azevedo Piovezan
Date: 2025-12-08T16:59:32Z
New Revision: f27fbca37c4a66d4e237bae1256d775ca7471cb9

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

LOG: [lldb][NFC] Replace const std::vector& with ArrayRef in APIs (#170834)

Inside the LLVM codebase, const vector& should just be ArrayRef, as this
more general API works both with vectors, SmallVectors and
SmallVectorImpl, as well as with single elements.

This commit replaces two uses introduced in
https://github.com/llvm/llvm-project/pull/168797 .

Added: 


Modified: 
lldb/include/lldb/Core/Module.h
lldb/include/lldb/Symbol/SymbolFile.h
lldb/source/Core/Module.cpp
lldb/source/Symbol/SymbolFile.cpp

Removed: 




diff  --git a/lldb/include/lldb/Core/Module.h b/lldb/include/lldb/Core/Module.h
index 96ae8364c94e5..40ce23e3d2ffb 100644
--- a/lldb/include/lldb/Core/Module.h
+++ b/lldb/include/lldb/Core/Module.h
@@ -298,29 +298,12 @@ class Module : public 
std::enable_shared_from_this,
   /// matches.
   void FindCompileUnits(const FileSpec &path, SymbolContextList &sc_list);
 
-  /// Find functions by lookup info.
-  ///
-  /// If the function is an inlined function, it will have a block,
-  /// representing the inlined function, and the function will be the
-  /// containing function.  If it is not inlined, then the block will be NULL.
-  ///
-  /// \param[in] lookup_info
-  /// The lookup info of the function we are looking for.
-  ///
-  /// \param[out] sc_list
-  /// A symbol context list that gets filled in with all of the
-  /// matches.
-  void FindFunctions(const LookupInfo &lookup_info,
- const CompilerDeclContext &parent_decl_ctx,
- const ModuleFunctionSearchOptions &options,
- SymbolContextList &sc_list);
-
   /// Find functions by a vector of lookup infos.
   ///
   /// If the function is an inlined function, it will have a block,
   /// representing the inlined function, and the function will be the
   /// containing function.  If it is not inlined, then the block will be NULL.
-  void FindFunctions(const std::vector &lookup_infos,
+  void FindFunctions(llvm::ArrayRef lookup_infos,
  const CompilerDeclContext &parent_decl_ctx,
  const ModuleFunctionSearchOptions &options,
  SymbolContextList &sc_list);

diff  --git a/lldb/include/lldb/Symbol/SymbolFile.h 
b/lldb/include/lldb/Symbol/SymbolFile.h
index 305eb0f201b37..9982852cc760d 100644
--- a/lldb/include/lldb/Symbol/SymbolFile.h
+++ b/lldb/include/lldb/Symbol/SymbolFile.h
@@ -309,10 +309,9 @@ class SymbolFile : public PluginInterface {
   virtual void FindFunctions(const Module::LookupInfo &lookup_info,
  const CompilerDeclContext &parent_decl_ctx,
  bool include_inlines, SymbolContextList &sc_list);
-  virtual void
-  FindFunctions(const std::vector &lookup_infos,
-const CompilerDeclContext &parent_decl_ctx,
-bool include_inlines, SymbolContextList &sc_list);
+  virtual void FindFunctions(llvm::ArrayRef lookup_infos,
+ const CompilerDeclContext &parent_decl_ctx,
+ bool include_inlines, SymbolContextList &sc_list);
   virtual void FindFunctions(const RegularExpression ®ex,
  bool include_inlines, SymbolContextList &sc_list);
 

diff  --git a/lldb/source/Core/Module.cpp b/lldb/source/Core/Module.cpp
index eb2f95b105a5d..da2c188899f03 100644
--- a/lldb/source/Core/Module.cpp
+++ b/lldb/source/Core/Module.cpp
@@ -820,33 +820,24 @@ void Module::LookupInfo::Prune(SymbolContextList &sc_list,
   }
 }
 
-void Module::FindFunctions(const Module::LookupInfo &lookup_info,
+void Module::FindFunctions(llvm::ArrayRef lookup_infos,
const CompilerDeclContext &parent_decl_ctx,
const ModuleFunctionSearchOptions &options,
SymbolContextList &sc_list) {
-  // Find all the functions (not symbols, but debug information functions...
-  if (SymbolFile *symbols = GetSymbolFile()) {
+  for (auto &lookup_info : lookup_infos) {
+SymbolFile *symbols = GetSymbolFile();
+if (!symbols)
+  continue;
+
 symbols->FindFunctions(lookup_info, parent_decl_ctx,
options.include_inlines, sc_list);
-// Now check our symbol table for symbols that are code symbols if
-// requested
-if (options.include_symbols) {
-  if (Symtab *symtab = symbols->GetSymtab()) {
+if (options.include_symbols)
+  if (Symtab *symtab = symbols->GetSymtab())
 symtab->FindFunctionSymbols(lookup_info.GetLookupName(),
  

[Lldb-commits] [lldb] 7c832fc - [lldb] Fix command line of `target frame-provider register` (#167803)

2025-12-08 Thread via lldb-commits

Author: Adrian Vogelsgesang
Date: 2025-12-08T13:14:41Z
New Revision: 7c832fca5374cde2804cebc2ba3c5ad635fb76a1

URL: 
https://github.com/llvm/llvm-project/commit/7c832fca5374cde2804cebc2ba3c5ad635fb76a1
DIFF: 
https://github.com/llvm/llvm-project/commit/7c832fca5374cde2804cebc2ba3c5ad635fb76a1.diff

LOG: [lldb] Fix command line of `target frame-provider register` (#167803)

So far, the syntax was `target frame-provider register 
[]`. Note the optional `run-args` at the end. They are
completely ignored by the actual command, but the command line parser
still accepts them.

This commit removes them.

This was probably a copy-paste error from `CommandObjectProcessLaunch`
which was probably used as a blue-print for `target frame-provider
register`.

Added: 


Modified: 
lldb/source/Commands/CommandObjectTarget.cpp

Removed: 




diff  --git a/lldb/source/Commands/CommandObjectTarget.cpp 
b/lldb/source/Commands/CommandObjectTarget.cpp
index 6e8c94fa234cd..322dd6c502f27 100644
--- a/lldb/source/Commands/CommandObjectTarget.cpp
+++ b/lldb/source/Commands/CommandObjectTarget.cpp
@@ -5420,8 +5420,6 @@ class CommandObjectTargetFrameProviderRegister : public 
CommandObjectParsed {
 m_all_options.Append(&m_class_options, LLDB_OPT_SET_1 | LLDB_OPT_SET_2,
  LLDB_OPT_SET_ALL);
 m_all_options.Finalize();
-
-AddSimpleArgumentList(eArgTypeRunArgs, eArgRepeatOptional);
   }
 
   ~CommandObjectTargetFrameProviderRegister() override = default;
@@ -5434,7 +5432,7 @@ class CommandObjectTargetFrameProviderRegister : public 
CommandObjectParsed {
   }
 
 protected:
-  void DoExecute(Args &launch_args, CommandReturnObject &result) override {
+  void DoExecute(Args &command, CommandReturnObject &result) override {
 ScriptedMetadataSP metadata_sp = std::make_shared(
 m_class_options.GetName(), m_class_options.GetStructuredData());
 



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


[Lldb-commits] [lldb] [lldb] Fix command line of `target frame-provider register` (PR #167803)

2025-12-08 Thread Adrian Vogelsgesang via lldb-commits

https://github.com/vogelsgesang closed 
https://github.com/llvm/llvm-project/pull/167803
___
lldb-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [lldb] [lldb-dap] Increase DAP default timeout (PR #170890)

2025-12-08 Thread John Harrison via lldb-commits

https://github.com/ashgti approved this pull request.

I'm okay with this if we think it will improve stability.

However, I think there may still be a few places in tests where we wait for a 
negative assertion to time out. We may need to make sure we find anymore of 
those and make them positive assertions so they can end early.

For me, if I run the tests with `"-DLLVM_LIT_ARGS='-v 
--use-unique-output-file-name --time-tests'",`

```
$ ninja check-lldb-api-tools-lldb-dap
Slowest Tests:
--
102.61s: lldb-api :: tools/lldb-dap/variables/TestDAP_variables.py
77.41s: lldb-api :: tools/lldb-dap/evaluate/TestDAP_evaluate.py
46.74s: lldb-api :: tools/lldb-dap/launch/TestDAP_launch.py
32.29s: lldb-api :: tools/lldb-dap/module/TestDAP_module.py
32.08s: lldb-api :: tools/lldb-dap/completions/TestDAP_completions.py
28.63s: lldb-api :: tools/lldb-dap/disconnect/TestDAP_disconnect.py
27.49s: lldb-api :: tools/lldb-dap/breakpoint-events/TestDAP_breakpointEvents.py
26.55s: lldb-api :: tools/lldb-dap/server/TestDAP_server.py
26.47s: lldb-api :: tools/lldb-dap/restart/TestDAP_restart.py
24.46s: lldb-api :: tools/lldb-dap/threads/TestDAP_threads.py
20.19s: lldb-api :: tools/lldb-dap/exception/objc/TestDAP_exception_objc.py
19.72s: lldb-api :: tools/lldb-dap/breakpoint/TestDAP_setBreakpoints.py
15.53s: lldb-api :: tools/lldb-dap/console/TestDAP_console.py
15.08s: lldb-api :: tools/lldb-dap/breakpoint/TestDAP_logpoints.py
13.81s: lldb-api :: tools/lldb-dap/databreakpoint/TestDAP_setDataBreakpoints.py
13.81s: lldb-api :: tools/lldb-dap/optimized/TestDAP_optimized.py
13.68s: lldb-api :: tools/lldb-dap/module-event/TestDAP_module_event.py
11.66s: lldb-api :: tools/lldb-dap/memory/TestDAP_memory.py
10.55s: lldb-api :: tools/lldb-dap/terminated-event/TestDAP_terminatedEvent.py
10.48s: lldb-api :: tools/lldb-dap/attach-commands/TestDAP_attachCommands.py
```

I see a few tests that are pretty slow. The slowest ones are where I have been 
meaning to check for negative assertions on a timeout.

https://github.com/llvm/llvm-project/pull/170890
___
lldb-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [lldb] [LLDB] Add type casting to DIL, part 2 or 3 (PR #170332)

2025-12-08 Thread via lldb-commits


@@ -71,6 +71,11 @@ class Interpreter : Visitor {
   std::shared_ptr ctx,
   const IntegerLiteralNode *literal);
 
+  llvm::Expected

cmtice wrote:

Comment added. Yes they are all the reference parameters are 'out' parameters, 
i.e. the function can update their values.

https://github.com/llvm/llvm-project/pull/170332
___
lldb-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [lldb] [LLDB] Add type casting to DIL, part 2 or 3 (PR #170332)

2025-12-08 Thread via lldb-commits


@@ -46,6 +46,13 @@ enum class CastKind {
   eNone,///< Type promotion casting
 };
 
+/// Promotions allowed for type casts in DIL.
+enum CastPromoKind {

cmtice wrote:

Done.

https://github.com/llvm/llvm-project/pull/170332
___
lldb-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [lldb] [LLDB] Add type casting to DIL, part 2 or 3 (PR #170332)

2025-12-08 Thread via lldb-commits


@@ -740,16 +776,236 @@ Interpreter::Visit(const BooleanLiteralNode *node) {
   return ValueObject::CreateValueObjectFromBool(m_target, value, "result");
 }
 
+llvm::Expected
+Interpreter::VerifyCastType(lldb::ValueObjectSP &operand, CompilerType 
&op_type,
+CompilerType target_type, CastPromoKind 
&promo_kind,
+CastKind &cast_kind, int location) {
+
+  promo_kind = CastPromoKind::eNone;
+  if (op_type.IsReferenceType())
+op_type = op_type.GetNonReferenceType();
+  if (target_type.IsScalarType()) {
+if (op_type.IsArrayType()) {
+  // Do array-to-pointer conversion.
+  CompilerType deref_type =
+  op_type.IsReferenceType() ? op_type.GetNonReferenceType() : op_type;
+  CompilerType result_type =
+  deref_type.GetArrayElementType(nullptr).GetPointerType();
+  uint64_t addr = operand->GetLoadAddress();
+  llvm::StringRef name = operand->GetName().GetStringRef();
+  operand = ValueObject::CreateValueObjectFromAddress(
+  name, addr, m_exe_ctx_scope, result_type, /*do_deref=*/false);
+  op_type = result_type;
+}
+
+if (op_type.IsPointerType() || op_type.IsNullPtrType()) {
+  // Cast from pointer to float/double is not allowed.
+  if (target_type.IsFloat()) {
+std::string errMsg = llvm::formatv(
+"Cast from {0} to {1} is not allowed", op_type.TypeDescription(),
+target_type.TypeDescription());
+return llvm::make_error(
+m_expr, std::move(errMsg), location,
+op_type.TypeDescription().length());
+  }
+  // Casting pointer to bool is valid. Otherwise check if the result type
+  // is at least as big as the pointer size.
+  uint64_t type_byte_size = 0;
+  uint64_t rhs_type_byte_size = 0;
+  if (auto temp = target_type.GetByteSize(m_exe_ctx_scope.get()))
+// type_byte_size = temp.value();
+type_byte_size = *temp;
+  if (auto temp = op_type.GetByteSize(m_exe_ctx_scope.get()))
+// rhs_type_byte_size = temp.value();
+rhs_type_byte_size = *temp;
+  if (!target_type.IsBoolean() && type_byte_size < rhs_type_byte_size) {
+std::string errMsg = llvm::formatv(
+"cast from pointer to smaller type {0} loses information",
+target_type.TypeDescription());
+return llvm::make_error(
+m_expr, std::move(errMsg), location,
+op_type.TypeDescription().length());
+  }
+} else if (!op_type.IsScalarType() && !op_type.IsEnumerationType()) {
+  // Otherwise accept only arithmetic types and enums.
+  std::string errMsg = llvm::formatv(
+  "cannot convert {0} to {1} without a conversion operator",
+  op_type.TypeDescription(), target_type.TypeDescription());
+
+  return llvm::make_error(
+  m_expr, std::move(errMsg), location,
+  op_type.TypeDescription().length());
+}
+promo_kind = CastPromoKind::eArithmetic;
+  } else if (target_type.IsEnumerationType()) {
+// Cast to enum type.
+if (!op_type.IsScalarType() && !op_type.IsEnumerationType()) {
+  std::string errMsg = llvm::formatv("Cast from {0} to {1} is not allowed",
+ op_type.TypeDescription(),
+ target_type.TypeDescription());
+
+  return llvm::make_error(
+  m_expr, std::move(errMsg), location,
+  op_type.TypeDescription().length());
+}
+cast_kind = CastKind::eEnumeration;
+
+  } else if (target_type.IsPointerType()) {
+if (!op_type.IsInteger() && !op_type.IsEnumerationType() &&
+!op_type.IsArrayType() && !op_type.IsPointerType() &&
+!op_type.IsNullPtrType()) {
+  std::string errMsg = llvm::formatv(
+  "cannot cast from type {0} to pointer type {1}",
+  op_type.TypeDescription(), target_type.TypeDescription());
+
+  return llvm::make_error(
+  m_expr, std::move(errMsg), location,
+  op_type.TypeDescription().length());
+}
+promo_kind = CastPromoKind::ePointer;
+
+  } else if (target_type.IsNullPtrType()) {
+// Cast to nullptr type.
+bool is_signed;
+if (!target_type.IsNullPtrType() &&
+(!operand->IsIntegerType(is_signed) ||
+ (is_signed && operand->GetValueAsSigned(0) != 0) ||
+ (!is_signed && operand->GetValueAsUnsigned(0) != 0))) {
+  std::string errMsg = llvm::formatv("Cast from {0} to {1} is not allowed",
+ op_type.TypeDescription(),
+ target_type.TypeDescription());
+
+  return llvm::make_error(
+  m_expr, std::move(errMsg), location,
+  op_type.TypeDescription().length());
+}
+cast_kind = CastKind::eNullptr;
+
+  } else if (target_type.IsReferenceType()) {
+// Cast to a reference type.
+cast_kind = CastKind::eReference;

cmtice wrote:

I'

[Lldb-commits] [lldb] [LLDB] Add type casting to DIL, part 2 or 3 (PR #170332)

2025-12-08 Thread via lldb-commits


@@ -21,6 +21,42 @@
 
 namespace lldb_private::dil {
 
+lldb::ValueObjectSP
+GetDynamicOrSyntheticValue(lldb::ValueObjectSP in_valobj_sp,
+   lldb::DynamicValueType use_dynamic,
+   bool use_synthetic) {
+  Status error;
+  if (!in_valobj_sp) {
+error = Status("invalid value object");

cmtice wrote:

No it's not really needed;  I've removed it.

https://github.com/llvm/llvm-project/pull/170332
___
lldb-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [lldb] [LLDB] Add type casting to DIL, part 2 or 3 (PR #170332)

2025-12-08 Thread via lldb-commits

https://github.com/cmtice updated 
https://github.com/llvm/llvm-project/pull/170332

>From 8aab34e35f8622422e1b82147d059b1b6d1ce161 Mon Sep 17 00:00:00 2001
From: Caroline Tice 
Date: Tue, 2 Dec 2025 09:16:01 -0800
Subject: [PATCH 1/3] [LLDB] Add type casting to DIL, part 2 or 3

This PR implements the actual type casting part. With this, type
casting to builtin types should work. The third PR, which will be
put up after this one is merged, will expand the type name parsing
to allow casting to user-defined types.
---
 lldb/include/lldb/ValueObject/DILAST.h|   7 +
 lldb/include/lldb/ValueObject/DILEval.h   |   5 +
 lldb/source/ValueObject/DILEval.cpp   | 265 +-
 .../LocalVars/TestFrameVarDILLocalVars.py |   1 +
 .../frame/var-dil/expr/Casts/Makefile |   6 +
 .../var-dil/expr/Casts/TestFrameVarDILCast.py | 213 ++
 .../frame/var-dil/expr/Casts/main.cpp |  54 
 7 files changed, 547 insertions(+), 4 deletions(-)
 create mode 100644 lldb/test/API/commands/frame/var-dil/expr/Casts/Makefile
 create mode 100644 
lldb/test/API/commands/frame/var-dil/expr/Casts/TestFrameVarDILCast.py
 create mode 100644 lldb/test/API/commands/frame/var-dil/expr/Casts/main.cpp

diff --git a/lldb/include/lldb/ValueObject/DILAST.h 
b/lldb/include/lldb/ValueObject/DILAST.h
index 9fda0c798ec4e..3a18172852b5e 100644
--- a/lldb/include/lldb/ValueObject/DILAST.h
+++ b/lldb/include/lldb/ValueObject/DILAST.h
@@ -46,6 +46,13 @@ enum class CastKind {
   eNone,///< Type promotion casting
 };
 
+/// Promotions allowed for type casts in DIL.
+enum CastPromoKind {
+  eArithmetic,
+  ePointer,
+  eNone,
+};
+
 /// Forward declaration, for use in DIL AST nodes. Definition is at the very
 /// end of this file.
 class Visitor;
diff --git a/lldb/include/lldb/ValueObject/DILEval.h 
b/lldb/include/lldb/ValueObject/DILEval.h
index 2db45a7c37314..8df12ce450db7 100644
--- a/lldb/include/lldb/ValueObject/DILEval.h
+++ b/lldb/include/lldb/ValueObject/DILEval.h
@@ -71,6 +71,11 @@ class Interpreter : Visitor {
   std::shared_ptr ctx,
   const IntegerLiteralNode *literal);
 
+  llvm::Expected
+  VerifyCastType(lldb::ValueObjectSP &operand, CompilerType &op_type,
+ CompilerType target_type, CastPromoKind &promo_kind,
+ CastKind &cast_kind, int location);
+
   // Used by the interpreter to create objects, perform casts, etc.
   lldb::TargetSP m_target;
   llvm::StringRef m_expr;
diff --git a/lldb/source/ValueObject/DILEval.cpp 
b/lldb/source/ValueObject/DILEval.cpp
index dc0d93d242739..453152554ac62 100644
--- a/lldb/source/ValueObject/DILEval.cpp
+++ b/lldb/source/ValueObject/DILEval.cpp
@@ -21,6 +21,42 @@
 
 namespace lldb_private::dil {
 
+lldb::ValueObjectSP
+GetDynamicOrSyntheticValue(lldb::ValueObjectSP in_valobj_sp,
+   lldb::DynamicValueType use_dynamic,
+   bool use_synthetic) {
+  Status error;
+  if (!in_valobj_sp) {
+error = Status("invalid value object");
+return in_valobj_sp;
+  }
+  lldb::ValueObjectSP value_sp = in_valobj_sp;
+  Target *target = value_sp->GetTargetSP().get();
+  // If this ValueObject holds an error, then it is valuable for that.
+  if (value_sp->GetError().Fail())
+return value_sp;
+
+  if (!target)
+return lldb::ValueObjectSP();
+
+  if (use_dynamic != lldb::eNoDynamicValues) {
+lldb::ValueObjectSP dynamic_sp = value_sp->GetDynamicValue(use_dynamic);
+if (dynamic_sp)
+  value_sp = dynamic_sp;
+  }
+
+  if (use_synthetic) {
+lldb::ValueObjectSP synthetic_sp = value_sp->GetSyntheticValue();
+if (synthetic_sp)
+  value_sp = synthetic_sp;
+  }
+
+  if (!value_sp)
+error = Status("invalid value object");
+
+  return value_sp;
+}
+
 static llvm::Expected
 GetTypeSystemFromCU(std::shared_ptr ctx) {
   auto stack_frame = ctx->CalculateStackFrame();
@@ -740,16 +776,237 @@ Interpreter::Visit(const BooleanLiteralNode *node) {
   return ValueObject::CreateValueObjectFromBool(m_target, value, "result");
 }
 
+llvm::Expected Interpreter::VerifyCastType(
+lldb::ValueObjectSP &operand, CompilerType &op_type,
+CompilerType target_type, CastPromoKind &promo_kind,
+CastKind &cast_kind, int location) {
+
+  promo_kind = CastPromoKind::eNone;
+  if (op_type.IsReferenceType())
+op_type = op_type.GetNonReferenceType();
+  if (target_type.IsScalarType()) {
+if (op_type.IsArrayType()) {
+  // Do array-to-pointer conversion.
+  CompilerType deref_type =
+  op_type.IsReferenceType() ? op_type.GetNonReferenceType() : op_type;
+  CompilerType result_type =
+  deref_type.GetArrayElementType(nullptr).GetPointerType();
+  uint64_t addr = operand->GetLoadAddress();
+  llvm::StringRef name = operand->GetName().GetStringRef();
+  operand = ValueObject::CreateValueObjectFromAddress(
+  name, addr, m_exe_ctx_scope, result_type, /*do_deref=*/false);
+  op_type = res

[Lldb-commits] [lldb] [LLDB] Add type casting to DIL, part 2 or 3 (PR #170332)

2025-12-08 Thread via lldb-commits

https://github.com/cmtice edited 
https://github.com/llvm/llvm-project/pull/170332
___
lldb-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [lldb] f53f6f7 - [lldb][test] Add basic API tests for DW_TAG_template_alias (#170804)

2025-12-08 Thread via lldb-commits

Author: Michael Buch
Date: 2025-12-09T07:48:20Z
New Revision: f53f6f725085996662055a669407f388c3ba2486

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

LOG: [lldb][test] Add basic API tests for DW_TAG_template_alias (#170804)

Basic API tests to check how template aliases are rendered by LLDB
(using both `DW_TAG_template_alias` and `DW_TAG_typedef`, with and
without `-gsimple-template-names`).

Added: 
lldb/test/API/lang/cpp/template-alias/Makefile
lldb/test/API/lang/cpp/template-alias/TestTemplateAlias.py
lldb/test/API/lang/cpp/template-alias/main.cpp

Modified: 


Removed: 




diff  --git a/lldb/test/API/lang/cpp/template-alias/Makefile 
b/lldb/test/API/lang/cpp/template-alias/Makefile
new file mode 100644
index 0..8b20bcb05
--- /dev/null
+++ b/lldb/test/API/lang/cpp/template-alias/Makefile
@@ -0,0 +1,3 @@
+CXX_SOURCES := main.cpp
+
+include Makefile.rules

diff  --git a/lldb/test/API/lang/cpp/template-alias/TestTemplateAlias.py 
b/lldb/test/API/lang/cpp/template-alias/TestTemplateAlias.py
new file mode 100644
index 0..b8314eb7cff08
--- /dev/null
+++ b/lldb/test/API/lang/cpp/template-alias/TestTemplateAlias.py
@@ -0,0 +1,50 @@
+import lldb
+import lldbsuite.test.lldbutil as lldbutil
+from lldbsuite.test.decorators import *
+from lldbsuite.test.lldbtest import *
+
+
+class TestTemplateAlias(TestBase):
+def do_test(self, extra_flags):
+self.build(dictionary=extra_flags)
+self.main_source_file = lldb.SBFileSpec("main.cpp")
+lldbutil.run_to_source_breakpoint(self, "return", 
lldb.SBFileSpec("main.cpp"))
+
+self.expect_expr("f1", result_type="Foo")
+self.expect_expr("f2", result_type="Foo")
+self.expect_expr("b1", result_type="Bar")
+self.expect_expr("b2", result_type="Bar")
+self.expect_expr("bf1", result_type="Bar")
+self.expect_expr("bf2", result_type="Bar")
+self.expect_expr("bf1", result_type="Bar")
+self.expect_expr("bf2", result_type="Bar")
+self.expect_expr("cbf1", result_type="Container")
+
+@expectedFailureAll(
+bugnumber="LLDB doesn't reconstruct template alias names from template 
parameters"
+)
+def test_tag_alias_simple(self):
+self.do_test(
+dict(CXXFLAGS_EXTRAS="-gdwarf-5 -gtemplate-alias 
-gsimple-template-names")
+)
+
+def test_tag_alias_no_simple(self):
+self.do_test(
+dict(
+CXXFLAGS_EXTRAS="-gdwarf-5 -gtemplate-alias 
-gno-simple-template-names"
+)
+)
+
+def test_no_tag_alias_simple(self):
+self.do_test(
+dict(
+CXXFLAGS_EXTRAS="-gdwarf-5 -gno-template-alias 
-gsimple-template-names"
+)
+)
+
+def test_no_tag_alias_no_simple(self):
+self.do_test(
+dict(
+CXXFLAGS_EXTRAS="-gdwarf-5 -gno-template-alias 
-gno-simple-template-names"
+)
+)

diff  --git a/lldb/test/API/lang/cpp/template-alias/main.cpp 
b/lldb/test/API/lang/cpp/template-alias/main.cpp
new file mode 100644
index 0..af6c9792aee44
--- /dev/null
+++ b/lldb/test/API/lang/cpp/template-alias/main.cpp
@@ -0,0 +1,16 @@
+template  using Foo = T;
+
+template  using Bar = Foo;
+
+template  struct Container {};
+
+int main() {
+  Foo f1;
+  Foo f2;
+  Bar b1;
+  Bar b2;
+  Bar> bf1;
+  Bar> bf2;
+  Container>> cbf1;
+  return 0;
+}



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


[Lldb-commits] [lldb] [lldb][test] Add basic API tests for DW_TAG_template_alias (PR #170804)

2025-12-08 Thread Michael Buch via lldb-commits

https://github.com/Michael137 closed 
https://github.com/llvm/llvm-project/pull/170804
___
lldb-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [lldb] [lldb] Don't read firstSubclass and nextSiblingClass from class_rw_t (PR #171213)

2025-12-08 Thread Michael Buch via lldb-commits

https://github.com/Michael137 approved this pull request.


https://github.com/llvm/llvm-project/pull/171213
___
lldb-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [lldb] [lldb][test] Add basic API tests for DW_TAG_template_alias (PR #170804)

2025-12-08 Thread Michael Buch via lldb-commits

Michael137 wrote:

> You may need to add a minimum clang version to these test decorators?

Yea probably, but I was going to see what the matrix bot looks like after 
merging this and then adjust the decorators

https://github.com/llvm/llvm-project/pull/170804
___
lldb-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [lldb] 0bb0e26 - [lldb][TypeSystemClang] Set SuppressInlineNamespace to 'All' (#171138)

2025-12-08 Thread via lldb-commits

Author: Michael Buch
Date: 2025-12-09T07:47:39Z
New Revision: 0bb0e26aaf25f0f34bd2c5f2bc90540639fda4b7

URL: 
https://github.com/llvm/llvm-project/commit/0bb0e26aaf25f0f34bd2c5f2bc90540639fda4b7
DIFF: 
https://github.com/llvm/llvm-project/commit/0bb0e26aaf25f0f34bd2c5f2bc90540639fda4b7.diff

LOG: [lldb][TypeSystemClang] Set SuppressInlineNamespace to 'All' (#171138)

We used to set it to `true` up until recently, see
[here](https://github.com/llvm/llvm-project/pull/170802). That's
incorrect because `SuppressInlineNamespace` is actually an enum. What
probably happened is that `SuppressInlineNamespace` used to be a boolean
but got turned into an enum. But the assignment in LLDB wasn't updated.
But because the bitfield is an `unsigned`, the compiler never
complained.

This meant that ever since `SuppressInlineNamespace` became an enum,
we've been setting it to `SuppressInlineNamespaceMode::Redundant`. Which
means we would only omit the inline namespace when displaying typenames
if Clang deemed it unambiguous. This is probably a rare situtation but
the attached test-case is one such scenario. Here, `target var t1`
followed by `target var t2` would print the inline namespace for `t2`,
because in that context, the type is otherwise ambiguous. But because
LLDB's context is lazily constructed, evaluating `t2` first would omit
the inline namespace, because `t1` isn't in the context yet to make it
ambiguous.

This patch sets the `SuppressInlineNamespace` to
`SuppressInlineNamespaceMode::All`, which is most likely what was
intended in the first place, and also removes the above-mentioned
non-determinism from our typename printing.

Added: 
lldb/test/API/lang/cpp/inline-namespace-in-typename/Makefile

lldb/test/API/lang/cpp/inline-namespace-in-typename/TestInlineNamespaceInTypename.py
lldb/test/API/lang/cpp/inline-namespace-in-typename/main.cpp

Modified: 
lldb/source/Plugins/TypeSystem/Clang/TypeSystemClang.cpp

Removed: 




diff  --git a/lldb/source/Plugins/TypeSystem/Clang/TypeSystemClang.cpp 
b/lldb/source/Plugins/TypeSystem/Clang/TypeSystemClang.cpp
index 2cb4a46130c84..625d0e546ad3b 100644
--- a/lldb/source/Plugins/TypeSystem/Clang/TypeSystemClang.cpp
+++ b/lldb/source/Plugins/TypeSystem/Clang/TypeSystemClang.cpp
@@ -3871,9 +3871,8 @@ 
TypeSystemClang::GetDisplayTypeName(lldb::opaque_compiler_type_t type) {
   printing_policy.SuppressTagKeyword = true;
   printing_policy.SuppressScope = false;
   printing_policy.SuppressUnwrittenScope = true;
-  // FIXME: should we suppress "All" inline namespaces?
-  printing_policy.SuppressInlineNamespace = llvm::to_underlying(
-  PrintingPolicy::SuppressInlineNamespaceMode::Redundant);
+  printing_policy.SuppressInlineNamespace =
+  llvm::to_underlying(PrintingPolicy::SuppressInlineNamespaceMode::All);
   return ConstString(qual_type.getAsString(printing_policy));
 }
 

diff  --git a/lldb/test/API/lang/cpp/inline-namespace-in-typename/Makefile 
b/lldb/test/API/lang/cpp/inline-namespace-in-typename/Makefile
new file mode 100644
index 0..8b20bcb05
--- /dev/null
+++ b/lldb/test/API/lang/cpp/inline-namespace-in-typename/Makefile
@@ -0,0 +1,3 @@
+CXX_SOURCES := main.cpp
+
+include Makefile.rules

diff  --git 
a/lldb/test/API/lang/cpp/inline-namespace-in-typename/TestInlineNamespaceInTypename.py
 
b/lldb/test/API/lang/cpp/inline-namespace-in-typename/TestInlineNamespaceInTypename.py
new file mode 100644
index 0..19681364466ce
--- /dev/null
+++ 
b/lldb/test/API/lang/cpp/inline-namespace-in-typename/TestInlineNamespaceInTypename.py
@@ -0,0 +1,30 @@
+import lldb
+from lldbsuite.test.lldbtest import *
+from lldbsuite.test import lldbutil
+
+
+class TestInlineNamespaceInTypename(TestBase):
+def test(self):
+"""
+Tests that we correctly omit the inline namespace when printing
+the type name for "display", even if omitting the inline namespace
+would be ambiguous in the current context.
+"""
+self.build()
+target = self.dbg.CreateTarget(self.getBuildArtifact("a.out"))
+
+t1 = target.FindGlobalVariables("t1", 1)
+self.assertTrue(len(t1), 1)
+self.assertEqual(t1[0].GetDisplayTypeName(), "foo::Duplicate")
+
+# 'foo::Duplicate' would be an ambiguous reference, but we still
+# omit the inline namespace when displaying the type.
+t2 = target.FindGlobalVariables("t2", 1)
+self.assertTrue(len(t2), 1)
+self.assertEqual(t2[0].GetDisplayTypeName(), "foo::Duplicate")
+self.assertEqual(t2[0].GetTypeName(), "foo::bar::Duplicate")
+
+t3 = target.FindGlobalVariables("t3", 1)
+self.assertTrue(len(t3), 1)
+self.assertEqual(t3[0].GetDisplayTypeName(), "foo::Unique")
+self.assertEqual(t3[0].GetTypeName(), "foo::bar::Unique")

diff  --git a/lldb/test/API/lang/cpp/inline-namespace-in-typename/main.cpp 
b/lldb/test

[Lldb-commits] [lldb] [lldb][TypeSystemClang] Set SuppressInlineNamespace to 'All' (PR #171138)

2025-12-08 Thread Michael Buch via lldb-commits

https://github.com/Michael137 closed 
https://github.com/llvm/llvm-project/pull/171138
___
lldb-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits