Author: rmarker
Date: 2024-01-30T17:29:46-08:00
New Revision: c806d8c7e948f01405be4ea344d883f066f8ae59

URL: 
https://github.com/llvm/llvm-project/commit/c806d8c7e948f01405be4ea344d883f066f8ae59
DIFF: 
https://github.com/llvm/llvm-project/commit/c806d8c7e948f01405be4ea344d883f066f8ae59.diff

LOG: [clang-format] Explicitly open DOC_FILE with utf-8 in dump_format_style.py 
(#79805)

The dump_format_style.py script generates the clang-format style options
documentation.
There was an issue where the script could include spurious characters in
the output when run in windows. It appears that it wasn't defaulting to
the correct encoding when reading the input.
This has been addressed by explicitly setting the encoding when opening
the file.

Added: 
    

Modified: 
    clang/docs/tools/dump_format_style.py

Removed: 
    


################################################################################
diff  --git a/clang/docs/tools/dump_format_style.py 
b/clang/docs/tools/dump_format_style.py
index 75d4a044ef19f..e41891f07de2e 100755
--- a/clang/docs/tools/dump_format_style.py
+++ b/clang/docs/tools/dump_format_style.py
@@ -474,7 +474,7 @@ class State:
 opts = sorted(opts, key=lambda x: x.name)
 options_text = "\n\n".join(map(str, opts))
 
-with open(DOC_FILE) as f:
+with open(DOC_FILE, encoding="utf-8") as f:
     contents = f.read()
 
 contents = substitute(contents, "FORMAT_STYLE_OPTIONS", options_text)


        
_______________________________________________
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to