[mlir][int-range] Limit xor int range inference to i1 (#116968)
[llvm-project.git] / lldb / source / Utility / State.cpp
blob2d76b801dcaabe40e0b7a6e74061687d94d17ca4
1 //===-- State.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 "lldb/Utility/State.h"
11 using namespace lldb;
12 using namespace lldb_private;
14 const char *lldb_private::StateAsCString(StateType state) {
15 switch (state) {
16 case eStateInvalid:
17 return "invalid";
18 case eStateUnloaded:
19 return "unloaded";
20 case eStateConnected:
21 return "connected";
22 case eStateAttaching:
23 return "attaching";
24 case eStateLaunching:
25 return "launching";
26 case eStateStopped:
27 return "stopped";
28 case eStateRunning:
29 return "running";
30 case eStateStepping:
31 return "stepping";
32 case eStateCrashed:
33 return "crashed";
34 case eStateDetached:
35 return "detached";
36 case eStateExited:
37 return "exited";
38 case eStateSuspended:
39 return "suspended";
41 return "unknown";
44 const char *lldb_private::GetPermissionsAsCString(uint32_t permissions) {
45 switch (permissions) {
46 case 0:
47 return "---";
48 case ePermissionsWritable:
49 return "-w-";
50 case ePermissionsReadable:
51 return "r--";
52 case ePermissionsExecutable:
53 return "--x";
54 case ePermissionsReadable | ePermissionsWritable:
55 return "rw-";
56 case ePermissionsReadable | ePermissionsExecutable:
57 return "r-x";
58 case ePermissionsWritable | ePermissionsExecutable:
59 return "-wx";
60 case ePermissionsReadable | ePermissionsWritable | ePermissionsExecutable:
61 return "rwx";
62 default:
63 break;
65 return "???";
68 bool lldb_private::StateIsRunningState(StateType state) {
69 switch (state) {
70 case eStateAttaching:
71 case eStateLaunching:
72 case eStateRunning:
73 case eStateStepping:
74 return true;
76 case eStateConnected:
77 case eStateDetached:
78 case eStateInvalid:
79 case eStateUnloaded:
80 case eStateStopped:
81 case eStateCrashed:
82 case eStateExited:
83 case eStateSuspended:
84 break;
86 return false;
89 bool lldb_private::StateIsStoppedState(StateType state, bool must_exist) {
90 switch (state) {
91 case eStateInvalid:
92 case eStateConnected:
93 case eStateAttaching:
94 case eStateLaunching:
95 case eStateRunning:
96 case eStateStepping:
97 case eStateDetached:
98 break;
100 case eStateUnloaded:
101 case eStateExited:
102 return !must_exist;
104 case eStateStopped:
105 case eStateCrashed:
106 case eStateSuspended:
107 return true;
109 return false;