mirror of
https://github.com/Gericom/teak-llvm.git
synced 2025-06-29 08:19:01 -04:00

*** to conform to clang-format’s LLVM style. This kind of mass change has *** two obvious implications: Firstly, merging this particular commit into a downstream fork may be a huge effort. Alternatively, it may be worth merging all changes up to this commit, performing the same reformatting operation locally, and then discarding the merge for this particular commit. The commands used to accomplish this reformatting were as follows (with current working directory as the root of the repository): find . \( -iname "*.c" -or -iname "*.cpp" -or -iname "*.h" -or -iname "*.mm" \) -exec clang-format -i {} + find . -iname "*.py" -exec autopep8 --in-place --aggressive --aggressive {} + ; The version of clang-format used was 3.9.0, and autopep8 was 1.2.4. Secondly, “blame” style tools will generally point to this commit instead of a meaningful prior commit. There are alternatives available that will attempt to look through this change and find the appropriate prior commit. YMMV. llvm-svn: 280751
120 lines
2.7 KiB
C++
120 lines
2.7 KiB
C++
//===-- State.cpp -----------------------------------------------*- C++ -*-===//
|
|
//
|
|
// The LLVM Compiler Infrastructure
|
|
//
|
|
// This file is distributed under the University of Illinois Open Source
|
|
// License. See LICENSE.TXT for details.
|
|
//
|
|
//===----------------------------------------------------------------------===//
|
|
|
|
// C Includes
|
|
// C++ Includes
|
|
// Other libraries and framework includes
|
|
// Project includes
|
|
#include "lldb/Core/State.h"
|
|
#include <stdio.h>
|
|
|
|
using namespace lldb;
|
|
using namespace lldb_private;
|
|
|
|
const char *lldb_private::StateAsCString(StateType state) {
|
|
switch (state) {
|
|
case eStateInvalid:
|
|
return "invalid";
|
|
case eStateUnloaded:
|
|
return "unloaded";
|
|
case eStateConnected:
|
|
return "connected";
|
|
case eStateAttaching:
|
|
return "attaching";
|
|
case eStateLaunching:
|
|
return "launching";
|
|
case eStateStopped:
|
|
return "stopped";
|
|
case eStateRunning:
|
|
return "running";
|
|
case eStateStepping:
|
|
return "stepping";
|
|
case eStateCrashed:
|
|
return "crashed";
|
|
case eStateDetached:
|
|
return "detached";
|
|
case eStateExited:
|
|
return "exited";
|
|
case eStateSuspended:
|
|
return "suspended";
|
|
}
|
|
static char unknown_state_string[64];
|
|
snprintf(unknown_state_string, sizeof(unknown_state_string), "StateType = %i",
|
|
state);
|
|
return unknown_state_string;
|
|
}
|
|
|
|
const char *lldb_private::GetPermissionsAsCString(uint32_t permissions) {
|
|
switch (permissions) {
|
|
case 0:
|
|
return "---";
|
|
case ePermissionsWritable:
|
|
return "-w-";
|
|
case ePermissionsReadable:
|
|
return "r--";
|
|
case ePermissionsExecutable:
|
|
return "--x";
|
|
case ePermissionsReadable | ePermissionsWritable:
|
|
return "rw-";
|
|
case ePermissionsReadable | ePermissionsExecutable:
|
|
return "r-x";
|
|
case ePermissionsWritable | ePermissionsExecutable:
|
|
return "-wx";
|
|
case ePermissionsReadable | ePermissionsWritable | ePermissionsExecutable:
|
|
return "rwx";
|
|
default:
|
|
break;
|
|
}
|
|
return "???";
|
|
}
|
|
|
|
bool lldb_private::StateIsRunningState(StateType state) {
|
|
switch (state) {
|
|
case eStateAttaching:
|
|
case eStateLaunching:
|
|
case eStateRunning:
|
|
case eStateStepping:
|
|
return true;
|
|
|
|
case eStateConnected:
|
|
case eStateDetached:
|
|
case eStateInvalid:
|
|
case eStateUnloaded:
|
|
case eStateStopped:
|
|
case eStateCrashed:
|
|
case eStateExited:
|
|
case eStateSuspended:
|
|
break;
|
|
}
|
|
return false;
|
|
}
|
|
|
|
bool lldb_private::StateIsStoppedState(StateType state, bool must_exist) {
|
|
switch (state) {
|
|
case eStateInvalid:
|
|
case eStateConnected:
|
|
case eStateAttaching:
|
|
case eStateLaunching:
|
|
case eStateRunning:
|
|
case eStateStepping:
|
|
case eStateDetached:
|
|
break;
|
|
|
|
case eStateUnloaded:
|
|
case eStateExited:
|
|
return !must_exist;
|
|
|
|
case eStateStopped:
|
|
case eStateCrashed:
|
|
case eStateSuspended:
|
|
return true;
|
|
}
|
|
return false;
|
|
}
|