https://github.com/Michael137 updated https://github.com/llvm/llvm-project/pull/161495
>From bf3f96512240f1387003405544fa081c64a63025 Mon Sep 17 00:00:00 2001 From: Michael Buch <[email protected]> Date: Wed, 1 Oct 2025 10:18:53 +0100 Subject: [PATCH 1/2] [lldb][NFCI] Remove the non-const reference Mangled::GetMangledName accessor We've been seen (very sporadic) lifetime issues around this area. We noticed that `GetMangledName` has two accessors, one of which returns a non-const reference. I audited all the callsites and no users of this overload actually mutate the `ConstString` itself (which is a suspicious thing to do anyway since it's just a wrapper around a `const char*`). This patch removes the redundant overload. rdar://161128180 --- lldb/include/lldb/Core/Mangled.h | 8 +------- 1 file changed, 1 insertion(+), 7 deletions(-) diff --git a/lldb/include/lldb/Core/Mangled.h b/lldb/include/lldb/Core/Mangled.h index 47f1c6a8d80b7..1dcc34b4989dd 100644 --- a/lldb/include/lldb/Core/Mangled.h +++ b/lldb/include/lldb/Core/Mangled.h @@ -148,13 +148,7 @@ class Mangled { /// Mangled name get accessor. /// /// \return - /// A reference to the mangled name string object. - ConstString &GetMangledName() { return m_mangled; } - - /// Mangled name get accessor. - /// - /// \return - /// A const reference to the mangled name string object. + /// A the mangled name string object. ConstString GetMangledName() const { return m_mangled; } /// Best name get accessor. >From 123bc71123acf7c7c0cdb3b60d29a2cd91bdc5b2 Mon Sep 17 00:00:00 2001 From: Michael Buch <[email protected]> Date: Wed, 1 Oct 2025 10:24:51 +0100 Subject: [PATCH 2/2] fixup! docs --- lldb/include/lldb/Core/Mangled.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lldb/include/lldb/Core/Mangled.h b/lldb/include/lldb/Core/Mangled.h index 1dcc34b4989dd..9263e872b1bc7 100644 --- a/lldb/include/lldb/Core/Mangled.h +++ b/lldb/include/lldb/Core/Mangled.h @@ -148,7 +148,7 @@ class Mangled { /// Mangled name get accessor. /// /// \return - /// A the mangled name string object. + /// The mangled name string object. ConstString GetMangledName() const { return m_mangled; } /// Best name get accessor. _______________________________________________ lldb-commits mailing list [email protected] https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
