File indexing completed on 2024-05-12 08:38:56
0001 /* 0002 SPDX-FileCopyrightText: 2013 Olivier de Gaalon <olivier.jg@gmail.com> 0003 SPDX-FileCopyrightText: 2013 Milian Wolff <mail@milianw.de> 0004 0005 SPDX-License-Identifier: LGPL-2.0-or-later 0006 */ 0007 0008 #ifndef CLANGPARSEJOB_H 0009 #define CLANGPARSEJOB_H 0010 0011 #include <QHash> 0012 0013 #include <language/backgroundparser/parsejob.h> 0014 #include "duchain/clangparsingenvironment.h" 0015 #include "duchain/unsavedfile.h" 0016 #include "duchain/parsesession.h" 0017 0018 class ClangSupport; 0019 0020 class ClangParseJob : public KDevelop::ParseJob 0021 { 0022 Q_OBJECT 0023 public: 0024 ClangParseJob(const KDevelop::IndexedString& url, 0025 KDevelop::ILanguageSupport* languageSupport); 0026 0027 ClangSupport* clang() const; 0028 0029 enum CustomFeatures { 0030 Rescheduled = (KDevelop::TopDUContext::LastFeature << 1), 0031 AttachASTWithoutUpdating = (Rescheduled << 1), ///< Used when context is up to date, but has no AST attached. 0032 UpdateHighlighting = (AttachASTWithoutUpdating << 1) ///< Used when we only need to update highlighting 0033 }; 0034 0035 protected: 0036 void run(ThreadWeaver::JobPointer self, ThreadWeaver::Thread *thread) override; 0037 0038 const KDevelop::ParsingEnvironment* environment() const override; 0039 0040 private: 0041 QExplicitlySharedDataPointer<ParseSessionData> createSessionData() const; 0042 0043 ClangParsingEnvironment m_environment; 0044 QVector<UnsavedFile> m_unsavedFiles; 0045 ParseSessionData::Options m_options; 0046 bool m_tuDocumentIsUnsaved = false; 0047 QHash<KDevelop::IndexedString, KDevelop::ModificationRevision> m_unsavedRevisions; 0048 }; 0049 0050 #endif // CLANGPARSEJOB_H