[Lldb-commits] [lldb] [lldb][bytecode] Add append mode for compiler output (PR #189693)
via lldb-commits
lldb-commits at lists.llvm.org
Tue Mar 31 08:25:21 PDT 2026
llvmbot wrote:
<!--LLVM PR SUMMARY COMMENT-->
@llvm/pr-subscribers-lldb
Author: Dave Lee (kastiglione)
<details>
<summary>Changes</summary>
---
Full diff: https://github.com/llvm/llvm-project/pull/189693.diff
1 Files Affected:
- (modified) lldb/examples/python/formatter_bytecode.py (+9-1)
``````````diff
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)
``````````
</details>
https://github.com/llvm/llvm-project/pull/189693
More information about the lldb-commits
mailing list