[Lldb-commits] [lldb] 06b90e2 - Fix lldb option handling since e953ae5bbc313fd0cc980ce021d487e5b5199ea4 (part 2)

via lldb-commits lldb-commits at lists.llvm.org
Sat Dec 24 03:54:34 PST 2022


Author: serge-sans-paille
Date: 2022-12-24T12:54:14+01:00
New Revision: 06b90e2e9c991e211fecc97948e533320a825470

URL: https://github.com/llvm/llvm-project/commit/06b90e2e9c991e211fecc97948e533320a825470
DIFF: https://github.com/llvm/llvm-project/commit/06b90e2e9c991e211fecc97948e533320a825470.diff

LOG: Fix lldb option handling since e953ae5bbc313fd0cc980ce021d487e5b5199ea4 (part 2)

Option tables are no longer null-terminated.

This is a follow-up to https://reviews.llvm.org/D139881

Added: 
    

Modified: 
    lldb/tools/lldb-server/lldb-gdbserver.cpp
    lldb/tools/lldb-vscode/lldb-vscode.cpp

Removed: 
    


################################################################################
diff  --git a/lldb/tools/lldb-server/lldb-gdbserver.cpp b/lldb/tools/lldb-server/lldb-gdbserver.cpp
index 8565c39efe9b6..625fa8c2d710b 100644
--- a/lldb/tools/lldb-server/lldb-gdbserver.cpp
+++ b/lldb/tools/lldb-server/lldb-gdbserver.cpp
@@ -278,7 +278,10 @@ enum ID {
 #undef OPTION
 };
 
-#define PREFIX(NAME, VALUE) constexpr llvm::StringLiteral NAME[] = VALUE;
+#define PREFIX(NAME, VALUE)                                                    \
+  constexpr llvm::StringLiteral NAME##_init[] = VALUE;                         \
+  constexpr llvm::ArrayRef<llvm::StringLiteral> NAME(                          \
+      NAME##_init, std::size(NAME##_init) - 1);
 #include "LLGSOptions.inc"
 #undef PREFIX
 

diff  --git a/lldb/tools/lldb-vscode/lldb-vscode.cpp b/lldb/tools/lldb-vscode/lldb-vscode.cpp
index b2b7ea4e1d825..31b364bbf434b 100644
--- a/lldb/tools/lldb-vscode/lldb-vscode.cpp
+++ b/lldb/tools/lldb-vscode/lldb-vscode.cpp
@@ -79,7 +79,10 @@ enum ID {
 #undef OPTION
 };
 
-#define PREFIX(NAME, VALUE) constexpr llvm::StringLiteral NAME[] = VALUE;
+#define PREFIX(NAME, VALUE)                                                    \
+  static constexpr llvm::StringLiteral NAME##_init[] = VALUE;                  \
+  static constexpr llvm::ArrayRef<llvm::StringLiteral> NAME(                   \
+      NAME##_init, std::size(NAME##_init) - 1);
 #include "Options.inc"
 #undef PREFIX
 


        


More information about the lldb-commits mailing list