QDoc: Don't invoke Clang if C++ parsing is disabled in configuration


Documentation projects that have no C++ documentation to parse can
set an empty `moduleheader` variable in the configuration. This stops
QDoc from building a precompiled header, used for speeding up the
parsing process.

Even without a PCH, QDoc still invoked ClangCodeParser for all .cpp
files listed as sources. This was both unnecessary and time-consuming;
often QDoc does not have a complete set of include paths available
either for such projects, and Clang encounters multiple errors trying
to parse C++ source files that do not contain documented C++ entities
anyway.

Switch to use PureDocParser for parsing C++ source files if C++
parsing is disabled. This speeds up QDoc considerably for projects
that only document QML APIs in C++ source files.

Add a proper inclusion policy check to PureDocParser to avoid false
positive warning for missing topic commands when parsing C++ sources
as pure .qdoc files.

Pick-to: 6.12
Fixes: QTBUG-147135
Change-Id: I057c82fd35f64c76ff5a528b5dcffb49d0928b8b
Reviewed-by: Paul Wicking <paul.wicking@qt.io>
commit3c0d81ba830c8e53e3e0e23c9d9dc18a89efcb7e
parent4b2d434af6391f4e0a0db80da711b57e43614634
authorTopi Reinio <topi.reinio@qt.io>
committerTopi Reinio <topi.reinio@qt.io>
commit timeThu, 9 Jul 2026 13:10:57 +0000