[lldb][NFC] Fix all formatting errors in .cpp file headers
Summary:
A *.cpp file header in LLDB (and in LLDB) should like this:
```
//===-- TestUtilities.cpp -------------------------------------------------===//
```
However in LLDB most of our source files have arbitrary changes to this format and
these changes are spreading through LLDB as folks usually just use the existing
source files as templates for their new files (most notably the unnecessary
editor language indicator `-*- C++ -*-` is spreading and in every review
someone is pointing out that this is wrong, resulting in people pointing out that this
is done in the same way in other files).
This patch removes most of these inconsistencies including the editor language indicators,
all the different missing/additional '-' characters, files that center the file name, missing
trailing `===//` (mostly caused by clang-format breaking the line).
Reviewers: aprantl, espindola, jfb, shafik, JDevlieghere
Reviewed By: JDevlieghere
Subscribers: dexonsmith, wuzish, emaste, sdardis, nemanjai, kbarton, MaskRay, atanasyan, arphaman, jfb, abidh, jsji, JDevlieghere, usaxena95, lldb-commits
Tags: #lldb
Differential Revision: https://reviews.llvm.org/D73258
2020-01-24 15:23:27 +08:00
|
|
|
//===-- State.cpp ---------------------------------------------------------===//
|
2010-06-09 00:52:24 +08:00
|
|
|
//
|
2019-01-19 16:50:56 +08:00
|
|
|
// 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
|
2010-06-09 00:52:24 +08:00
|
|
|
//
|
|
|
|
//===----------------------------------------------------------------------===//
|
|
|
|
|
2018-08-07 19:07:21 +08:00
|
|
|
#include "lldb/Utility/State.h"
|
2010-06-09 00:52:24 +08:00
|
|
|
|
|
|
|
using namespace lldb;
|
|
|
|
using namespace lldb_private;
|
|
|
|
|
|
|
|
const char *lldb_private::StateAsCString(StateType state) {
|
|
|
|
switch (state) {
|
2010-10-18 09:45:30 +08:00
|
|
|
case eStateInvalid:
|
|
|
|
return "invalid";
|
|
|
|
case eStateUnloaded:
|
|
|
|
return "unloaded";
|
2011-02-04 09:58:07 +08:00
|
|
|
case eStateConnected:
|
|
|
|
return "connected";
|
2010-10-18 09:45:30 +08:00
|
|
|
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";
|
2010-06-09 00:52:24 +08:00
|
|
|
}
|
2017-01-24 19:48:25 +08:00
|
|
|
return "unknown";
|
2010-06-09 00:52:24 +08:00
|
|
|
}
|
|
|
|
|
2011-05-17 11:37:42 +08:00
|
|
|
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 "???";
|
|
|
|
}
|
|
|
|
|
2010-06-09 00:52:24 +08:00
|
|
|
bool lldb_private::StateIsRunningState(StateType state) {
|
|
|
|
switch (state) {
|
|
|
|
case eStateAttaching:
|
|
|
|
case eStateLaunching:
|
|
|
|
case eStateRunning:
|
|
|
|
case eStateStepping:
|
|
|
|
return true;
|
|
|
|
|
2011-02-04 09:58:07 +08:00
|
|
|
case eStateConnected:
|
2010-06-09 00:52:24 +08:00
|
|
|
case eStateDetached:
|
|
|
|
case eStateInvalid:
|
|
|
|
case eStateUnloaded:
|
|
|
|
case eStateStopped:
|
|
|
|
case eStateCrashed:
|
|
|
|
case eStateExited:
|
|
|
|
case eStateSuspended:
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
2011-11-17 09:23:07 +08:00
|
|
|
bool lldb_private::StateIsStoppedState(StateType state, bool must_exist) {
|
2010-06-09 00:52:24 +08:00
|
|
|
switch (state) {
|
|
|
|
case eStateInvalid:
|
2011-02-04 09:58:07 +08:00
|
|
|
case eStateConnected:
|
2010-06-09 00:52:24 +08:00
|
|
|
case eStateAttaching:
|
|
|
|
case eStateLaunching:
|
|
|
|
case eStateRunning:
|
|
|
|
case eStateStepping:
|
|
|
|
case eStateDetached:
|
|
|
|
break;
|
|
|
|
|
|
|
|
case eStateUnloaded:
|
2011-11-17 09:23:07 +08:00
|
|
|
case eStateExited:
|
|
|
|
return !must_exist;
|
|
|
|
|
2010-06-09 00:52:24 +08:00
|
|
|
case eStateStopped:
|
|
|
|
case eStateCrashed:
|
|
|
|
case eStateSuspended:
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
return false;
|
|
|
|
}
|