[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 08:23:27 +01:00
|
|
|
//===-- CommandObjectVersion.cpp ------------------------------------------===//
|
2010-12-23 20:21:44 +00:00
|
|
|
//
|
2019-01-19 08:50:56 +00: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-12-23 20:21:44 +00:00
|
|
|
//
|
|
|
|
|
//===----------------------------------------------------------------------===//
|
|
|
|
|
|
|
|
|
|
#include "CommandObjectVersion.h"
|
|
|
|
|
|
[lldb] Dump build configuration with `version -v` (#170772)
Add a verbose option to the version command and include the "build
configuration" in the command output. This allows users to quickly
identify if their version of LLDB was built with support for
xml/curl/python/lua etc. This data is already available through the SB
API using SBDebugger::GetBuildConfiguration, but this makes it more
discoverable.
```
(lldb) version -v
lldb version 22.0.0git (git@github.com:llvm/llvm-project.git revision 21a2aac5e5456f9181384406f3b3fcad621a7076)
clang revision 21a2aac5e5456f9181384406f3b3fcad621a7076
llvm revision 21a2aac5e5456f9181384406f3b3fcad621a7076
editline_wchar: yes
lzma: yes
curses: yes
editline: yes
fbsdvmcore: yes
xml: yes
lua: yes
python: yes
targets: [AArch64, AMDGPU, ARM, AVR, BPF, Hexagon, Lanai, LoongArch, Mips, MSP430, NVPTX, PowerPC, RISCV, Sparc, SPIRV, SystemZ, VE, WebAssembly, X86, XCore]
curl: yes
```
Resolves #170727
2025-12-08 10:11:39 -08:00
|
|
|
#include "lldb/Core/Debugger.h"
|
2010-12-23 20:21:44 +00:00
|
|
|
#include "lldb/Interpreter/CommandReturnObject.h"
|
2021-12-08 12:23:57 -08:00
|
|
|
#include "lldb/Version/Version.h"
|
[lldb] Dump build configuration with `version -v` (#170772)
Add a verbose option to the version command and include the "build
configuration" in the command output. This allows users to quickly
identify if their version of LLDB was built with support for
xml/curl/python/lua etc. This data is already available through the SB
API using SBDebugger::GetBuildConfiguration, but this makes it more
discoverable.
```
(lldb) version -v
lldb version 22.0.0git (git@github.com:llvm/llvm-project.git revision 21a2aac5e5456f9181384406f3b3fcad621a7076)
clang revision 21a2aac5e5456f9181384406f3b3fcad621a7076
llvm revision 21a2aac5e5456f9181384406f3b3fcad621a7076
editline_wchar: yes
lzma: yes
curses: yes
editline: yes
fbsdvmcore: yes
xml: yes
lua: yes
python: yes
targets: [AArch64, AMDGPU, ARM, AVR, BPF, Hexagon, Lanai, LoongArch, Mips, MSP430, NVPTX, PowerPC, RISCV, Sparc, SPIRV, SystemZ, VE, WebAssembly, X86, XCore]
curl: yes
```
Resolves #170727
2025-12-08 10:11:39 -08:00
|
|
|
#include "llvm/ADT/StringExtras.h"
|
2010-12-23 20:21:44 +00:00
|
|
|
|
|
|
|
|
using namespace lldb;
|
|
|
|
|
using namespace lldb_private;
|
|
|
|
|
|
[lldb] Dump build configuration with `version -v` (#170772)
Add a verbose option to the version command and include the "build
configuration" in the command output. This allows users to quickly
identify if their version of LLDB was built with support for
xml/curl/python/lua etc. This data is already available through the SB
API using SBDebugger::GetBuildConfiguration, but this makes it more
discoverable.
```
(lldb) version -v
lldb version 22.0.0git (git@github.com:llvm/llvm-project.git revision 21a2aac5e5456f9181384406f3b3fcad621a7076)
clang revision 21a2aac5e5456f9181384406f3b3fcad621a7076
llvm revision 21a2aac5e5456f9181384406f3b3fcad621a7076
editline_wchar: yes
lzma: yes
curses: yes
editline: yes
fbsdvmcore: yes
xml: yes
lua: yes
python: yes
targets: [AArch64, AMDGPU, ARM, AVR, BPF, Hexagon, Lanai, LoongArch, Mips, MSP430, NVPTX, PowerPC, RISCV, Sparc, SPIRV, SystemZ, VE, WebAssembly, X86, XCore]
curl: yes
```
Resolves #170727
2025-12-08 10:11:39 -08:00
|
|
|
#define LLDB_OPTIONS_version
|
|
|
|
|
#include "CommandOptions.inc"
|
|
|
|
|
|
|
|
|
|
llvm::ArrayRef<OptionDefinition>
|
|
|
|
|
CommandObjectVersion::CommandOptions::GetDefinitions() {
|
|
|
|
|
return llvm::ArrayRef(g_version_options);
|
|
|
|
|
}
|
2010-12-23 20:21:44 +00:00
|
|
|
|
2016-07-14 22:03:10 +00:00
|
|
|
CommandObjectVersion::CommandObjectVersion(CommandInterpreter &interpreter)
|
|
|
|
|
: CommandObjectParsed(interpreter, "version",
|
|
|
|
|
"Show the LLDB debugger version.", "version") {}
|
2016-09-06 20:57:50 +00:00
|
|
|
|
2021-07-02 11:27:37 -07:00
|
|
|
CommandObjectVersion::~CommandObjectVersion() = default;
|
2016-09-06 20:57:50 +00:00
|
|
|
|
[lldb] Dump build configuration with `version -v` (#170772)
Add a verbose option to the version command and include the "build
configuration" in the command output. This allows users to quickly
identify if their version of LLDB was built with support for
xml/curl/python/lua etc. This data is already available through the SB
API using SBDebugger::GetBuildConfiguration, but this makes it more
discoverable.
```
(lldb) version -v
lldb version 22.0.0git (git@github.com:llvm/llvm-project.git revision 21a2aac5e5456f9181384406f3b3fcad621a7076)
clang revision 21a2aac5e5456f9181384406f3b3fcad621a7076
llvm revision 21a2aac5e5456f9181384406f3b3fcad621a7076
editline_wchar: yes
lzma: yes
curses: yes
editline: yes
fbsdvmcore: yes
xml: yes
lua: yes
python: yes
targets: [AArch64, AMDGPU, ARM, AVR, BPF, Hexagon, Lanai, LoongArch, Mips, MSP430, NVPTX, PowerPC, RISCV, Sparc, SPIRV, SystemZ, VE, WebAssembly, X86, XCore]
curl: yes
```
Resolves #170727
2025-12-08 10:11:39 -08:00
|
|
|
// Dump the array values on a single line.
|
|
|
|
|
static void dump(const StructuredData::Array &array, Stream &s) {
|
|
|
|
|
std::vector<std::string> values;
|
|
|
|
|
array.ForEach([&](StructuredData::Object *object) -> bool {
|
|
|
|
|
values.emplace_back(object->GetStringValue().str());
|
|
|
|
|
return true;
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
s << '[' << llvm::join(values, ", ") << ']';
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// The default dump output is too verbose.
|
|
|
|
|
static void dump(const StructuredData::Dictionary &config, Stream &s) {
|
|
|
|
|
config.ForEach(
|
|
|
|
|
[&](llvm::StringRef key, StructuredData::Object *object) -> bool {
|
|
|
|
|
assert(object);
|
|
|
|
|
|
|
|
|
|
StructuredData::Dictionary *value_dict = object->GetAsDictionary();
|
|
|
|
|
assert(value_dict);
|
|
|
|
|
|
|
|
|
|
StructuredData::ObjectSP value_sp = value_dict->GetValueForKey("value");
|
|
|
|
|
assert(value_sp);
|
|
|
|
|
|
|
|
|
|
s << " " << key << ": ";
|
|
|
|
|
if (StructuredData::Boolean *boolean = value_sp->GetAsBoolean())
|
|
|
|
|
s << (boolean ? "yes" : "no");
|
|
|
|
|
else if (StructuredData::Array *array = value_sp->GetAsArray())
|
|
|
|
|
dump(*array, s);
|
|
|
|
|
s << '\n';
|
|
|
|
|
|
|
|
|
|
return true;
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
|
2023-10-30 10:21:00 -10:00
|
|
|
void CommandObjectVersion::DoExecute(Args &args, CommandReturnObject &result) {
|
2022-06-23 09:33:40 -07:00
|
|
|
result.AppendMessageWithFormat("%s\n", lldb_private::GetVersion());
|
[lldb] Dump build configuration with `version -v` (#170772)
Add a verbose option to the version command and include the "build
configuration" in the command output. This allows users to quickly
identify if their version of LLDB was built with support for
xml/curl/python/lua etc. This data is already available through the SB
API using SBDebugger::GetBuildConfiguration, but this makes it more
discoverable.
```
(lldb) version -v
lldb version 22.0.0git (git@github.com:llvm/llvm-project.git revision 21a2aac5e5456f9181384406f3b3fcad621a7076)
clang revision 21a2aac5e5456f9181384406f3b3fcad621a7076
llvm revision 21a2aac5e5456f9181384406f3b3fcad621a7076
editline_wchar: yes
lzma: yes
curses: yes
editline: yes
fbsdvmcore: yes
xml: yes
lua: yes
python: yes
targets: [AArch64, AMDGPU, ARM, AVR, BPF, Hexagon, Lanai, LoongArch, Mips, MSP430, NVPTX, PowerPC, RISCV, Sparc, SPIRV, SystemZ, VE, WebAssembly, X86, XCore]
curl: yes
```
Resolves #170727
2025-12-08 10:11:39 -08:00
|
|
|
|
|
|
|
|
if (m_options.verbose)
|
|
|
|
|
dump(*Debugger::GetBuildConfiguration(), result.GetOutputStream());
|
|
|
|
|
|
2022-06-23 09:33:40 -07:00
|
|
|
result.SetStatus(eReturnStatusSuccessFinishResult);
|
2010-12-23 20:21:44 +00:00
|
|
|
}
|