summaryrefslogtreecommitdiff
path: root/lldb/scripts
diff options
context:
space:
mode:
authorChelsea Cassanova <chelsea_cassanova@apple.com>2025-06-04 15:04:36 -0700
committerGitHub <noreply@github.com>2025-06-04 15:04:36 -0700
commite5cfa0a15d58c278be6169aedba817ae5edd2235 (patch)
treec37dc77407802b096b01cf10fa07d1f4eb6d1d25 /lldb/scripts
parentf327d6d4c344956a66002f9364fce9439a8127b3 (diff)
Revert "[lldb][headers] Create script to fix up versioning" (#142864)
Reverts llvm/llvm-project#141116. It's breaking the Xcode build as well as the build on AIX.
Diffstat (limited to 'lldb/scripts')
-rwxr-xr-xlldb/scripts/framework-header-fix.sh6
-rwxr-xr-xlldb/scripts/version-header-fix.py61
2 files changed, 6 insertions, 61 deletions
diff --git a/lldb/scripts/framework-header-fix.sh b/lldb/scripts/framework-header-fix.sh
index 345579c80cdf..3459dd91c9ec 100755
--- a/lldb/scripts/framework-header-fix.sh
+++ b/lldb/scripts/framework-header-fix.sh
@@ -7,5 +7,11 @@ for file in `find $1 -name "*.h"`
do
/usr/bin/sed -i.bak 's/\(#include\)[ ]*"lldb\/\(API\/\)\{0,1\}\(.*\)"/\1 <LLDB\/\3>/1' "$file"
/usr/bin/sed -i.bak 's|<LLDB/Utility|<LLDB|' "$file"
+ LLDB_VERSION=`echo $2 | /usr/bin/sed -E 's/^([0-9]+).([0-9]+).([0-9]+)(.[0-9]+)?$/\\1/g'`
+ LLDB_REVISION=`echo $2 | /usr/bin/sed -E 's/^([0-9]+).([0-9]+).([0-9]+)(.[0-9]+)?$/\\3/g'`
+ LLDB_VERSION_STRING=`echo $2`
+ /usr/bin/sed -i.bak "s|//#define LLDB_VERSION$|#define LLDB_VERSION $LLDB_VERSION |" "$file"
+ /usr/bin/sed -i.bak "s|//#define LLDB_REVISION|#define LLDB_REVISION $LLDB_REVISION |" "$file"
+ /usr/bin/sed -i.bak "s|//#define LLDB_VERSION_STRING|#define LLDB_VERSION_STRING \"$LLDB_VERSION_STRING\" |" "$file"
rm -f "$file.bak"
done
diff --git a/lldb/scripts/version-header-fix.py b/lldb/scripts/version-header-fix.py
deleted file mode 100755
index fb26ee1579e6..000000000000
--- a/lldb/scripts/version-header-fix.py
+++ /dev/null
@@ -1,61 +0,0 @@
-#!/usr/bin/env python3
-"""
-Usage: <path/to/input-header.h> <path/to/output-header.h> LLDB_MAJOR_VERSION LLDB_MINOR_VERSION LLDB_PATCH_VERSION
-
-This script uncomments and populates the versioning information in lldb-defines.h
-"""
-
-import argparse
-import os
-import re
-
-LLDB_VERSION_REGEX = re.compile(r"//\s*#define LLDB_VERSION\s*$", re.M)
-LLDB_REVISION_REGEX = re.compile(r"//\s*#define LLDB_REVISION\s*$", re.M)
-LLDB_VERSION_STRING_REGEX = re.compile(r"//\s*#define LLDB_VERSION_STRING\s*$", re.M)
-
-
-def main():
- parser = argparse.ArgumentParser()
- parser.add_argument("input_path")
- parser.add_argument("output_path")
- parser.add_argument("lldb_version_major")
- parser.add_argument("lldb_version_minor")
- parser.add_argument("lldb_version_patch")
- args = parser.parse_args()
- input_path = str(args.input_path)
- output_path = str(args.output_path)
- lldb_version_major = args.lldb_version_major
- lldb_version_minor = args.lldb_version_minor
- lldb_version_patch = args.lldb_version_patch
-
- with open(input_path, "r") as input_file:
- lines = input_file.readlines()
- file_buffer = "".join(lines)
-
- with open(output_path, "w") as output_file:
- # For the defines in lldb-defines.h that define the major, minor and version string
- # uncomment each define and populate its value using the arguments passed in.
- # e.g. //#define LLDB_VERSION -> #define LLDB_VERSION <LLDB_MAJOR_VERSION>
- file_buffer = re.sub(
- LLDB_VERSION_REGEX,
- r"#define LLDB_VERSION " + lldb_version_major,
- file_buffer,
- )
-
- file_buffer = re.sub(
- LLDB_REVISION_REGEX,
- r"#define LLDB_REVISION " + lldb_version_patch,
- file_buffer,
- )
- file_buffer = re.sub(
- LLDB_VERSION_STRING_REGEX,
- r'#define LLDB_VERSION_STRING "{0}.{1}.{2}"'.format(
- lldb_version_major, lldb_version_minor, lldb_version_patch
- ),
- file_buffer,
- )
- output_file.write(file_buffer)
-
-
-if __name__ == "__main__":
- main()