https://github.com/zwuis updated 
https://github.com/llvm/llvm-project/pull/153593

>From 1fdf80aac85fdade340ac8ae17519a0b4d68d0f7 Mon Sep 17 00:00:00 2001
From: Yanzuo Liu <zw...@outlook.com>
Date: Thu, 14 Aug 2025 23:01:41 +0800
Subject: [PATCH 1/4] Add script to clear release notes

---
 clang-tools-extra/docs/ReleaseNotes.rst       |   3 +
 .../docs/ReleaseNotesTemplate.txt             | 122 +++++++++
 clang/docs/ReleaseNotes.rst                   |   3 +
 clang/docs/ReleaseNotesTemplate.txt           | 246 ++++++++++++++++++
 flang/docs/ReleaseNotes.md                    |   3 +
 flang/docs/ReleaseNotesTemplate.txt           |  51 ++++
 lld/docs/ReleaseNotes.rst                     |   3 +
 lld/docs/ReleaseNotesTemplate.txt             |  48 ++++
 llvm/docs/HowToReleaseLLVM.rst                |  16 +-
 llvm/docs/ReleaseNotes.md                     |   3 +
 llvm/docs/ReleaseNotesTemplate.txt            | 163 ++++++++++++
 llvm/utils/release/clear-release-notes.py     |  43 +++
 12 files changed, 694 insertions(+), 10 deletions(-)
 create mode 100644 clang-tools-extra/docs/ReleaseNotesTemplate.txt
 create mode 100644 clang/docs/ReleaseNotesTemplate.txt
 create mode 100644 flang/docs/ReleaseNotesTemplate.txt
 create mode 100644 lld/docs/ReleaseNotesTemplate.txt
 create mode 100644 llvm/docs/ReleaseNotesTemplate.txt
 create mode 100755 llvm/utils/release/clear-release-notes.py

diff --git a/clang-tools-extra/docs/ReleaseNotes.rst 
b/clang-tools-extra/docs/ReleaseNotes.rst
index 187aae2ec8c90..b6a434fb2b773 100644
--- a/clang-tools-extra/docs/ReleaseNotes.rst
+++ b/clang-tools-extra/docs/ReleaseNotes.rst
@@ -1,3 +1,6 @@
+.. If you want to modify sections/contents permanently, you should modify both
+   ReleaseNotes.rst and ReleaseNotesTemplate.txt.
+
 ====================================================
 Extra Clang Tools |release| |ReleaseNotesTitle|
 ====================================================
diff --git a/clang-tools-extra/docs/ReleaseNotesTemplate.txt 
b/clang-tools-extra/docs/ReleaseNotesTemplate.txt
new file mode 100644
index 0000000000000..b17799b3b557d
--- /dev/null
+++ b/clang-tools-extra/docs/ReleaseNotesTemplate.txt
@@ -0,0 +1,122 @@
+.. If you want to modify sections/contents permanently, you should modify both
+   ReleaseNotes.rst and ReleaseNotesTemplate.txt.
+
+====================================================
+Extra Clang Tools |release| |ReleaseNotesTitle|
+====================================================
+
+.. contents::
+   :local:
+   :depth: 3
+
+Written by the `LLVM Team <https://llvm.org/>`_
+
+.. only:: PreRelease
+
+  .. warning::
+     These are in-progress notes for the upcoming Extra Clang Tools |version| 
release.
+     Release notes for previous releases can be found on
+     `the Download Page <https://releases.llvm.org/download.html>`_.
+
+Introduction
+============
+
+This document contains the release notes for the Extra Clang Tools, part of the
+Clang release |release|. Here we describe the status of the Extra Clang Tools 
in
+some detail, including major improvements from the previous release and new
+feature work. All LLVM releases may be downloaded from the `LLVM releases web
+site <https://llvm.org/releases/>`_.
+
+For more information about Clang or LLVM, including information about
+the latest release, please see the `Clang Web Site <https://clang.llvm.org>`_ 
or
+the `LLVM Web Site <https://llvm.org>`_.
+
+Note that if you are reading this file from a Git checkout or the
+main Clang web page, this document applies to the *next* release, not
+the current one. To see the release notes for a specific release, please
+see the `releases page <https://llvm.org/releases/>`_.
+
+What's New in Extra Clang Tools |release|?
+==========================================
+
+Some of the major new features and improvements to Extra Clang Tools are listed
+here. Generic improvements to Extra Clang Tools as a whole or to its underlying
+infrastructure are described first, followed by tool-specific sections.
+
+Major New Features
+------------------
+
+Improvements to clangd
+----------------------
+
+Inlay hints
+^^^^^^^^^^^
+
+Diagnostics
+^^^^^^^^^^^
+
+Semantic Highlighting
+^^^^^^^^^^^^^^^^^^^^^
+
+Compile flags
+^^^^^^^^^^^^^
+
+Hover
+^^^^^
+
+Code completion
+^^^^^^^^^^^^^^^
+
+Code actions
+^^^^^^^^^^^^
+
+Signature help
+^^^^^^^^^^^^^^
+
+Cross-references
+^^^^^^^^^^^^^^^^
+
+Objective-C
+^^^^^^^^^^^
+
+Miscellaneous
+^^^^^^^^^^^^^
+
+Improvements to clang-doc
+-------------------------
+
+Improvements to clang-query
+---------------------------
+
+Improvements to clang-tidy
+--------------------------
+
+New checks
+^^^^^^^^^^
+
+New check aliases
+^^^^^^^^^^^^^^^^^
+
+Changes in existing checks
+^^^^^^^^^^^^^^^^^^^^^^^^^^
+
+Removed checks
+^^^^^^^^^^^^^^
+
+Miscellaneous
+^^^^^^^^^^^^^
+
+Improvements to include-fixer
+-----------------------------
+
+Improvements to clang-include-fixer
+-----------------------------------
+
+Improvements to modularize
+--------------------------
+
+Improvements to pp-trace
+------------------------
+
+Clang-tidy Visual Studio plugin
+-------------------------------
diff --git a/clang/docs/ReleaseNotes.rst b/clang/docs/ReleaseNotes.rst
index d109518bca3f3..35ba4f078546b 100644
--- a/clang/docs/ReleaseNotes.rst
+++ b/clang/docs/ReleaseNotes.rst
@@ -1,3 +1,6 @@
+.. If you want to modify sections/contents permanently, you should modify both
+   ReleaseNotes.rst and ReleaseNotesTemplate.txt.
+
 ===========================================
 Clang |release| |ReleaseNotesTitle|
 ===========================================
diff --git a/clang/docs/ReleaseNotesTemplate.txt 
b/clang/docs/ReleaseNotesTemplate.txt
new file mode 100644
index 0000000000000..cc04deb45bb53
--- /dev/null
+++ b/clang/docs/ReleaseNotesTemplate.txt
@@ -0,0 +1,246 @@
+.. If you want to modify sections/contents permanently, you should modify both
+   ReleaseNotes.rst and ReleaseNotesTemplate.txt.
+
+===========================================
+Clang |release| |ReleaseNotesTitle|
+===========================================
+
+.. contents::
+   :local:
+   :depth: 2
+
+Written by the `LLVM Team <https://llvm.org/>`_
+
+.. only:: PreRelease
+
+  .. warning::
+     These are in-progress notes for the upcoming Clang |version| release.
+     Release notes for previous releases can be found on
+     `the Releases Page <https://llvm.org/releases/>`_.
+
+Introduction
+============
+
+This document contains the release notes for the Clang C/C++/Objective-C
+frontend, part of the LLVM Compiler Infrastructure, release |release|. Here we
+describe the status of Clang in some detail, including major
+improvements from the previous release and new feature work. For the
+general LLVM release notes, see `the LLVM
+documentation <https://llvm.org/docs/ReleaseNotes.html>`_. For the libc++ 
release notes,
+see `this page <https://libcxx.llvm.org/ReleaseNotes.html>`_. All LLVM releases
+may be downloaded from the `LLVM releases web site 
<https://llvm.org/releases/>`_.
+
+For more information about Clang or LLVM, including information about the
+latest release, please see the `Clang Web Site <https://clang.llvm.org>`_ or 
the
+`LLVM Web Site <https://llvm.org>`_.
+
+Potentially Breaking Changes
+============================
+
+C/C++ Language Potentially Breaking Changes
+-------------------------------------------
+
+C++ Specific Potentially Breaking Changes
+-----------------------------------------
+
+ABI Changes in This Version
+---------------------------
+
+AST Dumping Potentially Breaking Changes
+----------------------------------------
+
+Clang Frontend Potentially Breaking Changes
+-------------------------------------------
+
+Clang Python Bindings Potentially Breaking Changes
+--------------------------------------------------
+
+What's New in Clang |release|?
+==============================
+
+C++ Language Changes
+--------------------
+
+C++2c Feature Support
+^^^^^^^^^^^^^^^^^^^^^
+
+C++23 Feature Support
+^^^^^^^^^^^^^^^^^^^^^
+
+C++20 Feature Support
+^^^^^^^^^^^^^^^^^^^^^
+
+C++17 Feature Support
+^^^^^^^^^^^^^^^^^^^^^
+
+Resolutions to C++ Defect Reports
+^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+
+C Language Changes
+------------------
+
+C2y Feature Support
+^^^^^^^^^^^^^^^^^^^
+
+C23 Feature Support
+^^^^^^^^^^^^^^^^^^^
+
+Non-comprehensive list of changes in this release
+-------------------------------------------------
+
+New Compiler Flags
+------------------
+
+Deprecated Compiler Flags
+-------------------------
+
+Modified Compiler Flags
+-----------------------
+
+Removed Compiler Flags
+----------------------
+
+Attribute Changes in Clang
+--------------------------
+
+Improvements to Clang's diagnostics
+-----------------------------------
+
+Improvements to Clang's time-trace
+----------------------------------
+
+Improvements to Coverage Mapping
+--------------------------------
+
+Bug Fixes in This Version
+-------------------------
+
+Bug Fixes to Compiler Builtins
+^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+
+Bug Fixes to Attribute Support
+^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+
+Bug Fixes to C++ Support
+^^^^^^^^^^^^^^^^^^^^^^^^
+
+Bug Fixes to AST Handling
+^^^^^^^^^^^^^^^^^^^^^^^^^
+
+Miscellaneous Bug Fixes
+^^^^^^^^^^^^^^^^^^^^^^^
+
+Miscellaneous Clang Crashes Fixed
+^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+
+OpenACC Specific Changes
+------------------------
+
+Target Specific Changes
+-----------------------
+
+AMDGPU Support
+^^^^^^^^^^^^^^
+
+NVPTX Support
+^^^^^^^^^^^^^^
+
+X86 Support
+^^^^^^^^^^^
+
+Arm and AArch64 Support
+^^^^^^^^^^^^^^^^^^^^^^^
+
+Android Support
+^^^^^^^^^^^^^^^
+
+Windows Support
+^^^^^^^^^^^^^^^
+
+LoongArch Support
+^^^^^^^^^^^^^^^^^
+
+RISC-V Support
+^^^^^^^^^^^^^^
+
+CUDA/HIP Language Changes
+^^^^^^^^^^^^^^^^^^^^^^^^^
+
+CUDA Support
+^^^^^^^^^^^^
+
+AIX Support
+^^^^^^^^^^^
+
+NetBSD Support
+^^^^^^^^^^^^^^
+
+WebAssembly Support
+^^^^^^^^^^^^^^^^^^^
+
+AVR Support
+^^^^^^^^^^^
+
+DWARF Support in Clang
+----------------------
+
+Floating Point Support in Clang
+-------------------------------
+
+Fixed Point Support in Clang
+----------------------------
+
+AST Matchers
+------------
+
+clang-format
+------------
+
+libclang
+--------
+
+Code Completion
+---------------
+
+Static Analyzer
+---------------
+
+New features
+^^^^^^^^^^^^
+
+Crash and bug fixes
+^^^^^^^^^^^^^^^^^^^
+
+Improvements
+^^^^^^^^^^^^
+
+Moved checkers
+^^^^^^^^^^^^^^
+
+.. _release-notes-sanitizers:
+
+Sanitizers
+----------
+
+Python Binding Changes
+----------------------
+
+OpenMP Support
+--------------
+
+Improvements
+^^^^^^^^^^^^
+
+Additional Information
+======================
+
+A wide variety of additional information is available on the `Clang web
+page <https://clang.llvm.org/>`_. The web page contains versions of the
+API documentation which are up-to-date with the Git version of
+the source code. You can access versions of these documents specific to
+this release by going into the "``clang/docs/``" directory in the Clang
+tree.
+
+If you have any questions or comments about Clang, please feel free to
+contact us on the `Discourse forums (Clang Frontend category)
+<https://discourse.llvm.org/c/clang/6>`_.
diff --git a/flang/docs/ReleaseNotes.md b/flang/docs/ReleaseNotes.md
index 99dc41c907c36..c9623ea08c4e6 100644
--- a/flang/docs/ReleaseNotes.md
+++ b/flang/docs/ReleaseNotes.md
@@ -1,3 +1,6 @@
+<!-- If you want to modify sections/contents permanently, you should modify 
both
+ReleaseNotes.md and ReleaseNotesTemplate.txt. -->
+
 # Flang |version| (In-Progress) Release Notes
 
 > **warning**
diff --git a/flang/docs/ReleaseNotesTemplate.txt 
b/flang/docs/ReleaseNotesTemplate.txt
new file mode 100644
index 0000000000000..2ccf5472ee234
--- /dev/null
+++ b/flang/docs/ReleaseNotesTemplate.txt
@@ -0,0 +1,51 @@
+<!-- If you want to modify sections/contents permanently, you should modify 
both
+ReleaseNotes.md and ReleaseNotesTemplate.txt. -->
+
+# Flang |version| (In-Progress) Release Notes
+
+> **warning**
+>
+> These are in-progress notes for the upcoming LLVM |version| release.
+> Release notes for previous releases can be found on [the Download
+> Page](https://releases.llvm.org/download.html).
+
+## Introduction
+
+This document contains the release notes for the Flang Fortran frontend,
+part of the LLVM Compiler Infrastructure, release |version|. Here we
+describe the status of Flang in some detail, including major
+improvements from the previous release and new feature work. For the
+general LLVM release notes, see [the LLVM
+documentation](https://llvm.org/docs/ReleaseNotes.html). All LLVM
+releases may be downloaded from the [LLVM releases web
+site](https://llvm.org/releases/).
+
+Note that if you are reading this file from a Git checkout, this
+document applies to the *next* release, not the current one. To see the
+release notes for a specific release, please see the [releases
+page](https://llvm.org/releases/).
+
+## Major New Features
+
+## Bug Fixes
+
+## Non-comprehensive list of changes in this release
+
+## New Compiler Flags
+
+## Windows Support
+
+## Fortran Language Changes in Flang
+
+## Build System Changes
+
+## New Issues Found
+
+## Additional Information
+
+Flang's documentation is located in the `flang/docs/` directory in the
+LLVM monorepo.
+
+If you have any questions or comments about Flang, please feel free to
+contact us on the [Discourse
+forums](https://discourse.llvm.org/c/subprojects/flang/33).
diff --git a/lld/docs/ReleaseNotes.rst b/lld/docs/ReleaseNotes.rst
index 6f60efd87c975..cc1628f48bb0e 100644
--- a/lld/docs/ReleaseNotes.rst
+++ b/lld/docs/ReleaseNotes.rst
@@ -1,3 +1,6 @@
+.. If you want to modify sections/contents permanently, you should modify both
+   ReleaseNotes.rst and ReleaseNotesTemplate.txt.
+
 ===========================
 lld |release| Release Notes
 ===========================
diff --git a/lld/docs/ReleaseNotesTemplate.txt 
b/lld/docs/ReleaseNotesTemplate.txt
new file mode 100644
index 0000000000000..cc1628f48bb0e
--- /dev/null
+++ b/lld/docs/ReleaseNotesTemplate.txt
@@ -0,0 +1,48 @@
+.. If you want to modify sections/contents permanently, you should modify both
+   ReleaseNotes.rst and ReleaseNotesTemplate.txt.
+
+===========================
+lld |release| Release Notes
+===========================
+
+.. contents::
+    :local:
+
+.. only:: PreRelease
+
+  .. warning::
+     These are in-progress notes for the upcoming LLVM |release| release.
+     Release notes for previous releases can be found on
+     `the Download Page <https://releases.llvm.org/download.html>`_.
+
+Introduction
+============
+
+This document contains the release notes for the lld linker, release |release|.
+Here we describe the status of lld, including major improvements
+from the previous release. All lld releases may be downloaded
+from the `LLVM releases web site <https://llvm.org/releases/>`_.
+
+Non-comprehensive list of changes in this release
+=================================================
+
+ELF Improvements
+----------------
+
+Breaking changes
+----------------
+
+COFF Improvements
+-----------------
+
+MinGW Improvements
+------------------
+
+MachO Improvements
+------------------
+
+WebAssembly Improvements
+------------------------
+
+Fixes
+#####
diff --git a/llvm/docs/HowToReleaseLLVM.rst b/llvm/docs/HowToReleaseLLVM.rst
index dd4bb08b81d1c..f3792e367de0d 100644
--- a/llvm/docs/HowToReleaseLLVM.rst
+++ b/llvm/docs/HowToReleaseLLVM.rst
@@ -101,8 +101,8 @@ release process to begin.  Specifically, it involves:
 
 * Tagging release candidates for the release team to begin testing.
 
-Create Release Branch
-^^^^^^^^^^^^^^^^^^^^^
+Create Release Branch and Update LLVM Version
+^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
 
 Branch the Git trunk using the following procedure:
 
@@ -114,14 +114,16 @@ Branch the Git trunk using the following procedure:
 #. Verify that the current git trunk is in decent shape by
    examining nightly tester and buildbot results.
 
-#. Bump the version in trunk to N.0.0git and tag the commit with 
llvmorg-N-init.
+#. Bump the version in trunk to N.0.0git with the script in
+   ``llvm/utils/release/bump-version.py``, and tag the commit with 
llvmorg-N-init.
    If ``X`` is the version to be released, then ``N`` is ``X + 1``.
 
 ::
 
   $ git tag -sa llvmorg-N-init
 
-#. Clear the release notes in trunk.
+4. Clear the release notes in trunk with the script in
+   ``llvm/utils/release/clear-release-notes.py``.
 
 #. Create the release branch from the last known good revision from before the
    version bump.  The branch's name is release/X.x where ``X`` is the major 
version
@@ -133,12 +135,6 @@ Branch the Git trunk using the following procedure:
 #. All tags and branches need to be created in both the llvm/llvm-project and
    llvm/llvm-test-suite repos.
 
-Update LLVM Version
-^^^^^^^^^^^^^^^^^^^
-
-After creating the LLVM release branch, update the release branches'
-version with the script in ``llvm/utils/release/bump-version.py``.
-
 Tagging the LLVM Release Candidates
 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
 
diff --git a/llvm/docs/ReleaseNotes.md b/llvm/docs/ReleaseNotes.md
index 88b7e6d6585f7..d8db129638d52 100644
--- a/llvm/docs/ReleaseNotes.md
+++ b/llvm/docs/ReleaseNotes.md
@@ -1,6 +1,9 @@
 <!-- This document is written in Markdown and uses extra directives provided by
 MyST (https://myst-parser.readthedocs.io/en/latest/). -->
 
+<!-- If you want to modify sections/contents permanently, you should modify 
both
+ReleaseNotes.md and ReleaseNotesTemplate.txt. -->
+
 LLVM {{env.config.release}} Release Notes
 =========================================
 
diff --git a/llvm/docs/ReleaseNotesTemplate.txt 
b/llvm/docs/ReleaseNotesTemplate.txt
new file mode 100644
index 0000000000000..ea1e4906fbe2e
--- /dev/null
+++ b/llvm/docs/ReleaseNotesTemplate.txt
@@ -0,0 +1,163 @@
+<!-- This document is written in Markdown and uses extra directives provided by
+MyST (https://myst-parser.readthedocs.io/en/latest/). -->
+
+<!-- If you want to modify sections/contents permanently, you should modify 
both
+ReleaseNotes.md and ReleaseNotesTemplate.txt. -->
+
+LLVM {{env.config.release}} Release Notes
+=========================================
+
+```{contents}
+```
+
+````{only} PreRelease
+```{warning} These are in-progress notes for the upcoming LLVM 
{{env.config.release}}
+             release. Release notes for previous releases can be found on
+             [the Download Page](https://releases.llvm.org/download.html).
+```
+````
+
+Introduction
+============
+
+This document contains the release notes for the LLVM Compiler Infrastructure,
+release {{env.config.release}}.  Here we describe the status of LLVM, including
+major improvements from the previous release, improvements in various 
subprojects
+of LLVM, and some of the current users of the code.  All LLVM releases may be
+downloaded from the [LLVM releases web site](https://llvm.org/releases/).
+
+For more information about LLVM, including information about the latest
+release, please check out the [main LLVM web site](https://llvm.org/).  If you
+have questions or comments, the [Discourse forums](https://discourse.llvm.org)
+is a good place to ask them.
+
+Note that if you are reading this file from a Git checkout or the main
+LLVM web page, this document applies to the *next* release, not the current
+one.  To see the release notes for a specific release, please see the
+[releases page](https://llvm.org/releases/).
+
+Non-comprehensive list of changes in this release
+=================================================
+
+<!-- For small 1-3 sentence descriptions, just add an entry at the end of
+this list. If your description won't fit comfortably in one bullet
+point (e.g. maybe you would like to give an example of the
+functionality, or simply have a lot to talk about), see the comment below
+for adding a new subsection. -->
+
+* ...
+
+<!-- If you would like to document a larger change, then you can add a
+subsection about it right here. You can copy the following boilerplate:
+
+Special New Feature
+-------------------
+
+Makes programs 10x faster by doing Special New Thing.
+-->
+
+Changes to the LLVM IR
+----------------------
+
+Changes to LLVM infrastructure
+------------------------------
+
+Changes to building LLVM
+------------------------
+
+Changes to TableGen
+-------------------
+
+Changes to Interprocedural Optimizations
+----------------------------------------
+
+Changes to Vectorizers
+----------------------
+
+Changes to the AArch64 Backend
+------------------------------
+
+Changes to the AMDGPU Backend
+-----------------------------
+
+Changes to the ARM Backend
+--------------------------
+
+Changes to the AVR Backend
+--------------------------
+
+Changes to the DirectX Backend
+------------------------------
+
+Changes to the Hexagon Backend
+------------------------------
+
+Changes to the LoongArch Backend
+--------------------------------
+
+Changes to the MIPS Backend
+---------------------------
+
+Changes to the PowerPC Backend
+------------------------------
+
+Changes to the RISC-V Backend
+-----------------------------
+
+Changes to the WebAssembly Backend
+----------------------------------
+
+Changes to the Windows Target
+-----------------------------
+
+Changes to the X86 Backend
+--------------------------
+
+Changes to the OCaml bindings
+-----------------------------
+
+Changes to the Python bindings
+------------------------------
+
+Changes to the C API
+--------------------
+
+Changes to the CodeGen infrastructure
+-------------------------------------
+
+Changes to the Metadata Info
+----------------------------
+
+Changes to the Debug Info
+-------------------------
+
+Changes to the LLVM tools
+-------------------------
+
+Changes to LLDB
+---------------
+
+Changes to BOLT
+---------------
+
+Changes to Sanitizers
+---------------------
+
+Other Changes
+-------------
+
+External Open Source Projects Using LLVM {{env.config.release}}
+===============================================================
+
+Additional Information
+======================
+
+A wide variety of additional information is available on the
+[LLVM web page](https://llvm.org/), in particular in the
+[documentation](https://llvm.org/docs/) section.  The web page also contains
+versions of the API documentation which is up-to-date with the Git version of
+the source code.  You can access versions of these documents specific to this
+release by going into the `llvm/docs/` directory in the LLVM tree.
+
+If you have any questions or comments about LLVM, please feel free to contact
+us via the [Discourse forums](https://discourse.llvm.org).
diff --git a/llvm/utils/release/clear-release-notes.py 
b/llvm/utils/release/clear-release-notes.py
new file mode 100755
index 0000000000000..ee31a4c101642
--- /dev/null
+++ b/llvm/utils/release/clear-release-notes.py
@@ -0,0 +1,43 @@
+#!/usr/bin/env python3
+
+# This script clears release notes, which is needed when bumping trunk version.
+
+import argparse
+from pathlib import Path
+
+
+def process_file(fpath: Path) -> None:
+    # ReleaseNotes.rst/.md -> ReleaseNotesTemplate.txt
+    template_path = fpath.with_name(f"{fpath.stem}Template.txt")
+    fpath.write_text(template_path.read_text(), newline="\n")
+    print(f"{fpath.name} updated.")
+
+
+if __name__ == "__main__":
+    parser = argparse.ArgumentParser()
+    parser.add_argument(
+        "-s",
+        "--source-root",
+        default=None,
+        help="LLVM source root (/path/llvm-project). Defaults to the "
+             "llvm-project the script is located in.",
+    )
+
+    args = parser.parse_args()
+
+    # Find llvm-project root
+    source_root = Path(__file__).resolve().parents[3]
+
+    if args.source_root:
+        source_root = Path(args.source_root).resolve()
+
+    files_to_update = (
+        "clang/docs/ReleaseNotes.rst",
+        "clang-tools-extra/docs/ReleaseNotes.rst",
+        "flang/docs/ReleaseNotes.md",
+        "lld/docs/ReleaseNotes.rst",
+        "llvm/docs/ReleaseNotes.md",
+    )
+
+    for f in files_to_update:
+        process_file(source_root / f)

>From 997aebbc8389cd41ba6ba16d1d15960ff05be6c6 Mon Sep 17 00:00:00 2001
From: Yanzuo Liu <zw...@outlook.com>
Date: Thu, 14 Aug 2025 23:23:46 +0800
Subject: [PATCH 2/4] Format code

---
 llvm/utils/release/clear-release-notes.py | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/llvm/utils/release/clear-release-notes.py 
b/llvm/utils/release/clear-release-notes.py
index ee31a4c101642..0e5d46197b070 100755
--- a/llvm/utils/release/clear-release-notes.py
+++ b/llvm/utils/release/clear-release-notes.py
@@ -20,7 +20,7 @@ def process_file(fpath: Path) -> None:
         "--source-root",
         default=None,
         help="LLVM source root (/path/llvm-project). Defaults to the "
-             "llvm-project the script is located in.",
+        "llvm-project the script is located in.",
     )
 
     args = parser.parse_args()

>From 498dec44d26ea988549aacc4ab567d671adb1ea5 Mon Sep 17 00:00:00 2001
From: Yanzuo Liu <zw...@outlook.com>
Date: Fri, 15 Aug 2025 14:11:11 +0800
Subject: [PATCH 3/4] Print full path instead of file name only

---
 llvm/utils/release/clear-release-notes.py | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/llvm/utils/release/clear-release-notes.py 
b/llvm/utils/release/clear-release-notes.py
index 0e5d46197b070..1989000e00ca2 100755
--- a/llvm/utils/release/clear-release-notes.py
+++ b/llvm/utils/release/clear-release-notes.py
@@ -10,7 +10,7 @@ def process_file(fpath: Path) -> None:
     # ReleaseNotes.rst/.md -> ReleaseNotesTemplate.txt
     template_path = fpath.with_name(f"{fpath.stem}Template.txt")
     fpath.write_text(template_path.read_text(), newline="\n")
-    print(f"{fpath.name} updated.")
+    print(f"{fpath} updated.")
 
 
 if __name__ == "__main__":

>From fa84436f7d80b5c91b0dc6a6e4c9072fe70a6d45 Mon Sep 17 00:00:00 2001
From: Yanzuo Liu <zw...@outlook.com>
Date: Fri, 15 Aug 2025 17:59:47 +0800
Subject: [PATCH 4/4] Add copyright header

---
 llvm/utils/release/clear-release-notes.py | 13 +++++++++++--
 1 file changed, 11 insertions(+), 2 deletions(-)

diff --git a/llvm/utils/release/clear-release-notes.py 
b/llvm/utils/release/clear-release-notes.py
index 1989000e00ca2..3ea0298b43d43 100755
--- a/llvm/utils/release/clear-release-notes.py
+++ b/llvm/utils/release/clear-release-notes.py
@@ -1,6 +1,15 @@
 #!/usr/bin/env python3
-
-# This script clears release notes, which is needed when bumping trunk version.
+# ===-- clear-release-notes.py  
---------------------------------------------===#
+#
+# Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+# See https://llvm.org/LICENSE.txt for license information.
+# SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+#
+# 
===------------------------------------------------------------------------===#
+#
+# Clear release notes, which is needed when bumping trunk version.
+#
+# 
===------------------------------------------------------------------------===#
 
 import argparse
 from pathlib import Path

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

Reply via email to