[clang] ea44647 - [clang-format] Write in text mode with LF in dump_format_[help|style].py
Owen Pan via cfe-commits
cfe-commits at lists.llvm.org
Thu Dec 12 23:22:33 PST 2024
Author: Owen Pan
Date: 2024-12-12T23:22:26-08:00
New Revision: ea44647a0b49de826191eeb6e05020262b5a81e9
URL: https://github.com/llvm/llvm-project/commit/ea44647a0b49de826191eeb6e05020262b5a81e9
DIFF: https://github.com/llvm/llvm-project/commit/ea44647a0b49de826191eeb6e05020262b5a81e9.diff
LOG: [clang-format] Write in text mode with LF in dump_format_[help|style].py
Added:
Modified:
clang/docs/tools/dump_format_help.py
clang/docs/tools/dump_format_style.py
Removed:
################################################################################
diff --git a/clang/docs/tools/dump_format_help.py b/clang/docs/tools/dump_format_help.py
index baf90048ee1352..ba41ed8c02c817 100755
--- a/clang/docs/tools/dump_format_help.py
+++ b/clang/docs/tools/dump_format_help.py
@@ -72,5 +72,7 @@ def validate(text, columns):
contents = substitute(contents, "FORMAT_HELP", help_text)
-with open(opts.output if opts.output else DOC_FILE, "wb") as output:
- output.write(contents.encode())
+with open(
+ opts.output if opts.output else DOC_FILE, "w", newline="", encoding="utf-8"
+) as f:
+ f.write(contents)
diff --git a/clang/docs/tools/dump_format_style.py b/clang/docs/tools/dump_format_style.py
index f00f3ee8b20e87..f035143f6b3d14 100755
--- a/clang/docs/tools/dump_format_style.py
+++ b/clang/docs/tools/dump_format_style.py
@@ -411,8 +411,8 @@ class State:
state = State.InStruct
enums[enum.name] = enum
else:
- # Enum member without documentation. Must be documented where the enum
- # is used.
+ # Enum member without documentation. Must be documented
+ # where the enum is used.
pass
elif state == State.InNestedEnum:
if line.startswith("///"):
@@ -492,5 +492,7 @@ class State:
contents = substitute(contents, "FORMAT_STYLE_OPTIONS", options_text)
-with open(args.output if args.output else DOC_FILE, "wb") as output:
- output.write(contents.encode())
+with open(
+ args.output if args.output else DOC_FILE, "w", newline="", encoding="utf-8"
+) as f:
+ f.write(contents)
More information about the cfe-commits
mailing list