// Copyright (C) 2021 The Qt Company Ltd. // SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0 #ifndef CLANGCODEPARSER_H #define CLANGCODEPARSER_H #include "cppcodeparser.h" #include "config.h" #include #include #include typedef struct CXTranslationUnitImpl *CXTranslationUnit; QT_BEGIN_NAMESPACE struct ParsedCppFileIR { std::vector untied; std::vector tied; }; struct PCHFile { QTemporaryDir dir; QByteArray name; }; std::optional buildPCH( QDocDatabase* qdb, QString module_header, const std::set& all_headers, const std::vector& include_paths, const QList& defines ); class ClangCodeParser : public CodeParser { public: ClangCodeParser( Config&, const std::vector& include_paths, const QList& defines, std::optional> pch ); ~ClangCodeParser() override = default; void initializeParser() override {} void terminateParser() override {} QString language() override; QStringList sourceFileNameFilter() override; void parseSourceFile(const Location &, const QString &, CppCodeParser&) override {} ParsedCppFileIR parse_cpp_file(const QString &filePath); Node *parseFnArg(const Location &location, const QString &fnSignature, const QString &idTag, QStringList context); private: std::set m_allHeaders {}; // file name->path const std::vector& m_includePaths; QList m_defines {}; std::vector m_args {}; QStringList m_namespaceScope {}; QByteArray s_fn; std::optional> m_pch; }; QT_END_NAMESPACE #endif