Skip to content

Commit c499355

Browse files
committed
move DAPTypes to a namespace
1 parent 1ddd26b commit c499355

File tree

9 files changed

+22
-25
lines changed

9 files changed

+22
-25
lines changed

lldb/tools/lldb-dap/Breakpoint.cpp

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -25,9 +25,9 @@
2525

2626
using namespace lldb_dap;
2727

28-
static std::optional<protocol::PersistenceData>
28+
static std::optional<protocol::dap::PersistenceData>
2929
GetPersistenceDataForSymbol(lldb::SBSymbol &symbol) {
30-
protocol::PersistenceData persistence_data;
30+
protocol::dap::PersistenceData persistence_data;
3131
lldb::SBModule module = symbol.GetStartAddress().GetModule();
3232
if (!module.IsValid())
3333
return std::nullopt;
@@ -105,11 +105,11 @@ protocol::Breakpoint Breakpoint::ToProtocolBreakpoint() {
105105

106106
// Add persistent data so that the breakpoint can be resolved
107107
// in future sessions.
108-
std::optional<protocol::PersistenceData> persistence_data =
108+
std::optional<protocol::dap::PersistenceData> persistence_data =
109109
GetPersistenceDataForSymbol(symbol);
110110
if (persistence_data) {
111111
source->adapterData =
112-
protocol::SourceLLDBData{std::move(persistence_data)};
112+
protocol::dap::SourceLLDBData{std::move(persistence_data)};
113113
}
114114
}
115115
}

lldb/tools/lldb-dap/Handler/DAPGetModuleSymbolsRequestHandler.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -120,7 +120,7 @@ DAPGetModuleSymbolsRequestHandler::Run(
120120
if (!module_spec.IsValid())
121121
return response;
122122

123-
std::vector<DAPSymbol> &symbols = response.symbols;
123+
std::vector<dap::Symbol> &symbols = response.symbols;
124124
lldb::SBModule module = dap.target.FindModule(module_spec);
125125
if (!module.IsValid())
126126
return llvm::make_error<DAPError>("Module not found");
@@ -131,7 +131,7 @@ DAPGetModuleSymbolsRequestHandler::Run(
131131
if (!symbol.IsValid())
132132
continue;
133133

134-
DAPSymbol dap_symbol;
134+
dap::Symbol dap_symbol;
135135
dap_symbol.userId = symbol.GetID();
136136
dap_symbol.type = SymbolTypeToString(symbol.GetType());
137137
dap_symbol.isDebug = symbol.IsDebug();

lldb/tools/lldb-dap/Protocol/DAPTypes.cpp

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
using namespace llvm;
44

5-
namespace lldb_dap::protocol {
5+
namespace lldb_dap::protocol::dap {
66

77
bool fromJSON(const llvm::json::Value &Params, PersistenceData &PD,
88
llvm::json::Path P) {
@@ -33,7 +33,7 @@ llvm::json::Value toJSON(const SourceLLDBData &SLD) {
3333
return result;
3434
}
3535

36-
bool fromJSON(const llvm::json::Value &Params, DAPSymbol &DS,
36+
bool fromJSON(const llvm::json::Value &Params, Symbol &DS,
3737
llvm::json::Path P) {
3838
json::ObjectMapper O(Params, P);
3939
return O && O.map("userId", DS.userId) && O.map("isDebug", DS.isDebug) &&
@@ -44,7 +44,7 @@ bool fromJSON(const llvm::json::Value &Params, DAPSymbol &DS,
4444
O.map("size", DS.size) && O.map("name", DS.name);
4545
}
4646

47-
llvm::json::Value toJSON(const DAPSymbol &DS) {
47+
llvm::json::Value toJSON(const Symbol &DS) {
4848
json::Object result{
4949
{"userId", DS.userId},
5050
{"isDebug", DS.isDebug},
@@ -60,4 +60,4 @@ llvm::json::Value toJSON(const DAPSymbol &DS) {
6060
return result;
6161
}
6262

63-
} // namespace lldb_dap::protocol
63+
} // namespace lldb_dap::protocol::dap

lldb/tools/lldb-dap/Protocol/DAPTypes.h

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@
2121
#include <optional>
2222
#include <string>
2323

24-
namespace lldb_dap::protocol {
24+
namespace lldb_dap::protocol::dap {
2525

2626
/// Data used to help lldb-dap resolve breakpoints persistently across different
2727
/// sessions. This information is especially useful for assembly breakpoints,
@@ -48,7 +48,7 @@ struct SourceLLDBData {
4848
bool fromJSON(const llvm::json::Value &, SourceLLDBData &, llvm::json::Path);
4949
llvm::json::Value toJSON(const SourceLLDBData &);
5050

51-
struct DAPSymbol {
51+
struct Symbol {
5252
/// The symbol uid.
5353
uint32_t userId;
5454

@@ -77,9 +77,9 @@ struct DAPSymbol {
7777
/// The symbol name.
7878
std::string name;
7979
};
80-
bool fromJSON(const llvm::json::Value &, DAPSymbol &, llvm::json::Path);
81-
llvm::json::Value toJSON(const DAPSymbol &);
80+
bool fromJSON(const llvm::json::Value &, Symbol &, llvm::json::Path);
81+
llvm::json::Value toJSON(const Symbol &);
8282

83-
} // namespace lldb_dap::protocol
83+
} // namespace lldb_dap::protocol::dap
8484

8585
#endif

lldb/tools/lldb-dap/Protocol/ProtocolRequests.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -994,7 +994,7 @@ bool fromJSON(const llvm::json::Value &, DAPGetModuleSymbolsArguments &,
994994
/// Response to `getModuleSymbols` request.
995995
struct DAPGetModuleSymbolsResponseBody {
996996
/// The symbols for the specified module.
997-
std::vector<DAPSymbol> symbols;
997+
std::vector<dap::Symbol> symbols;
998998
};
999999
llvm::json::Value toJSON(const DAPGetModuleSymbolsResponseBody &);
10001000

lldb/tools/lldb-dap/Protocol/ProtocolTypes.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -340,7 +340,7 @@ struct Source {
340340
/// Additional data that a debug adapter might want to loop through the
341341
/// client. The client should leave the data intact and persist it across
342342
/// sessions. The client should not interpret the data.
343-
std::optional<SourceLLDBData> adapterData;
343+
std::optional<dap::SourceLLDBData> adapterData;
344344

345345
// unsupported keys: origin, sources, checksums
346346
};

lldb/tools/lldb-dap/SourceBreakpoint.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -120,7 +120,7 @@ llvm::Error SourceBreakpoint::CreateAssemblyBreakpointWithSourceReference(
120120
}
121121

122122
llvm::Error SourceBreakpoint::CreateAssemblyBreakpointWithPersistenceData(
123-
const protocol::PersistenceData &persistence_data) {
123+
const protocol::dap::PersistenceData &persistence_data) {
124124
lldb::SBFileSpec file_spec(persistence_data.module_path.c_str());
125125
lldb::SBFileSpecList comp_unit_list;
126126
lldb::SBFileSpecList file_spec_list;

lldb/tools/lldb-dap/SourceBreakpoint.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ class SourceBreakpoint : public Breakpoint {
5555
llvm::Error
5656
CreateAssemblyBreakpointWithSourceReference(int64_t source_reference);
5757
llvm::Error CreateAssemblyBreakpointWithPersistenceData(
58-
const protocol::PersistenceData &persistence_data);
58+
const protocol::dap::PersistenceData &persistence_data);
5959

6060
// logMessage part can be either a raw text or an expression.
6161
struct LogMessagePart {

lldb/unittests/DAP/DAPTypesTest.cpp

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -8,17 +8,14 @@
88

99
#include "Protocol/DAPTypes.h"
1010
#include "TestingSupport/TestUtilities.h"
11-
#include "llvm/ADT/StringRef.h"
12-
#include "llvm/Support/JSON.h"
1311
#include "llvm/Testing/Support/Error.h"
14-
#include "gmock/gmock.h"
1512
#include "gtest/gtest.h"
1613
#include <optional>
1714

1815
using namespace llvm;
1916
using namespace lldb;
2017
using namespace lldb_dap;
21-
using namespace lldb_dap::protocol;
18+
using namespace lldb_dap::protocol::dap;
2219
using lldb_private::roundtripJSON;
2320

2421
TEST(DAPTypesTest, SourceLLDBData) {
@@ -36,7 +33,7 @@ TEST(DAPTypesTest, SourceLLDBData) {
3633
}
3734

3835
TEST(DAPTypesTest, DAPSymbol) {
39-
DAPSymbol symbol;
36+
Symbol symbol;
4037
symbol.userId = 42;
4138
symbol.isDebug = true;
4239
symbol.isExternal = false;
@@ -47,7 +44,7 @@ TEST(DAPTypesTest, DAPSymbol) {
4744
symbol.size = 64;
4845
symbol.name = "testSymbol";
4946

50-
llvm::Expected<DAPSymbol> deserialized_symbol = roundtripJSON(symbol);
47+
llvm::Expected<Symbol> deserialized_symbol = roundtripJSON(symbol);
5148
ASSERT_THAT_EXPECTED(deserialized_symbol, llvm::Succeeded());
5249

5350
EXPECT_EQ(symbol.userId, deserialized_symbol->userId);

0 commit comments

Comments
 (0)