Run DCE after a LoopFlatten test to reduce spurious output [nfc]
[llvm-project.git] / lldb / source / Breakpoint / BreakpointName.cpp
blob5a4aad172fc028a3b790022df0c3315d8edf57ee
1 //===-- BreakpointName.cpp ------------------------------------------------===//
2 //
3 // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4 // See https://llvm.org/LICENSE.txt for license information.
5 // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
6 //
7 //===----------------------------------------------------------------------===//
9 #include "llvm/Support/Casting.h"
11 #include "lldb/Breakpoint/Breakpoint.h"
12 #include "lldb/Breakpoint/BreakpointOptions.h"
13 #include "lldb/Breakpoint/BreakpointLocationCollection.h"
14 #include "lldb/Breakpoint/BreakpointResolver.h"
15 #include "lldb/Breakpoint/BreakpointResolverFileLine.h"
16 #include "lldb/Utility/Log.h"
17 #include "lldb/Utility/Stream.h"
18 #include "lldb/Utility/StreamString.h"
20 using namespace lldb;
21 using namespace lldb_private;
23 const Flags::ValueType BreakpointName::Permissions::permissions_mask
24 [BreakpointName::Permissions::PermissionKinds::allPerms + 1] = {
25 (1u << 0),
26 (1u << 1),
27 (1u << 2),
28 (0x5u)
31 bool BreakpointName::Permissions::GetDescription(Stream *s,
32 lldb::DescriptionLevel level) {
33 if (!AnySet())
34 return false;
35 s->IndentMore();
36 s->Indent();
37 if (IsSet(listPerm))
38 s->Printf("list: %s", GetAllowList() ? "allowed" : "disallowed");
40 if (IsSet(disablePerm))
41 s->Printf("disable: %s", GetAllowDisable() ? "allowed" : "disallowed");
43 if (IsSet(deletePerm))
44 s->Printf("delete: %s", GetAllowDelete() ? "allowed" : "disallowed");
45 s->IndentLess();
46 return true;
49 bool BreakpointName::GetDescription(Stream *s, lldb::DescriptionLevel level) {
50 bool printed_any = false;
51 if (!m_help.empty())
52 s->Printf("Help: %s\n", m_help.c_str());
54 if (GetOptions().AnySet())
56 s->PutCString("Options: \n");
57 s->IndentMore();
58 s->Indent();
59 GetOptions().GetDescription(s, level);
60 printed_any = true;
61 s->IndentLess();
63 if (GetPermissions().AnySet())
65 s->PutCString("Permissions: \n");
66 s->IndentMore();
67 s->Indent();
68 GetPermissions().GetDescription(s, level);
69 printed_any = true;
70 s->IndentLess();
72 return printed_any;
75 void BreakpointName::ConfigureBreakpoint(lldb::BreakpointSP bp_sp)
77 bp_sp->GetOptions().CopyOverSetOptions(GetOptions());
78 bp_sp->GetPermissions().MergeInto(GetPermissions());