9#ifndef LLDB_TARGET_TARGETGROUP_H
10#define LLDB_TARGET_TARGETGROUP_H
13#include "llvm/ADT/StringRef.h"
14#include "llvm/Support/Error.h"
15#include "llvm/Support/ExtensibleRTTI.h"
31class TargetGroup :
public llvm::RTTIExtends<TargetGroup, llvm::RTTIRoot>,
32 public std::enable_shared_from_this<TargetGroup> {
64 std::vector<lldb::TargetSP>
GetTargets()
const;
67 std::vector<lldb::TargetSP>
GetTargets(Role role)
const;
89 std::shared_ptr<std::recursive_mutex>
m_mutex;
97 :
public llvm::RTTIExtends<TargetGroupCPUAndAccelerators, TargetGroup> {
98 using Base = llvm::RTTIExtends<TargetGroupCPUAndAccelerators, TargetGroup>;
110 llvm::StringRef description);
113 Role role)
const override;
friend class TargetGroupList
lldb::TargetSP GetCPUTarget() const
Return the CPU target, or nullptr if the group has no CPU target.
llvm::Error ValidateTargetAddition(const lldb::TargetSP &target_sp, Role role) const override
TargetGroupCPUAndAccelerators(TargetGroupList &group_list, llvm::StringRef description)
llvm::RTTIExtends< TargetGroupCPUAndAccelerators, TargetGroup > Base
A thread-safe collection of target groups.
std::shared_ptr< std::recursive_mutex > m_mutex
llvm::StringRef GetDescription() const
friend class TargetGroupList
bool RemoveTarget(const lldb::TargetSP &target_sp)
Remove target_sp from the group.
std::vector< Entry > m_entries
Targets are weakly held so membership does not extend their lifetime.
TargetGroup & operator=(const TargetGroup &)=delete
Role
Describes the part a target plays in this group.
llvm::Error AddTarget(const lldb::TargetSP &target_sp, Role role)
Add target_sp to the group with role.
std::optional< Role > GetRole(const lldb::TargetSP &target_sp) const
Return the role assigned to target_sp, if it is a member.
TargetGroup(const TargetGroup &)=delete
Target groups have identity and maintain backlinks in their member targets, so they cannot be copied ...
std::vector< lldb::TargetSP > GetTargets() const
Return every target in the group.
virtual llvm::Error ValidateTargetAddition(const lldb::TargetSP &target_sp, Role role) const
Validate a new membership while the membership lock is held.
lldb::DebuggerWP m_debugger_wp
TargetGroup(TargetGroup &&)=delete
TargetGroup & operator=(TargetGroup &&)=delete
std::string m_description
A class that represents a running process on the host machine.
std::weak_ptr< lldb_private::Debugger > DebuggerWP
std::weak_ptr< lldb_private::Target > TargetWP
std::shared_ptr< lldb_private::Target > TargetSP