[Lldb-commits] [lldb] [lldb][bytecode] Add append mode for compiler output (PR #189693)
Dave Lee via lldb-commits
lldb-commits at lists.llvm.org
Tue Mar 31 08:24:30 PDT 2026
https://github.com/kastiglione created https://github.com/llvm/llvm-project/pull/189693
None
>From d6c028fcd3185ed51e0f13da7b21bda51145d3f5 Mon Sep 17 00:00:00 2001
From: Dave Lee <davelee.com at gmail.com>
Date: Tue, 31 Mar 2026 08:20:59 -0700
Subject: [PATCH] [lldb][bytecode] Add append mode for compiler output
---
lldb/examples/python/formatter_bytecode.py | 10 +++++++++-
1 file changed, 9 insertions(+), 1 deletion(-)
diff --git a/lldb/examples/python/formatter_bytecode.py b/lldb/examples/python/formatter_bytecode.py
index a7c524d98827b..2e31dca68e157 100644
--- a/lldb/examples/python/formatter_bytecode.py
+++ b/lldb/examples/python/formatter_bytecode.py
@@ -1162,6 +1162,9 @@ def _main():
"--output",
help="output file (required for --assemble)",
)
+ parser.add_argument(
+ "--append", action="store_true", help="append to existing output file"
+ )
parser.add_argument(
"-f",
"--format",
@@ -1172,6 +1175,10 @@ def _main():
parser.add_argument("-t", "--test", action="store_true", help="run unit tests")
args = parser.parse_args()
+
+ if args.append and not args.compile:
+ parser.error("--append is valid only with --compile")
+
if args.compile:
if not args.type_name:
parser.error("--type-name is required with --compile")
@@ -1189,7 +1196,8 @@ def _main():
with open(args.output, "wb") as output:
section.write_binary(output)
else:
- with open(args.output, "w") as output:
+ mode = "a" if args.append else "w"
+ with open(args.output, mode) as output:
if not args.skip_invocation_comment:
print("// Generated with:", file=output)
print("// ", shlex.join(sys.argv), file=output)
More information about the lldb-commits
mailing list