[lld] [lld][ELF] Implement merged .debug_names section (PR #88092)
via llvm-commits
llvm-commits at lists.llvm.org
Tue Apr 16 15:58:06 PDT 2024
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 9e485f48228114ab6c34151503740ea15cddb351...96466bc72cf851ecb1cb8d34b278294d5edf49f4 lld/test/ELF/tools/generate-debug-names.py
``````````
</details>
<details>
<summary>
View the diff from darker here.
</summary>
``````````diff
--- generate-debug-names.py 2024-04-16 22:54:46.000000 +0000
+++ generate-debug-names.py 2024-04-16 22:57:26.929891 +0000
@@ -1,32 +1,41 @@
#!/usr/bin/env python
-'''Generate debug-names*.s test files with embedded C++ code in .ifdef GEN/.endif directives'''
+"""Generate debug-names*.s test files with embedded C++ code in .ifdef GEN/.endif directives"""
import os, subprocess, sys
+
def process(path):
- ccfile = os.path.basename(path).replace('.s', '.cc').replace('debug-names-', '')
+ ccfile = os.path.basename(path).replace(".s", ".cc").replace("debug-names-", "")
cc = []
prolog = []
is_cc = False
is_prolog = True
with open(path) as f:
for line in f.readlines():
line = line.rstrip()
- if is_prolog: prolog.append(line)
- if line.startswith('.endif'): is_cc = is_prolog = False
- if is_cc: cc.append(line)
- if line.startswith('.ifdef'): is_cc = True
+ if is_prolog:
+ prolog.append(line)
+ if line.startswith(".endif"):
+ is_cc = is_prolog = False
+ if is_cc:
+ cc.append(line)
+ if line.startswith(".ifdef"):
+ is_cc = True
if not cc:
- print('no .ifdef GEN, bail out', file=sys.stderr)
+ print("no .ifdef GEN, bail out", file=sys.stderr)
return
- sub = subprocess.run(f'clang -S -g -gpubnames -fno-ident -fdebug-compilation-dir=. -Xclang=-main-file-name -Xclang={ccfile} -xc++ - -o -'.split(),
- input='\n'.join(cc).encode(), capture_output=True)
+ sub = subprocess.run(
+ f"clang -S -g -gpubnames -fno-ident -fdebug-compilation-dir=. -Xclang=-main-file-name -Xclang={ccfile} -xc++ - -o -".split(),
+ input="\n".join(cc).encode(),
+ capture_output=True,
+ )
if sub.returncode != 0:
- print(f'failed\n{sub.stderr.decode()}', file=sys.stderr)
+ print(f"failed\n{sub.stderr.decode()}", file=sys.stderr)
return
- with open(path, 'w') as f:
- print('\n'.join(prolog), file=f)
- print(sub.stdout.decode(), file=f, end='')
+ with open(path, "w") as f:
+ print("\n".join(prolog), file=f)
+ print(sub.stdout.decode(), file=f, end="")
+
for path in sys.argv[1:]:
process(path)
``````````
</details>
https://github.com/llvm/llvm-project/pull/88092
More information about the llvm-commits
mailing list