Skip to content

Commit 7382a6a

Browse files
committed
[lldb][scripts] Fix bugs in framework fix script
The script used to fix up LLDB's header for use in the macOS framework contained 2 bugs that this commit addresss: 1. The output contents were appended to the output file multiple times instead of only being written once. 2. The script was not considering LLDB includes that were *not* from the SB API. This commit address and fixes both of these bugs and updates the corresponding test to match.
1 parent f2991bf commit 7382a6a

File tree

3 files changed

+4
-2
lines changed

3 files changed

+4
-2
lines changed

lldb/scripts/framework-header-fix.py

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

2121
# Main header regexes
2222
INCLUDE_FILENAME_REGEX = re.compile(
23-
r'#include "lldb/API/(?P<include_filename>.*){0,1}"'
23+
r'#include "lldb/(API/)?(?P<include_filename>.*){0,1}"'
2424
)
2525

2626
# RPC header regexes
@@ -70,7 +70,7 @@ def modify_main_includes(input_file_path, output_file_path):
7070
r"#include <LLDB/" + match.group("include_filename") + ">",
7171
file_buffer,
7272
)
73-
output_file.write(file_buffer)
73+
output_file.write(file_buffer)
7474

7575

7676
def remove_guards(output_file_path, unifdef_path, unifdef_guards):

lldb/test/Shell/Scripts/Inputs/Main/SBAddress.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
// e.g. #include "lldb/API/SBDefines.h" -> #include <LLDB/SBDefines.h>
77
#include "lldb/API/SBDefines.h"
88
#include "lldb/API/SBModule.h"
9+
#include "lldb/lldb-types.h"
910

1011
// Any include guards specified at the command line must be removed.
1112
#ifndef SWIG

lldb/test/Shell/Scripts/TestFrameworkFixScript.test

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,3 +9,4 @@ RUN: cat %t/Outputs/SBAddress.h | FileCheck %s
99
# e.g. #include "lldb/API/SBDefines.h" -> #include <LLDB/SBDefines.h>
1010
CHECK: #include <LLDB/SBDefines.h>
1111
CHECK: #include <LLDB/SBModule.h>
12+
CHECK: #include <LLDB/lldb-types.h>

0 commit comments

Comments
 (0)