[Lldb-commits] [lldb] 4087c5f - [lldb][bytecode] Add append mode for compiler output (#189693)
via lldb-commits
lldb-commits at lists.llvm.org
Tue Mar 31 08:56:22 PDT 2026
Author: Dave Lee
Date: 2026-03-31T08:56:14-07:00
New Revision: 4087c5f30d133087b7706db80e27b2d35dd334af
URL: https://github.com/llvm/llvm-project/commit/4087c5f30d133087b7706db80e27b2d35dd334af
DIFF: https://github.com/llvm/llvm-project/commit/4087c5f30d133087b7706db80e27b2d35dd334af.diff
LOG: [lldb][bytecode] Add append mode for compiler output (#189693)
Added:
Modified:
lldb/examples/python/formatter_bytecode.py
Removed:
################################################################################
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