forked from qt-creator/qt-creator
Clang: Make some functions available for reuse
Change-Id: I7b85ea104a852c1168578949247efb8387a95f30 Reviewed-by: Ivan Donchevskii <ivan.donchevskii@qt.io>
This commit is contained in:
@@ -140,20 +140,6 @@ void BackendCommunicator::initializeBackend()
|
||||
}
|
||||
|
||||
namespace {
|
||||
Utf8String currentCppEditorDocumentFilePath()
|
||||
{
|
||||
Utf8String currentCppEditorDocumentFilePath;
|
||||
|
||||
const auto currentEditor = Core::EditorManager::currentEditor();
|
||||
if (currentEditor && CppTools::CppModelManager::isCppEditor(currentEditor)) {
|
||||
const auto currentDocument = currentEditor->document();
|
||||
if (currentDocument)
|
||||
currentCppEditorDocumentFilePath = currentDocument->filePath().toString();
|
||||
}
|
||||
|
||||
return currentCppEditorDocumentFilePath;
|
||||
}
|
||||
|
||||
void removeDuplicates(Utf8StringVector &visibleEditorDocumentsFilePaths)
|
||||
{
|
||||
std::sort(visibleEditorDocumentsFilePaths.begin(),
|
||||
@@ -204,7 +190,8 @@ Utf8StringVector visibleCppEditorDocumentsFilePaths()
|
||||
|
||||
void BackendCommunicator::documentVisibilityChanged()
|
||||
{
|
||||
documentVisibilityChanged(currentCppEditorDocumentFilePath(), visibleCppEditorDocumentsFilePaths());
|
||||
documentVisibilityChanged(Utils::currentCppEditorDocumentFilePath(),
|
||||
visibleCppEditorDocumentsFilePaths());
|
||||
}
|
||||
|
||||
bool BackendCommunicator::isNotWaitingForCompletion() const
|
||||
@@ -480,7 +467,7 @@ void BackendCommunicator::documentsOpened(const FileContainers &fileContainers)
|
||||
Utf8String currentDocument;
|
||||
Utf8StringVector visibleDocuments;
|
||||
if (!m_postponeBackendJobs) {
|
||||
currentDocument = currentCppEditorDocumentFilePath();
|
||||
currentDocument = Utils::currentCppEditorDocumentFilePath();
|
||||
visibleDocuments = visibleCppEditorDocumentsFilePaths();
|
||||
}
|
||||
|
||||
|
||||
@@ -354,5 +354,19 @@ void generateCompilationDB(::Utils::FileName projectDir, CppTools::ProjectInfo p
|
||||
compileCommandsFile.close();
|
||||
}
|
||||
|
||||
QString currentCppEditorDocumentFilePath()
|
||||
{
|
||||
QString filePath;
|
||||
|
||||
const auto currentEditor = Core::EditorManager::currentEditor();
|
||||
if (currentEditor && CppTools::CppModelManager::isCppEditor(currentEditor)) {
|
||||
const auto currentDocument = currentEditor->document();
|
||||
if (currentDocument)
|
||||
filePath = currentDocument->filePath().toString();
|
||||
}
|
||||
|
||||
return filePath;
|
||||
}
|
||||
|
||||
} // namespace Utils
|
||||
} // namespace Clang
|
||||
|
||||
@@ -62,6 +62,8 @@ QString projectPartIdForFile(const QString &filePath);
|
||||
int clangColumn(const QTextBlock &line, int cppEditorColumn);
|
||||
int cppEditorColumn(const QTextBlock &line, int clangColumn);
|
||||
|
||||
QString currentCppEditorDocumentFilePath();
|
||||
|
||||
QString diagnosticCategoryPrefixRemoved(const QString &text);
|
||||
|
||||
::Utils::CodeModelIcon::Type iconTypeForToken(const ClangBackEnd::TokenInfoContainer &token);
|
||||
|
||||
Reference in New Issue
Block a user