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"
8#include "parsererror.h"
9#include "config.h"
10
11#include <QtCore/qtemporarydir.h>
12#include <QtCore/QStringList>
13
14#include <optional>
15
17
18class CppCodeParser;
19
20QT_BEGIN_NAMESPACE
21
22struct ParsedCppFileIR {
23 std::vector<UntiedDocumentation> untied;
24 std::vector<TiedDocumentation> tied;
25};
26
31
32std::optional<PCHFile> buildPCH(
33 QDocDatabase* qdb,
34 QString module_header,
35 const std::set<Config::HeaderFilePath>& all_headers,
36 const std::vector<QByteArray>& include_paths,
37 const QList<QByteArray>& defines
38);
39
42 QDocDatabase* qdb,
43 const std::set<Config::HeaderFilePath>& all_headers,
44 const QList<QByteArray>& defines,
45 std::optional<std::reference_wrapper<const PCHFile>> pch
46 ) : m_qdb{qdb},
49 m_args{},
50 m_pch{pch}
51 {}
52
54 const Location &location,
55 const QString &fnSignature,
56 const QString &idTag,
57 QStringList context
58 );
59
60private:
61 QDocDatabase* m_qdb;
62 const std::set<Config::HeaderFilePath>& m_allHeaders; // file name->path
63 QList<QByteArray> m_defines {};
64 std::vector<const char *> m_args {};
65 std::optional<std::reference_wrapper<const PCHFile>> m_pch;
66};
67
69{
70public:
72 QDocDatabase* qdb,
73 Config&,
74 const std::vector<QByteArray>& include_paths,
75 const QList<QByteArray>& defines,
76 std::optional<std::reference_wrapper<const PCHFile>> pch
77 );
78
79 ParsedCppFileIR parse_cpp_file(const QString &filePath);
80
81private:
82 QDocDatabase* m_qdb{};
83 std::set<Config::HeaderFilePath> m_allHeaders {}; // file name->path
84 const std::vector<QByteArray>& m_includePaths;
85 QList<QByteArray> m_defines {};
86 std::vector<const char *> m_args {};
87 QStringList m_namespaceScope {};
88 QByteArray s_fn;
89 std::optional<std::reference_wrapper<const PCHFile>> m_pch;
90};
91
92QT_END_NAMESPACE
93
94#endif
int main(int argc, char *argv[])
[2]
Definition buffer.cpp:77
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)
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:263
The Config class contains the configuration variables for controlling how qdoc produces documentation...
Definition config.h:84
static const QString dot
Definition config.h:162
bool singleExec() const
Definition config.h:402
@ IncludePaths
Definition config.h:104
const Location & location() const
Definition config.h:121
const ExcludedPaths & getExcludedPaths()
Definition config.cpp:1405
bool dualExec() const
Definition config.h:407
bool preparing() const
Definition config.h:181
bool getDebug() const
Definition config.h:108
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:308
static void terminate()
All the heap allocated variables are deleted.
Definition doc.cpp:361
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:15
static int exitCode()
Returns the error code QDoc should exit with; EXIT_SUCCESS or the number of documentation warnings if...
Definition location.cpp:244
static void initialize()
Gets several parameters from the config, including tab size, program name, and a regular expression t...
Definition location.cpp:297
Location()
Constructs an empty location.
Definition location.cpp:40
static void terminate()
Apparently, all this does is delete the regular expression used for intercepting certain error messag...
Definition location.cpp:324
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:382
#define CONFIG_VERSION
Definition config.h:392
#define CONFIG_EXAMPLEDIRS
Definition config.h:335
#define CONFIG_INDEXES
Definition config.h:356
#define CONFIG_DEFINES
Definition config.h:330
#define CONFIG_DEPENDS
Definition config.h:331
#define CONFIG_NOLINKERRORS
Definition config.h:367
#define CONFIG_LOGPROGRESS
Definition config.h:361
#define CONFIG_IMAGEDIRS
Definition config.h:353
#define CONFIG_PROJECT
Definition config.h:373
#define CONFIG_SOURCEDIRS
Definition config.h:380
#define CONFIG_NAVIGATION
Definition config.h:366
#define CONFIG_LANDINGPAGE
Definition config.h:357
#define CONFIG_OUTPUTFORMATS
Definition config.h:369
#define CONFIG_LANDINGTITLE
Definition config.h:358
#define CONFIG_MODULEHEADER
Definition config.h:364
#define CONFIG_INCLUDEPATHS
Definition config.h:354
Combined button and popup list for selecting options.
This namespace holds QDoc-internal utility methods.
Definition utilities.h:15
bool debugging()
Definition utilities.cpp:38
static void parseSourceFiles(std::vector< QString > &&sources, SourceFileParser &source_file_parser, CppCodeParser &cpp_code_parser)
Definition main.cpp:64
static void singleExecutionMode()
Definition main.cpp:647
void logStartEndMessage(const QLatin1String &startStop, Config &config)
Definition main.cpp:273
static void processQdocconfFile(const QString &fileName)
Processes the qdoc config file fileName.
Definition main.cpp:295
static void clearModuleDependenciesAndProcessQdocconfFile(const QStringList &qdocFiles)
Definition main.cpp:629
static void dualExecutionMode()
Definition main.cpp:664
bool creationTimeBefore(const QFileInfo &fi1, const QFileInfo &fi2)
Definition main.cpp:45
static void loadIndexFiles(const QSet< QString > &formats)
Read some XML indexes containing definitions from other documentation sets.
Definition main.cpp:121
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