Skip to content

[lldb-dap] Gardening in lldb-dap.cpp (NFC) #128949

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Feb 27, 2025
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 5 additions & 16 deletions lldb/tools/lldb-dap/lldb-dap.cpp
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
//===-- lldb-dap.cpp -----------------------------------------*- C++ -*-===//
//===-- lldb-dap.cpp ------------------------------------------------------===//
//
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
// See https://llvm.org/LICENSE.txt for license information.
Expand All @@ -8,10 +8,7 @@

#include "DAP.h"
#include "EventHelper.h"
#include "FifoFiles.h"
#include "Handler/RequestHandler.h"
#include "JSONUtils.h"
#include "LLDBUtils.h"
#include "RunInTerminal.h"
#include "lldb/API/SBStream.h"
#include "lldb/Host/Config.h"
Expand All @@ -37,22 +34,15 @@
#include "llvm/Support/Signals.h"
#include "llvm/Support/Threading.h"
#include "llvm/Support/raw_ostream.h"
#include <algorithm>
#include <condition_variable>
#include <cstdint>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <fcntl.h>
#include <fstream>
#include <map>
#include <memory>
#include <mutex>
#include <optional>
#include <ostream>
#include <string>
#include <sys/stat.h>
#include <sys/types.h>
#include <thread>
#include <utility>
#include <vector>
Expand Down Expand Up @@ -113,8 +103,9 @@ class LLDBDAPOptTable : public llvm::opt::GenericOptTable {
: llvm::opt::GenericOptTable(OptionStrTable, OptionPrefixesTable,
InfoTable, true) {}
};
} // anonymous namespace

void RegisterRequestCallbacks(DAP &dap) {
static void RegisterRequestCallbacks(DAP &dap) {
dap.RegisterRequest<AttachRequestHandler>();
dap.RegisterRequest<BreakpointLocationsRequestHandler>();
dap.RegisterRequest<CompletionsRequestHandler>();
Expand Down Expand Up @@ -155,9 +146,7 @@ void RegisterRequestCallbacks(DAP &dap) {
dap.RegisterRequest<TestGetTargetBreakpointsRequestHandler>();
}

} // anonymous namespace

static void printHelp(LLDBDAPOptTable &table, llvm::StringRef tool_name) {
static void PrintHelp(LLDBDAPOptTable &table, llvm::StringRef tool_name) {
std::string usage_str = tool_name.str() + " options";
table.printHelp(llvm::outs(), usage_str.c_str(), "LLDB DAP", false);

Expand Down Expand Up @@ -433,7 +422,7 @@ int main(int argc, char *argv[]) {
llvm::opt::InputArgList input_args = T.ParseArgs(ArgsArr, MAI, MAC);

if (input_args.hasArg(OPT_help)) {
printHelp(T, llvm::sys::path::filename(argv[0]));
PrintHelp(T, llvm::sys::path::filename(argv[0]));
return EXIT_SUCCESS;
}

Expand Down