Skip to content

Commit 4d3ec23

Browse files
committed
[Clang][Docs] Simpler syntax for Github links.
Github links in release notes are often invalid rST, clutter the release notes and are annoying to write. This introduces a sphynx plugin that rewrites `#GH<NUMBER>` to a link to the corresponding issue. While this could be introduced globally on all of LLVM, the PR only modifies Clang for now.
1 parent b39f566 commit 4d3ec23

File tree

3 files changed

+52
-47
lines changed

3 files changed

+52
-47
lines changed

clang/docs/ReleaseNotes.rst

Lines changed: 31 additions & 45 deletions
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,7 @@ C++20 Feature Support
7979
more to ease the implementation and improve the user's using experience.
8080
This follows the MSVC's behavior. Users interested in testing the more strict
8181
behavior can use the flag '-Xclang -fno-skip-odr-check-in-gmf'.
82-
(`#79240 <https://github.com/llvm/llvm-project/issues/79240>`_).
82+
(#GH79240).
8383

8484
- Implemented the `__is_layout_compatible` intrinsic to support
8585
`P0466R5: Layout-compatibility and Pointer-interconvertibility Traits <https://wg21.link/P0466R5>`_.
@@ -116,7 +116,7 @@ C Language Changes
116116
C23 Feature Support
117117
^^^^^^^^^^^^^^^^^^^
118118
- No longer diagnose use of binary literals as an extension in C23 mode. Fixes
119-
`#72017 <https://github.com/llvm/llvm-project/issues/72017>`_.
119+
#GH72017.
120120

121121
- Corrected parsing behavior for the ``alignas`` specifier/qualifier in C23. We
122122
previously handled it as an attribute as in C++, but there are parsing
@@ -129,7 +129,7 @@ C23 Feature Support
129129
};
130130
int i alignas(8) /* was accepted, now rejected */ ;
131131
132-
Fixes (`#81472 <https://github.com/llvm/llvm-project/issues/81472>`_).
132+
Fixes (#GH81472).
133133

134134
- Clang now generates predefined macros of the form ``__TYPE_FMTB__`` and
135135
``__TYPE_FMTb__`` (e.g., ``__UINT_FAST64_FMTB__``) in C23 mode for use with
@@ -173,7 +173,7 @@ Improvements to Clang's diagnostics
173173
name specifiers.
174174

175175
- The ``-Wshorten-64-to-32`` diagnostic is now grouped under ``-Wimplicit-int-conversion`` instead
176-
of ``-Wconversion``. Fixes `#69444 <https://github.com/llvm/llvm-project/issues/69444>`_.
176+
of ``-Wconversion``. Fixes #GH69444.
177177

178178
- Clang now diagnoses friend declarations with an ``enum`` elaborated-type-specifier in language modes after C++98.
179179

@@ -186,7 +186,7 @@ Improvements to Clang's diagnostics
186186
``unsigned long long``, but this behavior may change in the future when Clang
187187
implements
188188
`WG14 N3029 <https://www.open-std.org/jtc1/sc22/wg14/www/docs/n3029.htm>`_.
189-
Fixes `#69352 <https://github.com/llvm/llvm-project/issues/69352>`_.
189+
(#GH69352).
190190

191191
- Clang now diagnoses extraneous template parameter lists as a language extension.
192192

@@ -200,17 +200,17 @@ Bug Fixes in This Version
200200
- Clang now accepts elaborated-type-specifiers that explicitly specialize
201201
a member class template for an implicit instantiation of a class template.
202202

203-
- Fixed missing warnings when doing bool-like conversions in C23 (`#79435 <https://github.com/llvm/llvm-project/issues/79435>`_).
203+
- Fixed missing warnings when doing bool-like conversions in C23 (#GH79435).
204204
- Clang's ``-Wshadow`` no longer warns when an init-capture is named the same as
205205
a class field unless the lambda can capture this.
206-
Fixes (`#71976 <https://github.com/llvm/llvm-project/issues/71976>`_)
206+
Fixes (#GH71976)
207207

208208
- Clang now accepts qualified partial/explicit specializations of variable templates that
209209
are not nominable in the lookup context of the specialization.
210210

211211
- Clang now doesn't produce false-positive warning `-Wconstant-logical-operand`
212212
for logical operators in C23.
213-
Fixes (`#64356 <https://github.com/llvm/llvm-project/issues/64356>`_).
213+
Fixes (#GH64356).
214214

215215
Bug Fixes to Compiler Builtins
216216
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
@@ -222,65 +222,51 @@ Bug Fixes to C++ Support
222222
^^^^^^^^^^^^^^^^^^^^^^^^
223223

224224
- Fix crash when calling the constructor of an invalid class.
225-
Fixes (`#10518 <https://github.com/llvm/llvm-project/issues/10518>`_),
226-
(`#67914 <https://github.com/llvm/llvm-project/issues/10518>`_),
227-
and (`#78388 <https://github.com/llvm/llvm-project/issues/78388>`_)
225+
(#GH10518) (#GH67914) (#GH78388)
228226
- Fix crash when using lifetimebound attribute in function with trailing return.
229-
Fixes (`#73619 <https://github.com/llvm/llvm-project/issues/73619>`_)
227+
(#GH73619)
230228
- Addressed an issue where constraints involving injected class types are perceived
231-
distinct from its specialization types.
232-
(`#56482 <https://github.com/llvm/llvm-project/issues/56482>`_)
229+
distinct from its specialization types. (#GH56482)
233230
- Fixed a bug where variables referenced by requires-clauses inside
234-
nested generic lambdas were not properly injected into the constraint scope.
235-
(`#73418 <https://github.com/llvm/llvm-project/issues/73418>`_)
231+
nested generic lambdas were not properly injected into the constraint scope. (#GH73418)
236232
- Fixed a crash where substituting into a requires-expression that refers to function
237233
parameters during the equivalence determination of two constraint expressions.
238-
(`#74447 <https://github.com/llvm/llvm-project/issues/74447>`_)
234+
(#GH74447)
239235
- Fixed deducing auto& from const int in template parameters of partial
240-
specializations.
241-
(`#77189 <https://github.com/llvm/llvm-project/issues/77189>`_)
236+
specializations. (#GH77189)
242237
- Fix for crash when using a erroneous type in a return statement.
243-
Fixes (`#63244 <https://github.com/llvm/llvm-project/issues/63244>`_)
244-
and (`#79745 <https://github.com/llvm/llvm-project/issues/79745>`_)
238+
(#GH63244) (#GH79745)
245239
- Fixed an out-of-bounds error caused by building a recovery expression for ill-formed
246-
function calls while substituting into constraints.
247-
(`#58548 <https://github.com/llvm/llvm-project/issues/58548>`_)
248-
- Fix incorrect code generation caused by the object argument of ``static operator()`` and ``static operator[]`` calls not being evaluated.
249-
Fixes (`#67976 <https://github.com/llvm/llvm-project/issues/67976>`_)
240+
function calls while substituting into constraints. (#GH58548)
241+
- Fix incorrect code generation caused by the object argument
242+
of ``static operator()`` and ``static operator[]`` calls not being evaluated. (#GH67976)
250243
- Fix crash and diagnostic with const qualified member operator new.
251-
Fixes (`#79748 <https://github.com/llvm/llvm-project/issues/79748>`_)
244+
Fixes (#GH79748)
252245
- Fixed a crash where substituting into a requires-expression that involves parameter packs
253-
during the equivalence determination of two constraint expressions.
254-
(`#72557 <https://github.com/llvm/llvm-project/issues/72557>`_)
246+
during the equivalence determination of two constraint expressions. (#GH72557)
255247
- Fix a crash when specializing an out-of-line member function with a default
256248
parameter where we did an incorrect specialization of the initialization of
257-
the default parameter.
258-
Fixes (`#68490 <https://github.com/llvm/llvm-project/issues/68490>`_)
249+
the default parameter. (#GH68490)
259250
- Fix a crash when trying to call a varargs function that also has an explicit object parameter.
260-
Fixes (`#80971 ICE when explicit object parameter be a function parameter pack`)
261-
- Reject explicit object parameters on `new` and `delete` operators.
262-
Fixes (`#82249 <https://github.com/llvm/llvm-project/issues/82249>` _)
251+
Fixes (#GH80971)
252+
- Reject explicit object parameters on `new` and `delete` operators. (#GH82249)
253+
- Fix a crash when trying to call a varargs function that also has an explicit object parameter. (#GH80971)
263254
- Fixed a bug where abbreviated function templates would append their invented template parameters to
264255
an empty template parameter lists.
265256
- Clang now classifies aggregate initialization in C++17 and newer as constant
266257
or non-constant more accurately. Previously, only a subset of the initializer
267-
elements were considered, misclassifying some initializers as constant. Fixes
268-
some of (`#80510 <https://github.com/llvm/llvm-project/issues/80510>`).
269-
- Clang now ignores top-level cv-qualifiers on function parameters in template partial orderings.
270-
(`#75404 <https://github.com/llvm/llvm-project/issues/75404>`_)
258+
elements were considered, misclassifying some initializers as constant. Partially fixes
259+
#GH80510.
260+
- Clang now ignores top-level cv-qualifiers on function parameters in template partial orderings. (#GH75404)
271261
- No longer reject valid use of the ``_Alignas`` specifier when declaring a
272262
local variable, which is supported as a C11 extension in C++. Previously, it
273263
was only accepted at namespace scope but not at local function scope.
274-
- Clang no longer tries to call consteval constructors at runtime when they appear in a member initializer.
275-
(`#82154 <https://github.com/llvm/llvm-project/issues/82154>`_`)
276-
- Fix crash when using an immediate-escalated function at global scope.
277-
(`#82258 <https://github.com/llvm/llvm-project/issues/82258>`_)
278-
- Correctly immediate-escalate lambda conversion functions.
279-
(`#82258 <https://github.com/llvm/llvm-project/issues/82258>`_)
264+
- Clang no longer tries to call consteval constructors at runtime when they appear in a member initializer. (#GH82154)
265+
- Fix crash when using an immediate-escalated function at global scope. (#GH82258)
266+
- Correctly immediate-escalate lambda conversion functions. (#GH82258)
280267
- Fixed an issue where template parameters of a nested abbreviated generic lambda within
281268
a requires-clause lie at the same depth as those of the surrounding lambda. This,
282-
in turn, results in the wrong template argument substitution during constraint checking.
283-
(`#78524 <https://github.com/llvm/llvm-project/issues/78524>`_)
269+
in turn, results in the wrong template argument substitution during constraint checking. (#GH78524)
284270

285271
Bug Fixes to AST Handling
286272
^^^^^^^^^^^^^^^^^^^^^^^^^

clang/docs/conf.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@
1818
# If extensions (or modules to document with autodoc) are in another directory,
1919
# add these directories to sys.path here. If the directory is relative to the
2020
# documentation root, use os.path.abspath to make it absolute, like shown here.
21-
# sys.path.insert(0, os.path.abspath('.'))
21+
sys.path.insert(0, os.path.abspath("."))
2222

2323
# -- General configuration -----------------------------------------------------
2424

@@ -27,7 +27,7 @@
2727

2828
# Add any Sphinx extension module names here, as strings. They can be extensions
2929
# coming with Sphinx (named 'sphinx.ext.*') or your custom ones.
30-
extensions = ["sphinx.ext.todo", "sphinx.ext.mathjax", "sphinx.ext.graphviz"]
30+
extensions = ["sphinx.ext.todo", "sphinx.ext.mathjax", "sphinx.ext.graphviz", "ghlinks"]
3131

3232
# Add any paths that contain templates here, relative to this directory.
3333
templates_path = ["_templates"]

clang/docs/ghlinks.py

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
#!/usr/bin/env python3
2+
3+
from sphinx.application import Sphinx
4+
import re
5+
6+
__version__ = "1.0"
7+
8+
9+
def subst_gh_links(app: Sphinx, docname, source):
10+
regex = re.compile("#GH([0-9]+)")
11+
out_pattern = r"`#\1 <https://github.com/llvm/llvm-project/issues/\1>`_"
12+
result = source[0]
13+
result = regex.sub(out_pattern, result)
14+
source[0] = result
15+
16+
17+
def setup(app: Sphinx):
18+
app.connect("source-read", subst_gh_links)
19+
return dict(version=__version__, parallel_read_safe=True, parallel_write_safe=True)

0 commit comments

Comments
 (0)