You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
QDoc: Adapt clang/AST/QualTypeNames.h to upstream changes
For compatibility reasons, QDoc carries a custom implementation of
`llvm-project.git/clang/lib/AST/QualTypeNames.cpp`. When QDoc is built
against Clang libraries from LLVM 19, a segmentation fault occurs when
generating the documentation for the Qt 3D module as part of a qt5.git
super-module documentation build.
The segmentation fault is the result of a `nullptr` being passed to
`clang::TypeName::getFullyQualifiedNestedNameSpecifier` for the
`Scope` parameter.
Upon investigation, it became clear that two changes have been made
upstream to the implementation QDoc carries a customized version of,
one of which adds a `nullptr` check. Due to the small footprint of
both changes, this patch applies both of them to QDoc's
`clang/AST/QualTypeNames.h`:
- The upstream change 16832eb58563f77d917198ad9f86db1c2ee162c9 adds a
`nullptr` check, see llvm/llvm-project#94084
for details.
- The upstream change 35bfbb3b21e9874d03b730e8ce4eb98b1dcd2d28
replaces `dyn_cast_or_null<T>(foo)` with `dyn_cast<T>(foo)` for
never-null arguments. See
llvm/llvm-project@35bfbb3
for details.
The changes apply also when QDoc is built against Clang libraries from
LLVM 17 and 18, with both end-to-end tests passing. Given the nature of
the changes, this means these adaptations do not require being wrapped
in `#if LIBCLANG_VERSION_MAJOR` checks.
Fixes: QTBUG-128926
Change-Id: I5863ca213a35042ed325971b42de2bc1e86c6457
Reviewed-by: Luca Di Sera <luca.disera@qt.io>
Reviewed-by: Topi Reiniö <topi.reinio@qt.io>
(cherry picked from commit a2f478b)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
0 commit comments