diff --git a/src/plugins/clangcodemodel/clangutils.cpp b/src/plugins/clangcodemodel/clangutils.cpp index 33bb8473a9e..ca7c0ae8546 100644 --- a/src/plugins/clangcodemodel/clangutils.cpp +++ b/src/plugins/clangcodemodel/clangutils.cpp @@ -72,60 +72,6 @@ ProjectPart::ConstPtr projectPartForFile(const QString &filePath) return ProjectPart::ConstPtr(); } -ProjectPart::ConstPtr projectPartForFileBasedOnProcessor(const QString &filePath) -{ - if (const auto processor = ClangEditorDocumentProcessor::get(filePath)) - return processor->projectPart(); - return ProjectPart::ConstPtr(); -} - -bool isProjectPartLoaded(const ProjectPart::ConstPtr projectPart) -{ - if (projectPart) - return !CppModelManager::instance()->projectPartForId(projectPart->id()).isNull(); - return false; -} - -QString projectPartIdForFile(const QString &filePath) -{ - const ProjectPart::ConstPtr projectPart = projectPartForFile(filePath); - - if (isProjectPartLoaded(projectPart)) - return projectPart->id(); // OK, Project Part is still loaded - return QString(); -} - -CppEditorDocumentHandle *cppDocument(const QString &filePath) -{ - return CppEditor::CppModelManager::instance()->cppEditorDocument(filePath); -} - -void setLastSentDocumentRevision(const QString &filePath, uint revision) -{ - if (CppEditorDocumentHandle *document = cppDocument(filePath)) - document->sendTracker().setLastSentRevision(int(revision)); -} - -int clangColumn(const QTextBlock &line, int cppEditorColumn) -{ - // (1) cppEditorColumn is the actual column shown by CppEditor. - // (2) The return value is the column in Clang which is the utf8 byte offset from the beginning - // of the line. - // Here we convert column from (1) to (2). - // '- 1' and '+ 1' are because of 1-based columns - return line.text().left(cppEditorColumn - 1).toUtf8().size() + 1; -} - -int cppEditorColumn(const QTextBlock &line, int clangColumn) -{ - // (1) clangColumn is the column in Clang which is the utf8 byte offset from the beginning - // of the line. - // (2) The return value is the actual column shown by CppEditor. - // Here we convert column from (1) to (2). - // '- 1' and '+ 1' are because of 1-based columns - return QString::fromUtf8(line.text().toUtf8().left(clangColumn - 1)).size() + 1; -} - QString diagnosticCategoryPrefixRemoved(const QString &text) { QString theText = text; diff --git a/src/plugins/clangcodemodel/clangutils.h b/src/plugins/clangcodemodel/clangutils.h index 4480bdc5438..675a8d813dc 100644 --- a/src/plugins/clangcodemodel/clangutils.h +++ b/src/plugins/clangcodemodel/clangutils.h @@ -51,9 +51,6 @@ namespace ProjectExplorer { class Project; } namespace ClangCodeModel { namespace Internal { -CppEditor::CppEditorDocumentHandle *cppDocument(const QString &filePath); -void setLastSentDocumentRevision(const QString &filePath, uint revision); - CppEditor::ClangDiagnosticConfig warningsConfigForProject(ProjectExplorer::Project *project); const QStringList optionsForProject(ProjectExplorer::Project *project, const CppEditor::ClangDiagnosticConfig &warningsConfig); @@ -72,11 +69,6 @@ QJsonArray clangOptionsForFile(const CppEditor::ProjectFile &file, CppEditor::UsePrecompiledHeaders usePch); CppEditor::ProjectPart::ConstPtr projectPartForFile(const QString &filePath); -CppEditor::ProjectPart::ConstPtr projectPartForFileBasedOnProcessor(const QString &filePath); -bool isProjectPartLoaded(const CppEditor::ProjectPart::ConstPtr projectPart); -QString projectPartIdForFile(const QString &filePath); -int clangColumn(const QTextBlock &line, int cppEditorColumn); -int cppEditorColumn(const QTextBlock &line, int clangColumn); QString currentCppEditorDocumentFilePath(); @@ -235,6 +227,5 @@ inline bool operator!=(const ClangDiagnostic &first, const ClangDiagnostic &seco return !(first == second); } - } // namespace Internal } // namespace Clang