Skip to content

Commit 9900332

Browse files
chelcassanovaAnthony Tran
authored andcommitted
[lldb][rpc] Fix bug in convert script for RPC (llvm#145419)
In the script that's used by RPC to convert LLDB headers to LLDB RPC headers, there's a bug with how it converts namespace usage. An overeager regex pattern caused *all* text before any `lldb::` namespace usage to get replaced with `lldb_rpc::` instead of just the namespace itself. This commit changes that regex pattern to be less overeager and modifies one of the shell tests for this script to actually check that the namespace usage replacement is working correctly. rdar://154126268
1 parent b9198a8 commit 9900332

File tree

3 files changed

+7
-1
lines changed

3 files changed

+7
-1
lines changed

lldb/scripts/convert-lldb-header-to-rpc-header.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@
2727
LLDB_NAMESPACE_DEFINITION_REGEX = re.compile(
2828
r"(?P<comment_marker>//\s*){,1}namespace lldb\s{1}", re.M
2929
)
30-
LLDB_NAMESPACE_REGEX = re.compile(r"\s*.+lldb::\s*", re.M)
30+
LLDB_NAMESPACE_REGEX = re.compile(r"lldb::\s*", re.M)
3131

3232

3333
def main():

lldb/test/Shell/RPC/Scripts/TestConvertScript/CheckLLDBEnumerations.test

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,5 +13,8 @@ CHECK: #define LLDB_RPC_ENUMERATIONS_H
1313
# Change the namespace to lldb_rpc. Also, the comment that closes the namespace should match the namespace.
1414
CHECK: namespace lldb_rpc {} // namespace lldb_rpc
1515

16+
# When the lldb namespace is used, the namespace must be replaced with lldb_rpc.
17+
CHECK: void dummyFunction(lldb_rpc::addr_t) {}
18+
1619
# The comment that closes the include guard should match the guard.
1720
CHECK: #endif // LLDB_RPC_ENUMERATIONS_H

lldb/test/Shell/RPC/Scripts/TestConvertScript/Inputs/lldb-enumerations.h

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,9 @@
1111
// namespace lldb -> namespace lldb_rpc
1212
namespace lldb {} // namespace lldb
1313

14+
// When the lldb namespace is used, the namespace must be replaced with lldb_rpc.
15+
void dummyFunction(lldb::addr_t) {}
16+
1417
// The comment that closes the include guard must change in the same way
1518
// the original guard did:
1619
// #endif // LLDB_LLDB_ENUMERATIONS_H -> #endif // LLDB_RPC_ENUMERATIONS_H

0 commit comments

Comments
 (0)