forked from qt-creator/qt-creator
CppEditor: Re-use Symbol::filePath()
Change-Id: Ic958fc0b8916c1afe8b955b140a5cf76e971623d Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org> Reviewed-by: Christian Kandeler <christian.kandeler@qt.io> Reviewed-by: <github-actions-qt-creator@cristianadam.eu>
This commit is contained in:
@@ -329,9 +329,8 @@ static void find_helper(QFutureInterface<CPlusPlus::Usage> &future,
|
|||||||
|
|
||||||
const CPlusPlus::Snapshot snapshot = context.snapshot();
|
const CPlusPlus::Snapshot snapshot = context.snapshot();
|
||||||
|
|
||||||
const Utils::FilePath sourceFile = Utils::FilePath::fromUtf8(symbol->fileName(),
|
const FilePath sourceFile = symbol->filePath();
|
||||||
symbol->fileNameLength());
|
FilePaths files{sourceFile};
|
||||||
Utils::FilePaths files{sourceFile};
|
|
||||||
|
|
||||||
if (symbol->asClass()
|
if (symbol->asClass()
|
||||||
|| symbol->asForwardClassDeclaration()
|
|| symbol->asForwardClassDeclaration()
|
||||||
|
@@ -6,6 +6,7 @@
|
|||||||
#include <cplusplus/FindUsages.h>
|
#include <cplusplus/FindUsages.h>
|
||||||
|
|
||||||
using namespace CPlusPlus;
|
using namespace CPlusPlus;
|
||||||
|
using namespace Utils;
|
||||||
|
|
||||||
namespace CppEditor::Internal {
|
namespace CppEditor::Internal {
|
||||||
namespace {
|
namespace {
|
||||||
@@ -162,14 +163,13 @@ LookupItem TypeHierarchyBuilder::followTypedef(const LookupContext &context, con
|
|||||||
return matchingItem;
|
return matchingItem;
|
||||||
}
|
}
|
||||||
|
|
||||||
static Utils::FilePaths filesDependingOn(const Snapshot &snapshot,
|
static FilePaths filesDependingOn(const Snapshot &snapshot, Symbol *symbol)
|
||||||
Symbol *symbol)
|
|
||||||
{
|
{
|
||||||
if (!symbol)
|
if (!symbol)
|
||||||
return Utils::FilePaths();
|
return {};
|
||||||
|
|
||||||
const Utils::FilePath file = Utils::FilePath::fromUtf8(symbol->fileName(), symbol->fileNameLength());
|
const FilePath file = symbol->filePath();
|
||||||
return Utils::FilePaths { file } + snapshot.filesDependingOn(file);
|
return FilePaths{file} + snapshot.filesDependingOn(file);
|
||||||
}
|
}
|
||||||
|
|
||||||
void TypeHierarchyBuilder::buildDerived(QFutureInterfaceBase &futureInterface,
|
void TypeHierarchyBuilder::buildDerived(QFutureInterfaceBase &futureInterface,
|
||||||
@@ -187,12 +187,12 @@ void TypeHierarchyBuilder::buildDerived(QFutureInterfaceBase &futureInterface,
|
|||||||
const QString &symbolName = _overview.prettyName(LookupContext::fullyQualifiedName(symbol));
|
const QString &symbolName = _overview.prettyName(LookupContext::fullyQualifiedName(symbol));
|
||||||
DerivedHierarchyVisitor visitor(symbolName, cache);
|
DerivedHierarchyVisitor visitor(symbolName, cache);
|
||||||
|
|
||||||
const Utils::FilePaths &dependingFiles = filesDependingOn(snapshot, symbol);
|
const FilePaths dependingFiles = filesDependingOn(snapshot, symbol);
|
||||||
if (depth == 0)
|
if (depth == 0)
|
||||||
futureInterface.setProgressRange(0, dependingFiles.size());
|
futureInterface.setProgressRange(0, dependingFiles.size());
|
||||||
|
|
||||||
int i = -1;
|
int i = -1;
|
||||||
for (const Utils::FilePath &fileName : dependingFiles) {
|
for (const FilePath &fileName : dependingFiles) {
|
||||||
if (futureInterface.isCanceled())
|
if (futureInterface.isCanceled())
|
||||||
return;
|
return;
|
||||||
if (depth == 0)
|
if (depth == 0)
|
||||||
|
Reference in New Issue
Block a user