github-actions[bot] wrote:
<!--LLVM CODE FORMAT COMMENT: {darker}-->
:warning: Python code formatter, darker found issues in your code. :warning:
<details>
<summary>
You can test this locally with the following command:
</summary>
``````````bash
darker --check --diff -r origin/main...HEAD
lldb/scripts/msvc_extract_private_symbols.py
``````````
:warning:
The reproduction instructions above might return results for more than one PR
in a stack if you are using a stacked PR workflow. You can limit the results by
changing `origin/main` to the base branch/commit you want to compare against.
:warning:
</details>
<details>
<summary>
View the diff from darker here.
</summary>
``````````diff
--- msvc_extract_private_symbols.py 2026-06-19 15:15:11.000000 +0000
+++ msvc_extract_private_symbols.py 2026-06-19 15:16:34.176692 +0000
@@ -11,11 +11,13 @@
import re
import subprocess
import sys
-def extract_symbols(nm_path: str, lib: str, regex: re.Pattern[str], nm_flags:
list[str]):
+def extract_symbols(
+ nm_path: str, lib: str, regex: re.Pattern[str], nm_flags: list[str]
+):
"""Extract all of the private lldb symbols from the given path to llvm-nm
and
library to extract from."""
# '-p' do not waste time sorting the symbols.
process = subprocess.Popen(
@@ -47,21 +49,23 @@
def extract_exports(nm_path: str, lib: str):
# Matches mangled symbols containing 'lldb_private'.
regex = re.compile(r"[0-9a-zA-Z]* [BT]
(?P<symbol>[?]+[^?].*lldb_private.*)")
# '-g': Only get the global symbols
- return extract_symbols(nm_path, lib, regex, ['-g'])
+ return extract_symbols(nm_path, lib, regex, ["-g"])
def extract_undef(nm_path: str, lib: str):
# Matches mangled symbols containing 'lldb_private' or 'llvm'.
regex_undef = re.compile(r"^0* +U
(?P<symbol>[?]+[^?].*(?:lldb_private|llvm).*)")
- regex_global = re.compile(r"[0-9a-zA-Z]* [BT]
(?P<symbol>[?]+[^?].*(?:lldb_private|llvm).*)")
+ regex_global = re.compile(
+ r"[0-9a-zA-Z]* [BT] (?P<symbol>[?]+[^?].*(?:lldb_private|llvm).*)"
+ )
# '-u': Only get the undefined symbols
- undef = extract_symbols(nm_path, lib, regex_undef, ['-u'])
+ undef = extract_symbols(nm_path, lib, regex_undef, ["-u"])
# '-g': Only get the global symbols
- globals = extract_symbols(nm_path, lib, regex_global, ['-g'])
+ globals = extract_symbols(nm_path, lib, regex_global, ["-g"])
# If this is a static library, only return symbols undefined in all object
# files.
return undef - globals
@@ -103,19 +107,24 @@
if os.path.exists("lib" + lib + suffix):
lib = "lib" + lib + suffix
break
if not any([lib.endswith(s) for s in suffixes]):
print(
- "Unknown extension type for library argument: " + lib,
file=sys.stderr
+ "Unknown extension type for library argument: " + lib,
+ file=sys.stderr,
)
exit(1)
libs.append((lib, is_consuming))
# Extract symbols from the input libraries.
symbols = set()
- for (lib, is_consuming) in libs:
- symbols |= extract_undef(args.nm, lib) if is_consuming else
extract_exports(args.nm, lib)
+ for lib, is_consuming in libs:
+ symbols |= (
+ extract_undef(args.nm, lib)
+ if is_consuming
+ else extract_exports(args.nm, lib)
+ )
# Write out the symbols to the output file.
with open(args.o, "w", newline="") as f:
for s in sorted(symbols):
f.write(f"{s}\n")
``````````
</details>
https://github.com/llvm/llvm-project/pull/200843
_______________________________________________
lldb-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits