https://github.com/chelcassanova updated https://github.com/llvm/llvm-project/pull/145961
>From 7382a6a7e5636515c4882136d54c8133d77aa31d Mon Sep 17 00:00:00 2001 From: Chelsea Cassanova <chelsea_cassan...@apple.com> Date: Thu, 26 Jun 2025 13:05:56 -0700 Subject: [PATCH] [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. --- lldb/scripts/framework-header-fix.py | 4 ++-- lldb/test/Shell/Scripts/Inputs/Main/SBAddress.h | 1 + lldb/test/Shell/Scripts/TestFrameworkFixScript.test | 1 + 3 files changed, 4 insertions(+), 2 deletions(-) diff --git a/lldb/scripts/framework-header-fix.py b/lldb/scripts/framework-header-fix.py index 9528fdb7e30bd..d8c38511f19af 100755 --- a/lldb/scripts/framework-header-fix.py +++ b/lldb/scripts/framework-header-fix.py @@ -20,7 +20,7 @@ # Main header regexes INCLUDE_FILENAME_REGEX = re.compile( - r'#include "lldb/API/(?P<include_filename>.*){0,1}"' + r'#include "lldb/(API/)?(?P<include_filename>.*){0,1}"' ) # RPC header regexes @@ -70,7 +70,7 @@ def modify_main_includes(input_file_path, output_file_path): r"#include <LLDB/" + match.group("include_filename") + ">", file_buffer, ) - output_file.write(file_buffer) + output_file.write(file_buffer) def remove_guards(output_file_path, unifdef_path, unifdef_guards): diff --git a/lldb/test/Shell/Scripts/Inputs/Main/SBAddress.h b/lldb/test/Shell/Scripts/Inputs/Main/SBAddress.h index fecc69687cd74..a15dd9d2a942e 100644 --- a/lldb/test/Shell/Scripts/Inputs/Main/SBAddress.h +++ b/lldb/test/Shell/Scripts/Inputs/Main/SBAddress.h @@ -6,6 +6,7 @@ // e.g. #include "lldb/API/SBDefines.h" -> #include <LLDB/SBDefines.h> #include "lldb/API/SBDefines.h" #include "lldb/API/SBModule.h" +#include "lldb/lldb-types.h" // Any include guards specified at the command line must be removed. #ifndef SWIG diff --git a/lldb/test/Shell/Scripts/TestFrameworkFixScript.test b/lldb/test/Shell/Scripts/TestFrameworkFixScript.test index e90c3bdfc5adb..5c48b796efda4 100644 --- a/lldb/test/Shell/Scripts/TestFrameworkFixScript.test +++ b/lldb/test/Shell/Scripts/TestFrameworkFixScript.test @@ -9,3 +9,4 @@ RUN: cat %t/Outputs/SBAddress.h | FileCheck %s # e.g. #include "lldb/API/SBDefines.h" -> #include <LLDB/SBDefines.h> CHECK: #include <LLDB/SBDefines.h> CHECK: #include <LLDB/SBModule.h> +CHECK: #include <LLDB/lldb-types.h> _______________________________________________ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits