[Lldb-commits] [lldb] [llvm] [lldb] Add target groups for related targets (PR #229180)
via lldb-commits
lldb-commits at lists.llvm.org
Wed Oct 14 12:54:29 PDT 2026
================
@@ -0,0 +1,72 @@
+//===----------------------------------------------------------------------===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===----------------------------------------------------------------------===//
+
+#ifndef LLDB_TARGET_TARGETGROUPLIST_H
+#define LLDB_TARGET_TARGETGROUPLIST_H
+
+#include "lldb/Target/TargetGroup.h"
+
+#include <memory>
+#include <mutex>
+#include <vector>
+
+namespace lldb_private {
+
+/// A synchronized collection of target groups. A Debugger uses one as its
+/// registry, and each Target uses one for the groups it belongs to.
+class TargetGroupList {
+private:
+ friend class Debugger;
+ friend class Target;
+
+ explicit TargetGroupList(Debugger &debugger)
+ : m_debugger(debugger),
+ m_mutex(std::make_shared<std::recursive_mutex>()) {}
+
+ TargetGroupList(Debugger &debugger,
+ const std::shared_ptr<std::recursive_mutex> &mutex)
+ : m_debugger(debugger), m_mutex(mutex) {}
+
+public:
+ ~TargetGroupList();
+
+ TargetGroupList(const TargetGroupList &) = delete;
+ TargetGroupList &operator=(const TargetGroupList &) = delete;
+ TargetGroupList(TargetGroupList &&) = delete;
+ TargetGroupList &operator=(TargetGroupList &&) = delete;
+
+ lldb::TargetGroupSP CreateTargetGroup(llvm::StringRef description);
+
+ /// Remove \p group_sp from this list. Other shared references, including
+ /// target membership lists, remain valid.
+ bool DeleteTargetGroup(const lldb::TargetGroupSP &group_sp);
+
+ size_t GetNumTargetGroups() const;
+
+ lldb::TargetGroupSP GetTargetGroupAtIndex(size_t index) const;
+
+ std::vector<lldb::TargetGroupSP> GetGroups() const;
----------------
jimingham wrote:
You should make it clear that this is a copy of the GroupList, adding to it won't change the list contents...
https://github.com/llvm/llvm-project/pull/229180
More information about the lldb-commits
mailing list