summaryrefslogtreecommitdiff
path: root/src/plugins/clangcodemodel
diff options
context:
space:
mode:
Diffstat (limited to 'src/plugins/clangcodemodel')
-rw-r--r--src/plugins/clangcodemodel/clangdclient.cpp2
-rw-r--r--src/plugins/clangcodemodel/clangdcompletion.cpp3
-rw-r--r--src/plugins/clangcodemodel/clangeditordocumentprocessor.cpp2
-rw-r--r--src/plugins/clangcodemodel/clangeditordocumentprocessor.h2
-rw-r--r--src/plugins/clangcodemodel/clangmodelmanagersupport.cpp6
-rw-r--r--src/plugins/clangcodemodel/clangtextmark.cpp2
-rw-r--r--src/plugins/clangcodemodel/clangutils.cpp11
-rw-r--r--src/plugins/clangcodemodel/clangutils.h4
-rw-r--r--src/plugins/clangcodemodel/test/clangbatchfileprocessor.cpp11
9 files changed, 20 insertions, 23 deletions
diff --git a/src/plugins/clangcodemodel/clangdclient.cpp b/src/plugins/clangcodemodel/clangdclient.cpp
index f911869384..9d37a8c2bf 100644
--- a/src/plugins/clangcodemodel/clangdclient.cpp
+++ b/src/plugins/clangcodemodel/clangdclient.cpp
@@ -773,7 +773,7 @@ void ClangdClient::updateParserConfig(const Utils::FilePath &filePath,
const auto projectPart = !config.preferredProjectPartId.isEmpty()
? CppEditor::CppModelManager::instance()->projectPartForId(
config.preferredProjectPartId)
- : projectPartForFile(filePath.toString());
+ : projectPartForFile(filePath);
if (!projectPart)
return;
diff --git a/src/plugins/clangcodemodel/clangdcompletion.cpp b/src/plugins/clangcodemodel/clangdcompletion.cpp
index 8b7799e868..44fc6df38e 100644
--- a/src/plugins/clangcodemodel/clangdcompletion.cpp
+++ b/src/plugins/clangcodemodel/clangdcompletion.cpp
@@ -426,8 +426,7 @@ IAssistProposal *CustomAssistProcessor::perform()
}
case CustomAssistMode::IncludePath: {
HeaderPaths headerPaths;
- const ProjectPart::ConstPtr projectPart
- = projectPartForFile(interface()->filePath().toString());
+ const ProjectPart::ConstPtr projectPart = projectPartForFile(interface()->filePath());
if (projectPart)
headerPaths = projectPart->headerPaths;
completions = completeInclude(m_endPos, m_completionOperator, interface(), headerPaths);
diff --git a/src/plugins/clangcodemodel/clangeditordocumentprocessor.cpp b/src/plugins/clangcodemodel/clangeditordocumentprocessor.cpp
index d4c2e94bed..3a06c31251 100644
--- a/src/plugins/clangcodemodel/clangeditordocumentprocessor.cpp
+++ b/src/plugins/clangcodemodel/clangeditordocumentprocessor.cpp
@@ -92,7 +92,7 @@ CppEditor::BaseEditorDocumentParser::Configuration ClangEditorDocumentProcessor:
return parser()->configuration();
}
-ClangEditorDocumentProcessor *ClangEditorDocumentProcessor::get(const QString &filePath)
+ClangEditorDocumentProcessor *ClangEditorDocumentProcessor::get(const Utils::FilePath &filePath)
{
return qobject_cast<ClangEditorDocumentProcessor*>(
CppEditor::CppModelManager::cppEditorDocumentProcessor(filePath));
diff --git a/src/plugins/clangcodemodel/clangeditordocumentprocessor.h b/src/plugins/clangcodemodel/clangeditordocumentprocessor.h
index 85d147f190..6d2dede560 100644
--- a/src/plugins/clangcodemodel/clangeditordocumentprocessor.h
+++ b/src/plugins/clangcodemodel/clangeditordocumentprocessor.h
@@ -29,7 +29,7 @@ public:
CppEditor::BaseEditorDocumentParser::Configuration parserConfig();
public:
- static ClangEditorDocumentProcessor *get(const QString &filePath);
+ static ClangEditorDocumentProcessor *get(const Utils::FilePath &filePath);
signals:
void parserConfigChanged(const Utils::FilePath &filePath,
diff --git a/src/plugins/clangcodemodel/clangmodelmanagersupport.cpp b/src/plugins/clangcodemodel/clangmodelmanagersupport.cpp
index bbd43fa37e..6527c630b3 100644
--- a/src/plugins/clangcodemodel/clangmodelmanagersupport.cpp
+++ b/src/plugins/clangcodemodel/clangmodelmanagersupport.cpp
@@ -162,7 +162,7 @@ static void updateParserConfig(ClangdClient *client)
if (!client->documentOpen(editor->textDocument()))
return;
const Utils::FilePath filePath = editor->textDocument()->filePath();
- if (const auto processor = ClangEditorDocumentProcessor::get(filePath.toString()))
+ if (const auto processor = ClangEditorDocumentProcessor::get(filePath))
client->updateParserConfig(filePath, processor->parserConfig());
}
}
@@ -395,7 +395,7 @@ void ClangModelManagerSupport::onCurrentEditorChanged(Core::IEditor *editor)
return;
const ::Utils::FilePath filePath = editor->document()->filePath();
- if (auto processor = ClangEditorDocumentProcessor::get(filePath.toString())) {
+ if (auto processor = ClangEditorDocumentProcessor::get(filePath)) {
processor->semanticRehighlight();
if (const auto client = clientForFile(filePath)) {
client->updateParserConfig(filePath, processor->parserConfig());
@@ -806,7 +806,7 @@ void ClangModelManagerSupport::onTextMarkContextMenuRequested(TextEditor::TextEd
QTC_ASSERT(lineNumber >= 1, return);
QTC_ASSERT(menu, return);
- const auto filePath = widget->textDocument()->filePath().toString();
+ const Utils::FilePath filePath = widget->textDocument()->filePath();
ClangEditorDocumentProcessor *processor = ClangEditorDocumentProcessor::get(filePath);
if (processor) {
const auto assistInterface = createAssistInterface(widget, lineNumber);
diff --git a/src/plugins/clangcodemodel/clangtextmark.cpp b/src/plugins/clangcodemodel/clangtextmark.cpp
index e5ef9f4d81..d29fef2392 100644
--- a/src/plugins/clangcodemodel/clangtextmark.cpp
+++ b/src/plugins/clangcodemodel/clangtextmark.cpp
@@ -43,7 +43,7 @@ namespace {
Project *projectForCurrentEditor()
{
- const QString filePath = currentCppEditorDocumentFilePath();
+ const FilePath filePath = currentCppEditorDocumentFilePath();
if (filePath.isEmpty())
return nullptr;
diff --git a/src/plugins/clangcodemodel/clangutils.cpp b/src/plugins/clangcodemodel/clangutils.cpp
index 0780b1cae3..1677d148a7 100644
--- a/src/plugins/clangcodemodel/clangutils.cpp
+++ b/src/plugins/clangcodemodel/clangutils.cpp
@@ -40,7 +40,7 @@ using namespace Utils;
namespace ClangCodeModel {
namespace Internal {
-ProjectPart::ConstPtr projectPartForFile(const QString &filePath)
+ProjectPart::ConstPtr projectPartForFile(const FilePath &filePath)
{
if (const auto parser = CppEditor::BaseEditorDocumentParser::get(filePath))
return parser->projectPartInfo().projectPart;
@@ -197,15 +197,14 @@ GenerateCompilationDbResult generateCompilationDB(QList<ProjectInfo::ConstPtr> p
return GenerateCompilationDbResult(compileCommandsFile.fileName(), QString());
}
-QString currentCppEditorDocumentFilePath()
+FilePath currentCppEditorDocumentFilePath()
{
- QString filePath;
+ FilePath filePath;
const auto currentEditor = Core::EditorManager::currentEditor();
if (currentEditor && CppEditor::CppModelManager::isCppEditor(currentEditor)) {
- const auto currentDocument = currentEditor->document();
- if (currentDocument)
- filePath = currentDocument->filePath().toString();
+ if (const auto currentDocument = currentEditor->document())
+ filePath = currentDocument->filePath();
}
return filePath;
diff --git a/src/plugins/clangcodemodel/clangutils.h b/src/plugins/clangcodemodel/clangutils.h
index 5d75821e62..f1ccd53029 100644
--- a/src/plugins/clangcodemodel/clangutils.h
+++ b/src/plugins/clangcodemodel/clangutils.h
@@ -47,9 +47,9 @@ QJsonArray clangOptionsForFile(const CppEditor::ProjectFile &file,
const QJsonArray &generalOptions,
CppEditor::UsePrecompiledHeaders usePch, bool clStyle);
-CppEditor::ProjectPart::ConstPtr projectPartForFile(const QString &filePath);
+CppEditor::ProjectPart::ConstPtr projectPartForFile(const Utils::FilePath &filePath);
-QString currentCppEditorDocumentFilePath();
+Utils::FilePath currentCppEditorDocumentFilePath();
QString diagnosticCategoryPrefixRemoved(const QString &text);
diff --git a/src/plugins/clangcodemodel/test/clangbatchfileprocessor.cpp b/src/plugins/clangcodemodel/test/clangbatchfileprocessor.cpp
index 34c47ec569..67b25f333c 100644
--- a/src/plugins/clangcodemodel/test/clangbatchfileprocessor.cpp
+++ b/src/plugins/clangcodemodel/test/clangbatchfileprocessor.cpp
@@ -243,13 +243,13 @@ public:
static Command::Ptr parse(BatchFileLineTokenizer &arguments, const CommandContext &context);
private:
- QString m_documentFilePath;
+ Utils::FilePath m_documentFilePath;
};
OpenDocumentCommand::OpenDocumentCommand(const CommandContext &context,
const QString &documentFilePath)
: Command(context)
- , m_documentFilePath(documentFilePath)
+ , m_documentFilePath(Utils::FilePath::fromString(documentFilePath))
{
}
@@ -298,8 +298,7 @@ bool OpenDocumentCommand::run()
{
qCDebug(debug) << "line" << context().lineNumber << "OpenDocumentCommand" << m_documentFilePath;
- const bool openEditorSucceeded = Core::EditorManager::openEditor(
- Utils::FilePath::fromString(m_documentFilePath));
+ const bool openEditorSucceeded = Core::EditorManager::openEditor(m_documentFilePath);
QTC_ASSERT(openEditorSucceeded, return false);
auto *processor = ClangEditorDocumentProcessor::get(m_documentFilePath);
@@ -393,8 +392,8 @@ bool InsertTextCommand::run()
TextEditor::BaseTextEditor *editor = currentTextEditor();
QTC_ASSERT(editor, return false);
- const QString documentFilePath = editor->document()->filePath().toString();
- auto *processor = ClangEditorDocumentProcessor::get(documentFilePath);
+ const Utils::FilePath documentFilePath = editor->document()->filePath();
+ auto processor = ClangEditorDocumentProcessor::get(documentFilePath);
QTC_ASSERT(processor, return false);
editor->insert(m_textToInsert);