Skip to content

Commit 06b90e2

Browse files
Fix lldb option handling since e953ae5 (part 2)
Option tables are no longer null-terminated. This is a follow-up to https://reviews.llvm.org/D139881
1 parent caa7135 commit 06b90e2

File tree

2 files changed

+8
-2
lines changed

2 files changed

+8
-2
lines changed

lldb/tools/lldb-server/lldb-gdbserver.cpp

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -278,7 +278,10 @@ enum ID {
278278
#undef OPTION
279279
};
280280

281-
#define PREFIX(NAME, VALUE) constexpr llvm::StringLiteral NAME[] = VALUE;
281+
#define PREFIX(NAME, VALUE) \
282+
constexpr llvm::StringLiteral NAME##_init[] = VALUE; \
283+
constexpr llvm::ArrayRef<llvm::StringLiteral> NAME( \
284+
NAME##_init, std::size(NAME##_init) - 1);
282285
#include "LLGSOptions.inc"
283286
#undef PREFIX
284287

lldb/tools/lldb-vscode/lldb-vscode.cpp

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,10 @@ enum ID {
7979
#undef OPTION
8080
};
8181

82-
#define PREFIX(NAME, VALUE) constexpr llvm::StringLiteral NAME[] = VALUE;
82+
#define PREFIX(NAME, VALUE) \
83+
static constexpr llvm::StringLiteral NAME##_init[] = VALUE; \
84+
static constexpr llvm::ArrayRef<llvm::StringLiteral> NAME( \
85+
NAME##_init, std::size(NAME##_init) - 1);
8386
#include "Options.inc"
8487
#undef PREFIX
8588

0 commit comments

Comments
 (0)