Skip to content

Commit 6e36ceb

Browse files
authored
[Clang][Docs] Simpler syntax for Github links. (#82746)
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.
1 parent 6b62a91 commit 6e36ceb

File tree

3 files changed

+58
-56
lines changed

3 files changed

+58
-56
lines changed

clang/docs/ReleaseNotes.rst

Lines changed: 37 additions & 54 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,14 +186,14 @@ 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

193193
- Clang now diagnoses declarative nested name specifiers that name alias templates.
194194

195195
- Clang now diagnoses lambda function expressions being implicitly cast to boolean values, under ``-Wpointer-bool-conversion``.
196-
Fixes `#82512 <https://github.com/llvm/llvm-project/issues/82512>`_.
196+
Fixes #GH82512.
197197

198198
Improvements to Clang's time-trace
199199
----------------------------------
@@ -206,21 +206,21 @@ Bug Fixes in This Version
206206
- Clang now accepts elaborated-type-specifiers that explicitly specialize
207207
a member class template for an implicit instantiation of a class template.
208208

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

214214
- Clang now accepts qualified partial/explicit specializations of variable templates that
215215
are not nominable in the lookup context of the specialization.
216216

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

221221
- Clang no longer produces a false-positive `-Wunused-variable` warning
222222
for variables created through copy initialization having side-effects in C++17 and later.
223-
Fixes (`#79518 <https://github.com/llvm/llvm-project/issues/79518>`_).
223+
Fixes (#GH64356) (#GH79518).
224224

225225
Bug Fixes to Compiler Builtins
226226
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
@@ -232,84 +232,67 @@ Bug Fixes to C++ Support
232232
^^^^^^^^^^^^^^^^^^^^^^^^
233233

234234
- Fix crash when calling the constructor of an invalid class.
235-
Fixes (`#10518 <https://github.com/llvm/llvm-project/issues/10518>`_),
236-
(`#67914 <https://github.com/llvm/llvm-project/issues/10518>`_),
237-
and (`#78388 <https://github.com/llvm/llvm-project/issues/78388>`_)
235+
(#GH10518) (#GH67914) (#GH78388)
238236
- Fix crash when using lifetimebound attribute in function with trailing return.
239-
Fixes (`#73619 <https://github.com/llvm/llvm-project/issues/73619>`_)
237+
(#GH73619)
240238
- Addressed an issue where constraints involving injected class types are perceived
241-
distinct from its specialization types.
242-
(`#56482 <https://github.com/llvm/llvm-project/issues/56482>`_)
239+
distinct from its specialization types. (#GH56482)
243240
- Fixed a bug where variables referenced by requires-clauses inside
244-
nested generic lambdas were not properly injected into the constraint scope.
245-
(`#73418 <https://github.com/llvm/llvm-project/issues/73418>`_)
241+
nested generic lambdas were not properly injected into the constraint scope. (#GH73418)
246242
- Fixed a crash where substituting into a requires-expression that refers to function
247243
parameters during the equivalence determination of two constraint expressions.
248-
(`#74447 <https://github.com/llvm/llvm-project/issues/74447>`_)
244+
(#GH74447)
249245
- Fixed deducing auto& from const int in template parameters of partial
250-
specializations.
251-
(`#77189 <https://github.com/llvm/llvm-project/issues/77189>`_)
246+
specializations. (#GH77189)
252247
- Fix for crash when using a erroneous type in a return statement.
253-
Fixes (`#63244 <https://github.com/llvm/llvm-project/issues/63244>`_)
254-
and (`#79745 <https://github.com/llvm/llvm-project/issues/79745>`_)
248+
(#GH63244) (#GH79745)
255249
- Fixed an out-of-bounds error caused by building a recovery expression for ill-formed
256-
function calls while substituting into constraints.
257-
(`#58548 <https://github.com/llvm/llvm-project/issues/58548>`_)
258-
- Fix incorrect code generation caused by the object argument of ``static operator()`` and ``static operator[]`` calls not being evaluated.
259-
Fixes (`#67976 <https://github.com/llvm/llvm-project/issues/67976>`_)
250+
function calls while substituting into constraints. (#GH58548)
251+
- Fix incorrect code generation caused by the object argument
252+
of ``static operator()`` and ``static operator[]`` calls not being evaluated. (#GH67976)
260253
- Fix crash and diagnostic with const qualified member operator new.
261-
Fixes (`#79748 <https://github.com/llvm/llvm-project/issues/79748>`_)
254+
Fixes (#GH79748)
262255
- Fixed a crash where substituting into a requires-expression that involves parameter packs
263-
during the equivalence determination of two constraint expressions.
264-
(`#72557 <https://github.com/llvm/llvm-project/issues/72557>`_)
256+
during the equivalence determination of two constraint expressions. (#GH72557)
265257
- Fix a crash when specializing an out-of-line member function with a default
266258
parameter where we did an incorrect specialization of the initialization of
267-
the default parameter.
268-
Fixes (`#68490 <https://github.com/llvm/llvm-project/issues/68490>`_)
259+
the default parameter. (#GH68490)
269260
- Fix a crash when trying to call a varargs function that also has an explicit object parameter.
270-
Fixes (`#80971 ICE when explicit object parameter be a function parameter pack`)
271-
- Reject explicit object parameters on `new` and `delete` operators.
272-
Fixes (`#82249 <https://github.com/llvm/llvm-project/issues/82249>` _)
261+
Fixes (#GH80971)
262+
- Reject explicit object parameters on `new` and `delete` operators. (#GH82249)
263+
- Fix a crash when trying to call a varargs function that also has an explicit object parameter. (#GH80971)
273264
- Fixed a bug where abbreviated function templates would append their invented template parameters to
274265
an empty template parameter lists.
275266
- Clang now classifies aggregate initialization in C++17 and newer as constant
276267
or non-constant more accurately. Previously, only a subset of the initializer
277-
elements were considered, misclassifying some initializers as constant. Fixes
278-
some of (`#80510 <https://github.com/llvm/llvm-project/issues/80510>`).
279-
- Clang now ignores top-level cv-qualifiers on function parameters in template partial orderings.
280-
(`#75404 <https://github.com/llvm/llvm-project/issues/75404>`_)
268+
elements were considered, misclassifying some initializers as constant. Partially fixes
269+
#GH80510.
270+
- Clang now ignores top-level cv-qualifiers on function parameters in template partial orderings. (#GH75404)
281271
- No longer reject valid use of the ``_Alignas`` specifier when declaring a
282272
local variable, which is supported as a C11 extension in C++. Previously, it
283273
was only accepted at namespace scope but not at local function scope.
284-
- Clang no longer tries to call consteval constructors at runtime when they appear in a member initializer.
285-
(`#82154 <https://github.com/llvm/llvm-project/issues/82154>`_`)
286-
- Fix crash when using an immediate-escalated function at global scope.
287-
(`#82258 <https://github.com/llvm/llvm-project/issues/82258>`_)
288-
- Correctly immediate-escalate lambda conversion functions.
289-
(`#82258 <https://github.com/llvm/llvm-project/issues/82258>`_)
274+
- Clang no longer tries to call consteval constructors at runtime when they appear in a member initializer. (#GH82154)
275+
- Fix crash when using an immediate-escalated function at global scope. (#GH82258)
276+
- Correctly immediate-escalate lambda conversion functions. (#GH82258)
290277
- Fixed an issue where template parameters of a nested abbreviated generic lambda within
291278
a requires-clause lie at the same depth as those of the surrounding lambda. This,
292279
in turn, results in the wrong template argument substitution during constraint checking.
293-
(`#78524 <https://github.com/llvm/llvm-project/issues/78524>`_)
280+
(#GH78524)
294281
- Clang no longer instantiates the exception specification of discarded candidate function
295282
templates when determining the primary template of an explicit specialization.
296283
- Fixed a crash in Microsoft compatibility mode where unqualified dependent base class
297284
lookup searches the bases of an incomplete class.
298285
- Fix a crash when an unresolved overload set is encountered on the RHS of a ``.*`` operator.
299-
(`#53815 <https://github.com/llvm/llvm-project/issues/53815>`_)
286+
(#GH53815)
300287
- In ``__restrict``-qualified member functions, attach ``__restrict`` to the pointer type of
301288
``this`` rather than the pointee type.
302-
Fixes (`#82941 <https://github.com/llvm/llvm-project/issues/82941>`_),
303-
(`#42411 <https://github.com/llvm/llvm-project/issues/42411>`_), and
304-
(`#18121 <https://github.com/llvm/llvm-project/issues/18121>`_).
289+
Fixes (#GH82941), (#GH42411) and (#GH18121).
305290
- Clang now properly reports supported C++11 attributes when using
306-
``__has_cpp_attribute`` and parses attributes with arguments in C++03
307-
(`#82995 <https://github.com/llvm/llvm-project/issues/82995>`_)
291+
``__has_cpp_attribute`` and parses attributes with arguments in C++03 (#GH82995)
308292
- Clang now properly diagnoses missing 'default' template arguments on a variety
309293
of templates. Previously we were diagnosing on any non-function template
310294
instead of only on class, alias, and variable templates, as last updated by
311-
CWG2032.
312-
Fixes (`#83461 <https://github.com/llvm/llvm-project/issues/83461>`_)
295+
CWG2032. Fixes (#GH#83461)
313296

314297

315298
Bug Fixes to AST Handling

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)