Qt
Internal/Contributor docs for the Qt SDK. Note: These are NOT official API docs; those are found at https://doc.qt.io/
Loading...
Searching...
No Matches
clangcodeparser.h
Go to the documentation of this file.
1// Copyright (C) 2021 The Qt Company Ltd.
2// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0
3
4#ifndef CLANGCODEPARSER_H
5#define CLANGCODEPARSER_H
6
7#include "codeparser.h"
9#include "parsererror.h"
10#include "config.h"
11
12#include <QtCore/qtemporarydir.h>
13#include <QtCore/QStringList>
14
15#include <optional>
16
18
19class CppCodeParser;
20
21QT_BEGIN_NAMESPACE
22
23struct ParsedCppFileIR {
24 std::vector<UntiedDocumentation> untied;
25 std::vector<TiedDocumentation> tied;
26};
27
32
33std::optional<PCHFile> buildPCH(
34 QDocDatabase* qdb,
35 QString module_header,
36 const std::set<Config::HeaderFilePath>& all_headers,
37 const std::vector<QByteArray>& include_paths,
38 const QList<QByteArray>& defines,
39 const InclusionPolicy& policy
40);
41
44 QDocDatabase* qdb,
45 const std::set<Config::HeaderFilePath>& all_headers,
46 const QList<QByteArray>& defines,
47 std::optional<std::reference_wrapper<const PCHFile>> pch
48 ) : m_qdb{qdb},
51 m_args{},
52 m_pch{pch}
53 {}
54
56 const Location &location,
57 const QString &fnSignature,
58 const QString &idTag,
59 QStringList context
60 );
61
62private:
63 QDocDatabase* m_qdb;
64 const std::set<Config::HeaderFilePath>& m_allHeaders; // file name->path
65 QList<QByteArray> m_defines {};
66 std::vector<const char *> m_args {};
67 std::optional<std::reference_wrapper<const PCHFile>> m_pch;
68};
69
71{
72public:
74 QDocDatabase* qdb,
75 Config&,
76 const std::vector<QByteArray>& include_paths,
77 const QList<QByteArray>& defines,
78 std::optional<std::reference_wrapper<const PCHFile>> pch
79 );
80
81 ParsedCppFileIR parse_cpp_file(const QString &filePath);
82
83private:
84 QDocDatabase* m_qdb{};
85 std::set<Config::HeaderFilePath> m_allHeaders {}; // file name->path
86 const std::vector<QByteArray>& m_includePaths;
87 QList<QByteArray> m_defines {};
88 std::vector<const char *> m_args {};
89 QStringList m_namespaceScope {};
90 QByteArray s_fn;
91 std::optional<std::reference_wrapper<const PCHFile>> m_pch;
92};
93
94QT_END_NAMESPACE
95
96#endif
std::optional< PCHFile > buildPCH(QDocDatabase *qdb, QString module_header, const std::set< Config::HeaderFilePath > &all_headers, const std::vector< QByteArray > &include_paths, const QList< QByteArray > &defines, const InclusionPolicy &policy)
Building the PCH must be possible when there are no .cpp files, so it is moved here to its own member...
struct CXTranslationUnitImpl * CXTranslationUnit
ParsedCppFileIR parse_cpp_file(const QString &filePath)
Get ready to parse the C++ cpp file identified by filePath and add its parsed contents to the databas...
ClangCodeParser(QDocDatabase *qdb, Config &, const std::vector< QByteArray > &include_paths, const QList< QByteArray > &defines, std::optional< std::reference_wrapper< const PCHFile > > pch)
static void initialize()
All the code markers in the static list are initialized here, after the qdoc configuration file has b...
static void terminate()
All the code markers in the static list are terminated here.
static CodeParser * parserForSourceFile(const QString &filePath)
static void initialize()
All the code parsers in the static list are initialized here, after the qdoc configuration variables ...
static void terminate()
All the code parsers in the static list are terminated here.
bool asBool() const
Returns this config variable as a boolean.
Definition config.cpp:273
The Config class contains the configuration variables for controlling how qdoc produces documentation...
Definition config.h:85
static const QString dot
Definition config.h:168
bool singleExec() const
Definition config.h:437
@ IncludePaths
Definition config.h:105
const Location & location() const
Definition config.h:126
const ExcludedPaths & getExcludedPaths()
Definition config.cpp:1426
bool dualExec() const
Definition config.h:442
bool preparing() const
Definition config.h:187
bool getDebug() const
Definition config.h:109
CppCodeParser(FnCommandParser &&parser)
void processMetaCommands(const Doc &doc, Node *node)
The topic command has been processed, and now doc and node are passed to this function to get the met...
DocBookGenerator(FileResolver &file_resolver)
Definition doc.h:31
static void initialize(FileResolver &file_resolver)
Definition doc.cpp:316
static void terminate()
All the heap allocated variables are deleted.
Definition doc.cpp:369
Encapsulate the logic that QDoc uses to find files whose path is provided by the user and that are re...
static void initialize()
static void terminate()
HtmlGenerator(FileResolver &file_resolver)
The Location class provides a way to mark a location in a file.
Definition location.h:20
static int exitCode()
Returns the error code QDoc should exit with; EXIT_SUCCESS or the number of documentation warnings if...
Definition location.cpp:250
static void initialize()
Gets several parameters from the config, including tab size, program name, and a regular expression t...
Definition location.cpp:303
Location()
Constructs an empty location.
Definition location.cpp:46
static void terminate()
Apparently, all this does is delete the regular expression used for intercepting certain error messag...
Definition location.cpp:451
This class represents a C++ namespace.
Tree * tree() const override
Returns a pointer to the Tree that contains this NamespaceNode.
PureDocParser(const Location &location)
This class provides exclusive access to the qdoc database, which consists of a forrest of trees and a...
static void destroyQdocDB()
Destroys the singleton.
static QDocDatabase * qdocDB()
Creates the singleton.
NamespaceNode * primaryTreeRoot()
Returns a pointer to the root node of the primary tree.
void processForest()
This function calls a set of functions for each tree in the forest that has not already been analyzed...
void clearSearchOrder()
void resolveStuff()
Performs several housekeeping tasks prior to generating the documentation.
static void terminate()
Clear the static maps so that subsequent runs don't try to use contents from a previous run.
SourceFileParser(ClangCodeParser &clang_parser, PureDocParser &pure_parser)
static void terminate()
The heap allocated variables are freed here.
static void initialize()
WebXMLGenerator(FileResolver &file_resolver)
#define CONFIG_SOURCES
Definition config.h:416
#define CONFIG_VERSION
Definition config.h:427
#define CONFIG_EXAMPLEDIRS
Definition config.h:363
#define CONFIG_INDEXES
Definition config.h:385
#define CONFIG_DEFINES
Definition config.h:357
#define CONFIG_DEPENDS
Definition config.h:358
#define CONFIG_NOLINKERRORS
Definition config.h:398
#define CONFIG_LOGPROGRESS
Definition config.h:390
#define CONFIG_IMAGEDIRS
Definition config.h:381
#define CONFIG_PROJECT
Definition config.h:404
#define CONFIG_SOURCEDIRS
Definition config.h:414
#define CONFIG_HEADERS
Definition config.h:372
#define CONFIG_DOCUMENTATIONINHEADERS
Definition config.h:361
#define CONFIG_NAVIGATION
Definition config.h:397
#define CONFIG_LANDINGPAGE
Definition config.h:386
#define CONFIG_OUTPUTFORMATS
Definition config.h:400
#define CONFIG_LANDINGTITLE
Definition config.h:387
#define CONFIG_MODULEHEADER
Definition config.h:395
#define CONFIG_HEADERDIRS
Definition config.h:371
#define CONFIG_INCLUDEPATHS
Definition config.h:382
This namespace holds QDoc-internal utility methods.
Definition utilities.h:20
bool debugging()
Definition utilities.cpp:42
static void parseSourceFiles(std::vector< QString > &&sources, SourceFileParser &source_file_parser, CppCodeParser &cpp_code_parser)
Definition main.cpp:65
static void singleExecutionMode()
Definition main.cpp:661
void logStartEndMessage(const QLatin1String &startStop, Config &config)
Definition main.cpp:281
static void processQdocconfFile(const QString &fileName)
Processes the qdoc config file fileName.
Definition main.cpp:303
static void clearModuleDependenciesAndProcessQdocconfFile(const QStringList &qdocFiles)
Definition main.cpp:643
static void dualExecutionMode()
Definition main.cpp:678
bool creationTimeBefore(const QFileInfo &fi1, const QFileInfo &fi2)
Definition main.cpp:46
static void loadIndexFiles(const QSet< QString > &formats)
Read some XML indexes containing definitions from other documentation sets.
Definition main.cpp:129
int main(int argc, char *argv[])
[ctor_close]
FnCommandParser(QDocDatabase *qdb, const std::set< Config::HeaderFilePath > &all_headers, const QList< QByteArray > &defines, std::optional< std::reference_wrapper< const PCHFile > > pch)
std::variant< Node *, FnMatchError > operator()(const Location &location, const QString &fnSignature, const QString &idTag, QStringList context)
Use clang to parse the function signature from a function command.
QByteArray name
QTemporaryDir dir
Processes parser errors and outputs warnings for them.
Definition parsererror.h:20