CPlusPlus: Use FilePath for resolved include paths

... and fix fallout.

Change-Id: I66886e91ff476eff15db51cc024a8021e952d44d
Reviewed-by: Christian Kandeler <christian.kandeler@qt.io>
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
This commit is contained in:
hjk
2022-11-24 13:05:41 +01:00
parent dc3a4f0002
commit 39ffdb416f
25 changed files with 136 additions and 124 deletions

View File

@@ -299,11 +299,11 @@ void Document::setLastModified(const QDateTime &lastModified)
FilePaths Document::includedFiles() const FilePaths Document::includedFiles() const
{ {
QStringList files; FilePaths files;
for (const Include &i : std::as_const(_resolvedIncludes)) for (const Include &i : std::as_const(_resolvedIncludes))
files.append(i.resolvedFileName()); files.append(i.resolvedFileName());
files.removeDuplicates(); FilePath::removeDuplicates(files);
return transform(files, &FilePath::fromString); return files;
} }
// This assumes to be called with a QDir::cleanPath cleaned fileName. // This assumes to be called with a QDir::cleanPath cleaned fileName.
@@ -786,13 +786,13 @@ QSet<FilePath> Snapshot::allIncludesForDocument(const FilePath &filePath) const
} }
QList<Snapshot::IncludeLocation> Snapshot::includeLocationsOfDocument( QList<Snapshot::IncludeLocation> Snapshot::includeLocationsOfDocument(
const QString &fileNameOrPath) const const FilePath &fileNameOrPath) const
{ {
const bool matchFullPath = FilePath::fromString(fileNameOrPath).isAbsolutePath(); const bool matchFullPath = fileNameOrPath.isAbsolutePath();
const auto isMatch = [&](const Document::Include &include) { const auto isMatch = [&](const Document::Include &include) {
if (matchFullPath) if (matchFullPath)
return include.resolvedFileName() == fileNameOrPath; return include.resolvedFileName() == fileNameOrPath;
return FilePath::fromString(include.resolvedFileName()).fileName() == fileNameOrPath; return include.resolvedFileName().fileName() == fileNameOrPath.fileName();
}; };
QList<IncludeLocation> result; QList<IncludeLocation> result;
for (const_iterator cit = begin(), citEnd = end(); cit != citEnd; ++cit) { for (const_iterator cit = begin(), citEnd = end(); cit != citEnd; ++cit) {
@@ -807,7 +807,7 @@ QList<Snapshot::IncludeLocation> Snapshot::includeLocationsOfDocument(
} }
if (!matchFullPath && !foundMatch) { if (!matchFullPath && !foundMatch) {
for (const auto &includeFile : cit.value()->unresolvedIncludes()) { for (const auto &includeFile : cit.value()->unresolvedIncludes()) {
if (includeFile.unresolvedFileName() == fileNameOrPath) if (includeFile.unresolvedFileName() == fileNameOrPath.path())
result.push_back({doc, includeFile.line()}); result.push_back({doc, includeFile.line()});
} }
} }

View File

@@ -218,13 +218,13 @@ public:
}; };
class Include { class Include {
QString _resolvedFileName; Utils::FilePath _resolvedFileName;
QString _unresolvedFileName; QString _unresolvedFileName;
int _line; int _line;
Client::IncludeType _type; Client::IncludeType _type;
public: public:
Include(const QString &unresolvedFileName, const QString &resolvedFileName, int line, Include(const QString &unresolvedFileName, const Utils::FilePath &resolvedFileName, int line,
Client::IncludeType type) Client::IncludeType type)
: _resolvedFileName(resolvedFileName) : _resolvedFileName(resolvedFileName)
, _unresolvedFileName(unresolvedFileName) , _unresolvedFileName(unresolvedFileName)
@@ -232,7 +232,7 @@ public:
, _type(type) , _type(type)
{ } { }
const QString &resolvedFileName() const const Utils::FilePath &resolvedFileName() const
{ return _resolvedFileName; } { return _resolvedFileName; }
const QString &unresolvedFileName() const const QString &unresolvedFileName() const
@@ -404,7 +404,7 @@ public:
QSet<Utils::FilePath> allIncludesForDocument(const Utils::FilePath &filePath) const; QSet<Utils::FilePath> allIncludesForDocument(const Utils::FilePath &filePath) const;
QList<IncludeLocation> includeLocationsOfDocument(const QString &fileNameOrPath) const; QList<IncludeLocation> includeLocationsOfDocument(const Utils::FilePath &fileNameOrPath) const;
Utils::FilePaths filesDependingOn(const Utils::FilePath &filePath) const; Utils::FilePaths filesDependingOn(const Utils::FilePath &filePath) const;

View File

@@ -29,11 +29,11 @@ QByteArray FastPreprocessor::run(Document::Ptr newDoc,
_preproc.setKeepComments(true); _preproc.setKeepComments(true);
if (Document::Ptr doc = _snapshot.document(filePath)) { if (Document::Ptr doc = _snapshot.document(filePath)) {
_merged.insert(filePath.toString()); _merged.insert(filePath);
for (Snapshot::const_iterator i = _snapshot.begin(), ei = _snapshot.end(); i != ei; ++i) { for (Snapshot::const_iterator i = _snapshot.begin(), ei = _snapshot.end(); i != ei; ++i) {
if (isInjectedFile(i.key().toString())) if (isInjectedFile(i.key().toString()))
mergeEnvironment(i.key().toString()); mergeEnvironment(i.key());
} }
const QList<Document::Include> includes = doc->resolvedIncludes(); const QList<Document::Include> includes = doc->resolvedIncludes();
@@ -55,20 +55,21 @@ void FastPreprocessor::sourceNeeded(int line, const QString &fileName, IncludeTy
{ {
Q_UNUSED(initialIncludes) Q_UNUSED(initialIncludes)
Q_ASSERT(_currentDoc); Q_ASSERT(_currentDoc);
FilePath filePath = FilePath::fromString(fileName);
if (_addIncludesToCurrentDoc) { if (_addIncludesToCurrentDoc) {
// CHECKME: Is that cleanName needed? // CHECKME: Is that cleanPath needed?
const QString cleanName = QDir::cleanPath(fileName); const FilePath cleanPath = filePath.cleanPath();
_currentDoc->addIncludeFile(Document::Include(fileName, cleanName, line, mode)); _currentDoc->addIncludeFile(Document::Include(fileName, cleanPath, line, mode));
} }
mergeEnvironment(fileName); mergeEnvironment(filePath);
} }
void FastPreprocessor::mergeEnvironment(const QString &fileName) void FastPreprocessor::mergeEnvironment(const FilePath &filePath)
{ {
if (! _merged.contains(fileName)) { if (! _merged.contains(filePath)) {
_merged.insert(fileName); _merged.insert(filePath);
if (Document::Ptr doc = _snapshot.document(fileName)) { if (Document::Ptr doc = _snapshot.document(filePath)) {
const QList<Document::Include> includes = doc->resolvedIncludes(); const QList<Document::Include> includes = doc->resolvedIncludes();
for (const Document::Include &i : includes) for (const Document::Include &i : includes)
mergeEnvironment(i.resolvedFileName()); mergeEnvironment(i.resolvedFileName());

View File

@@ -3,12 +3,15 @@
#pragma once #pragma once
#include "PreprocessorClient.h"
#include "CppDocument.h" #include "CppDocument.h"
#include "pp.h" #include "PreprocessorClient.h"
#include "PreprocessorEnvironment.h"
#include "pp-engine.h"
#include <cplusplus/Control.h> #include <cplusplus/Control.h>
#include <utils/filepath.h>
#include <QSet> #include <QSet>
#include <QString> #include <QString>
@@ -19,11 +22,11 @@ class CPLUSPLUS_EXPORT FastPreprocessor: public Client
Environment _env; Environment _env;
Snapshot _snapshot; Snapshot _snapshot;
Preprocessor _preproc; Preprocessor _preproc;
QSet<QString> _merged; QSet<Utils::FilePath> _merged;
Document::Ptr _currentDoc; Document::Ptr _currentDoc;
bool _addIncludesToCurrentDoc; bool _addIncludesToCurrentDoc;
void mergeEnvironment(const QString &fileName); void mergeEnvironment(const Utils::FilePath &filePath);
public: public:
FastPreprocessor(const Snapshot &snapshot); FastPreprocessor(const Snapshot &snapshot);

View File

@@ -55,7 +55,7 @@ static bool includesBoostTest(const CPlusPlus::Document::Ptr &doc,
{ {
static const QRegularExpression boostTestHpp("^.*/boost/test/.*\\.hpp$"); static const QRegularExpression boostTestHpp("^.*/boost/test/.*\\.hpp$");
for (const CPlusPlus::Document::Include &inc : doc->resolvedIncludes()) { for (const CPlusPlus::Document::Include &inc : doc->resolvedIncludes()) {
if (boostTestHpp.match(inc.resolvedFileName()).hasMatch()) if (boostTestHpp.match(inc.resolvedFileName().path()).hasMatch())
return true; return true;
} }

View File

@@ -388,7 +388,7 @@ void CodegenTest::testDefinitionFirstMember()
Document::Ptr sourceDocument = createDocumentAndFile(&temporaryDir, "file.cpp", sourceText, 3); Document::Ptr sourceDocument = createDocumentAndFile(&temporaryDir, "file.cpp", sourceText, 3);
QVERIFY(sourceDocument); QVERIFY(sourceDocument);
sourceDocument->addIncludeFile(Document::Include(QLatin1String("file.h"), sourceDocument->addIncludeFile(Document::Include(QLatin1String("file.h"),
headerDocument->filePath().toString(), 1, headerDocument->filePath(), 1,
Client::IncludeLocal)); Client::IncludeLocal));
Snapshot snapshot; Snapshot snapshot;
@@ -447,7 +447,7 @@ void CodegenTest::testDefinitionLastMember()
Document::Ptr sourceDocument = createDocumentAndFile(&temporaryDir, "file.cpp", sourceText, 3); Document::Ptr sourceDocument = createDocumentAndFile(&temporaryDir, "file.cpp", sourceText, 3);
QVERIFY(sourceDocument); QVERIFY(sourceDocument);
sourceDocument->addIncludeFile(Document::Include(QLatin1String("file.h"), sourceDocument->addIncludeFile(Document::Include(QLatin1String("file.h"),
headerDocument->filePath().toString(), 1, headerDocument->filePath(), 1,
Client::IncludeLocal)); Client::IncludeLocal));
Snapshot snapshot; Snapshot snapshot;
@@ -513,7 +513,7 @@ void CodegenTest::testDefinitionMiddleMember()
Document::Ptr sourceDocument = createDocumentAndFile(&temporaryDir, "file.cpp", sourceText, 4); Document::Ptr sourceDocument = createDocumentAndFile(&temporaryDir, "file.cpp", sourceText, 4);
QVERIFY(sourceDocument); QVERIFY(sourceDocument);
sourceDocument->addIncludeFile(Document::Include(QLatin1String("file.h"), sourceDocument->addIncludeFile(Document::Include(QLatin1String("file.h"),
headerDocument->filePath().toString(), 1, headerDocument->filePath(), 1,
Client::IncludeLocal)); Client::IncludeLocal));
Snapshot snapshot; Snapshot snapshot;
@@ -573,7 +573,7 @@ void CodegenTest::testDefinitionMiddleMemberSurroundedByUndefined()
Document::Ptr sourceDocument = createDocumentAndFile(&temporaryDir, "file.cpp", sourceText, 3); Document::Ptr sourceDocument = createDocumentAndFile(&temporaryDir, "file.cpp", sourceText, 3);
QVERIFY(sourceDocument); QVERIFY(sourceDocument);
sourceDocument->addIncludeFile(Document::Include(QLatin1String("file.h"), sourceDocument->addIncludeFile(Document::Include(QLatin1String("file.h"),
headerDocument->filePath().toString(), 1, headerDocument->filePath(), 1,
Client::IncludeLocal)); Client::IncludeLocal));
Snapshot snapshot; Snapshot snapshot;
@@ -636,7 +636,7 @@ void CodegenTest::testDefinitionMemberSpecificFile()
Document::Ptr sourceDocument = createDocumentAndFile(&temporaryDir, "file.cpp", sourceText, 3); Document::Ptr sourceDocument = createDocumentAndFile(&temporaryDir, "file.cpp", sourceText, 3);
QVERIFY(sourceDocument); QVERIFY(sourceDocument);
sourceDocument->addIncludeFile(Document::Include(QLatin1String("file.h"), sourceDocument->addIncludeFile(Document::Include(QLatin1String("file.h"),
headerDocument->filePath().toString(), 1, headerDocument->filePath(), 1,
Client::IncludeLocal)); Client::IncludeLocal));
Snapshot snapshot; Snapshot snapshot;

View File

@@ -588,7 +588,7 @@ QVariant IncludesModel::data(const QModelIndex &index, int role) const
static const QBrush redBrush(QColor(205, 38, 38)); static const QBrush redBrush(QColor(205, 38, 38));
const Document::Include include = m_includes.at(index.row()); const Document::Include include = m_includes.at(index.row());
const QString resolvedFileName = QDir::toNativeSeparators(include.resolvedFileName()); const FilePath resolvedFileName = include.resolvedFileName();
const bool isResolved = !resolvedFileName.isEmpty(); const bool isResolved = !resolvedFileName.isEmpty();
if (role == Qt::DisplayRole) { if (role == Qt::DisplayRole) {
@@ -599,7 +599,7 @@ QVariant IncludesModel::data(const QModelIndex &index, int role) const
return include.line(); return include.line();
} else if (column == FilePathsColumn) { } else if (column == FilePathsColumn) {
return QVariant(CMI::Utils::unresolvedFileNameWithDelimiters(include) return QVariant(CMI::Utils::unresolvedFileNameWithDelimiters(include)
+ QLatin1String(" --> ") + resolvedFileName); + QLatin1String(" --> ") + resolvedFileName.toUserOutput());
} }
} else if (role == Qt::ForegroundRole) { } else if (role == Qt::ForegroundRole) {
return isResolved ? greenBrush : redBrush; return isResolved ? greenBrush : redBrush;

View File

@@ -1479,8 +1479,8 @@ bool InternalCppCompletionAssistProcessor::globalCompletion(Scope *currentScope)
completeNamespace(b); completeNamespace(b);
addKeywords(); addKeywords();
addMacros(CppModelManager::configurationFileName().path(), context.snapshot()); addMacros(CppModelManager::configurationFileName(), context.snapshot());
addMacros(context.thisDocument()->filePath().toString(), context.snapshot()); addMacros(context.thisDocument()->filePath(), context.snapshot());
addSnippets(); addSnippets();
return !m_completions.isEmpty(); return !m_completions.isEmpty();
} }
@@ -1841,29 +1841,29 @@ void InternalCppCompletionAssistProcessor::addKeywords()
} }
} }
void InternalCppCompletionAssistProcessor::addMacros(const QString &fileName, void InternalCppCompletionAssistProcessor::addMacros(const Utils::FilePath &filePath,
const Snapshot &snapshot) const Snapshot &snapshot)
{ {
QSet<QString> processed; QSet<Utils::FilePath> processed;
QSet<QString> definedMacros; QSet<QString> definedMacros;
addMacros_helper(snapshot, fileName, &processed, &definedMacros); addMacros_helper(snapshot, filePath, &processed, &definedMacros);
for (const QString &macroName : std::as_const(definedMacros)) for (const QString &macroName : std::as_const(definedMacros))
addCompletionItem(macroName, Icons::macroIcon(), MacrosOrder); addCompletionItem(macroName, Icons::macroIcon(), MacrosOrder);
} }
void InternalCppCompletionAssistProcessor::addMacros_helper(const Snapshot &snapshot, void InternalCppCompletionAssistProcessor::addMacros_helper(const Snapshot &snapshot,
const QString &fileName, const Utils::FilePath &filePath,
QSet<QString> *processed, QSet<Utils::FilePath> *processed,
QSet<QString> *definedMacros) QSet<QString> *definedMacros)
{ {
Document::Ptr doc = snapshot.document(fileName); Document::Ptr doc = snapshot.document(filePath);
if (!doc || processed->contains(doc->filePath().path())) if (!doc || processed->contains(doc->filePath()))
return; return;
processed->insert(doc->filePath().path()); processed->insert(doc->filePath());
const QList<Document::Include> includes = doc->resolvedIncludes(); const QList<Document::Include> includes = doc->resolvedIncludes();
for (const Document::Include &i : includes) for (const Document::Include &i : includes)

View File

@@ -122,10 +122,10 @@ private:
void addCompletionItem(CPlusPlus::Symbol *symbol, void addCompletionItem(CPlusPlus::Symbol *symbol,
int order = 0); int order = 0);
void addKeywords(); void addKeywords();
void addMacros(const QString &fileName, const CPlusPlus::Snapshot &snapshot); void addMacros(const Utils::FilePath &filePath, const CPlusPlus::Snapshot &snapshot);
void addMacros_helper(const CPlusPlus::Snapshot &snapshot, void addMacros_helper(const CPlusPlus::Snapshot &snapshot,
const QString &fileName, const Utils::FilePath &filePath,
QSet<QString> *processed, QSet<Utils::FilePath> *processed,
QSet<QString> *definedMacros); QSet<QString> *definedMacros);
enum { enum {

View File

@@ -21,6 +21,7 @@
#include <QSet> #include <QSet>
using namespace CPlusPlus; using namespace CPlusPlus;
using namespace Utils;
namespace CppEditor::Internal { namespace CppEditor::Internal {
@@ -62,18 +63,18 @@ class CppInclude : public CppElement
{ {
public: public:
explicit CppInclude(const Document::Include &includeFile) explicit CppInclude(const Document::Include &includeFile)
: path(QDir::toNativeSeparators(includeFile.resolvedFileName())) : path(includeFile.resolvedFileName())
, fileName(Utils::FilePath::fromString(includeFile.resolvedFileName()).fileName()) , fileName(path.fileName())
{ {
helpCategory = Core::HelpItem::Brief; helpCategory = Core::HelpItem::Brief;
helpIdCandidates = QStringList(fileName); helpIdCandidates = QStringList(fileName);
helpMark = fileName; helpMark = fileName;
link = Utils::Link(Utils::FilePath::fromString(path)); link = Utils::Link(path);
tooltip = path; tooltip = path.toUserOutput();
} }
public: public:
QString path; Utils::FilePath path;
QString fileName; QString fileName;
}; };
@@ -95,7 +96,7 @@ public:
CppDeclarableElement::CppDeclarableElement(Symbol *declaration) CppDeclarableElement::CppDeclarableElement(Symbol *declaration)
: CppElement() : CppElement()
, declaration(declaration) , declaration(declaration)
, icon(Icons::iconForSymbol(declaration)) , icon(CPlusPlus::Icons::iconForSymbol(declaration))
{ {
Overview overview; Overview overview;
overview.showArgumentNames = true; overview.showArgumentNames = true;

View File

@@ -624,7 +624,7 @@ void FollowSymbolUnderCursor::findLink(
const QList<Document::Include> includes = doc->resolvedIncludes(); const QList<Document::Include> includes = doc->resolvedIncludes();
for (const Document::Include &incl : includes) { for (const Document::Include &incl : includes) {
if (incl.line() == lineno) { if (incl.line() == lineno) {
link.targetFilePath = Utils::FilePath::fromString(incl.resolvedFileName()); link.targetFilePath = incl.resolvedFileName();
link.linkTextStart = beginOfToken + 1; link.linkTextStart = beginOfToken + 1;
link.linkTextEnd = endOfToken - 1; link.linkTextEnd = endOfToken - 1;
processLinkCallback(link); processLinkCallback(link);

View File

@@ -58,24 +58,24 @@ static Snapshot globalSnapshot()
struct FileAndLine struct FileAndLine
{ {
FileAndLine() = default; FileAndLine() = default;
FileAndLine(const QString &f, int l) : file(f), line(l) {} FileAndLine(const FilePath &f, int l) : file(f), line(l) {}
QString file; FilePath file;
int line = 0; int line = 0;
}; };
using FileAndLines = QList<FileAndLine>; using FileAndLines = QList<FileAndLine>;
static FileAndLines findIncluders(const QString &filePath) static FileAndLines findIncluders(const FilePath &filePath)
{ {
FileAndLines result; FileAndLines result;
const Snapshot snapshot = globalSnapshot(); const Snapshot snapshot = globalSnapshot();
for (auto cit = snapshot.begin(), citEnd = snapshot.end(); cit != citEnd; ++cit) { for (auto cit = snapshot.begin(), citEnd = snapshot.end(); cit != citEnd; ++cit) {
const QString filePathFromSnapshot = cit.key().toString(); const FilePath filePathFromSnapshot = cit.key();
Document::Ptr doc = cit.value(); Document::Ptr doc = cit.value();
const QList<Document::Include> resolvedIncludes = doc->resolvedIncludes(); const QList<Document::Include> resolvedIncludes = doc->resolvedIncludes();
for (const auto &includeFile : resolvedIncludes) { for (const auto &includeFile : resolvedIncludes) {
const QString includedFilePath = includeFile.resolvedFileName(); const FilePath includedFilePath = includeFile.resolvedFileName();
if (includedFilePath == filePath) if (includedFilePath == filePath)
result.append(FileAndLine(filePathFromSnapshot, int(includeFile.line()))); result.append(FileAndLine(filePathFromSnapshot, int(includeFile.line())));
} }
@@ -83,7 +83,7 @@ static FileAndLines findIncluders(const QString &filePath)
return result; return result;
} }
static FileAndLines findIncludes(const QString &filePath, const Snapshot &snapshot) static FileAndLines findIncludes(const FilePath &filePath, const Snapshot &snapshot)
{ {
FileAndLines result; FileAndLines result;
if (Document::Ptr doc = snapshot.document(filePath)) { if (Document::Ptr doc = snapshot.document(filePath)) {
@@ -101,11 +101,11 @@ public:
enum SubTree { RootItem, InIncludes, InIncludedBy }; enum SubTree { RootItem, InIncludes, InIncludedBy };
CppIncludeHierarchyItem() = default; CppIncludeHierarchyItem() = default;
void createChild(const QString &filePath, SubTree subTree, void createChild(const FilePath &filePath, SubTree subTree,
int line = 0, bool definitelyNoChildren = false) int line = 0, bool definitelyNoChildren = false)
{ {
auto item = new CppIncludeHierarchyItem; auto item = new CppIncludeHierarchyItem;
item->m_fileName = filePath.mid(filePath.lastIndexOf('/') + 1); item->m_fileName = filePath.fileName();
item->m_filePath = filePath; item->m_filePath = filePath;
item->m_line = line; item->m_line = line;
item->m_subTree = subTree; item->m_subTree = subTree;
@@ -120,7 +120,7 @@ public:
item->setChildrenChecked(); item->setChildrenChecked();
} }
QString filePath() const FilePath filePath() const
{ {
return isPhony() ? model()->editorFilePath() : m_filePath; return isPhony() ? model()->editorFilePath() : m_filePath;
} }
@@ -138,7 +138,7 @@ private:
Qt::ItemFlags flags(int) const override Qt::ItemFlags flags(int) const override
{ {
const Utils::Link link(Utils::FilePath::fromString(m_filePath), m_line); const Utils::Link link(m_filePath, m_line);
if (link.hasValidTarget()) if (link.hasValidTarget())
return Qt::ItemIsDragEnabled | Qt::ItemIsEnabled | Qt::ItemIsSelectable; return Qt::ItemIsDragEnabled | Qt::ItemIsEnabled | Qt::ItemIsSelectable;
return Qt::ItemIsEnabled | Qt::ItemIsSelectable; return Qt::ItemIsEnabled | Qt::ItemIsSelectable;
@@ -148,7 +148,7 @@ private:
void fetchMore() override; void fetchMore() override;
QString m_fileName; QString m_fileName;
QString m_filePath; FilePath m_filePath;
int m_line = 0; int m_line = 0;
SubTree m_subTree = RootItem; SubTree m_subTree = RootItem;
bool m_isCyclic = false; bool m_isCyclic = false;
@@ -171,11 +171,11 @@ QVariant CppIncludeHierarchyItem::data(int column, int role) const
switch (role) { switch (role) {
case Qt::ToolTipRole: case Qt::ToolTipRole:
return m_filePath; return m_filePath.displayName();
case Qt::DecorationRole: case Qt::DecorationRole:
return FileIconProvider::icon(FilePath::fromString(m_filePath)); return FileIconProvider::icon(m_filePath);
case LinkRole: case LinkRole:
return QVariant::fromValue(Link(FilePath::fromString(m_filePath), m_line)); return QVariant::fromValue(Link(m_filePath, m_line));
} }
return QVariant(); return QVariant();
@@ -197,7 +197,7 @@ void CppIncludeHierarchyItem::fetchMore()
model()->m_seen.insert(m_filePath); model()->m_seen.insert(m_filePath);
const FilePath editorFilePath = FilePath::fromString(model()->editorFilePath()); const FilePath editorFilePath = model()->editorFilePath();
setChildrenChecked(); setChildrenChecked();
if (m_subTree == InIncludes) { if (m_subTree == InIncludes) {
@@ -220,12 +220,14 @@ void CppIncludeHierarchyItem::fetchMore()
} }
} }
void CppIncludeHierarchyModel::buildHierarchy(const QString &document) void CppIncludeHierarchyModel::buildHierarchy(const FilePath &document)
{ {
m_editorFilePath = document; m_editorFilePath = document;
rootItem()->removeChildren(); rootItem()->removeChildren();
rootItem()->createChild(tr("Includes"), CppIncludeHierarchyItem::InIncludes); rootItem()->createChild(FilePath::fromPathPart(tr("Includes")),
rootItem()->createChild(tr("Included by"), CppIncludeHierarchyItem::InIncludedBy); CppIncludeHierarchyItem::InIncludes);
rootItem()->createChild(FilePath::fromPathPart(tr("Included by")),
CppIncludeHierarchyItem::InIncludedBy);
} }
void CppIncludeHierarchyModel::setSearching(bool on) void CppIncludeHierarchyModel::setSearching(bool on)
@@ -411,7 +413,7 @@ void CppIncludeHierarchyWidget::perform()
return; return;
const Utils::FilePath documentPath = m_editor->textDocument()->filePath(); const Utils::FilePath documentPath = m_editor->textDocument()->filePath();
m_model.buildHierarchy(documentPath.toString()); m_model.buildHierarchy(documentPath);
m_inspectedFile->setText(m_editor->textDocument()->displayName()); m_inspectedFile->setText(m_editor->textDocument()->displayName());
m_inspectedFile->setLink(Utils::Link(documentPath)); m_inspectedFile->setLink(Utils::Link(documentPath));

View File

@@ -25,8 +25,8 @@ public:
QStringList mimeTypes() const override; QStringList mimeTypes() const override;
QMimeData *mimeData(const QModelIndexList &indexes) const override; QMimeData *mimeData(const QModelIndexList &indexes) const override;
void buildHierarchy(const QString &filePath); void buildHierarchy(const Utils::FilePath &filePath);
QString editorFilePath() const { return m_editorFilePath; } const Utils::FilePath &editorFilePath() const { return m_editorFilePath; }
void setSearching(bool on); void setSearching(bool on);
QString toString() const; QString toString() const;
@@ -37,8 +37,8 @@ public:
private: private:
friend class CppIncludeHierarchyItem; friend class CppIncludeHierarchyItem;
QString m_editorFilePath; Utils::FilePath m_editorFilePath;
QSet<QString> m_seen; QSet<Utils::FilePath> m_seen;
bool m_searching = false; bool m_searching = false;
}; };

View File

@@ -82,7 +82,7 @@ public:
// Test model // Test model
CppIncludeHierarchyModel model; CppIncludeHierarchyModel model;
model.buildHierarchy(editor->document()->filePath().toString()); model.buildHierarchy(editor->document()->filePath());
const QString actualHierarchy = toString(model); const QString actualHierarchy = toString(model);
QCOMPARE(actualHierarchy, expectedHierarchy); QCOMPARE(actualHierarchy, expectedHierarchy);
} }

View File

@@ -1794,7 +1794,7 @@ void CppModelManager::renameIncludes(const Utils::FilePath &oldFilePath,
return; return;
const QList<Snapshot::IncludeLocation> locations = snapshot().includeLocationsOfDocument( const QList<Snapshot::IncludeLocation> locations = snapshot().includeLocationsOfDocument(
isUiFile ? oldFileName : oldFilePath.toString()); isUiFile ? FilePath::fromString(oldFileName) : oldFilePath);
for (const Snapshot::IncludeLocation &loc : locations) { for (const Snapshot::IncludeLocation &loc : locations) {
const FilePath filePath = loc.first->filePath(); const FilePath filePath = loc.first->filePath();

View File

@@ -8031,7 +8031,7 @@ private:
Node &node = includeGraph[filePath]; Node &node = includeGraph[filePath];
node.document = doc; node.document = doc;
for (const Document::Include &include : doc->resolvedIncludes()) { for (const Document::Include &include : doc->resolvedIncludes()) {
const auto filePath = FilePath::fromString(include.resolvedFileName()); const FilePath filePath = include.resolvedFileName();
if (shouldHandle(filePath)) { if (shouldHandle(filePath)) {
Node &includedNode = includeGraph[filePath]; Node &includedNode = includeGraph[filePath];
includedNode.includedBy.push_back(node); includedNode.includedBy.push_back(node);
@@ -8105,7 +8105,7 @@ private:
refactoring.snapshot(), refactoring.snapshot(),
currentFile->endOf(m_usingDirective), currentFile->endOf(m_usingDirective),
true)) { true)) {
processIncludes(refactoring, filePath().toString()); processIncludes(refactoring, filePath());
} }
for (auto &file : std::as_const(m_changes)) for (auto &file : std::as_const(m_changes))
@@ -8143,10 +8143,10 @@ private:
return visitor.isGlobalUsingNamespace() && !visitor.foundGlobalUsingNamespace(); return visitor.isGlobalUsingNamespace() && !visitor.foundGlobalUsingNamespace();
} }
void processIncludes(CppRefactoringChanges &refactoring, const QString &fileName) void processIncludes(CppRefactoringChanges &refactoring, const FilePath &filePath)
{ {
QList<Snapshot::IncludeLocation> QList<Snapshot::IncludeLocation>
includeLocationsOfDocument = refactoring.snapshot().includeLocationsOfDocument(fileName); includeLocationsOfDocument = refactoring.snapshot().includeLocationsOfDocument(filePath);
for (Snapshot::IncludeLocation &loc : includeLocationsOfDocument) { for (Snapshot::IncludeLocation &loc : includeLocationsOfDocument) {
if (m_processed.contains(loc.first)) if (m_processed.contains(loc.first))
continue; continue;
@@ -8157,7 +8157,7 @@ private:
file->position(loc.second, 1)); file->position(loc.second, 1));
m_processed.insert(loc.first); m_processed.insert(loc.first);
if (noGlobalUsing) if (noGlobalUsing)
processIncludes(refactoring, loc.first->filePath().toString()); processIncludes(refactoring, loc.first->filePath());
} }
} }

View File

@@ -3,8 +3,12 @@
#include "cppsourceprocessertesthelper.h" #include "cppsourceprocessertesthelper.h"
#include <utils/filepath.h>
#include <QDir> #include <QDir>
using namespace Utils;
namespace CppEditor::Tests::Internal { namespace CppEditor::Tests::Internal {
QString TestIncludePaths::includeBaseDirectory() QString TestIncludePaths::includeBaseDirectory()
@@ -28,9 +32,9 @@ QString TestIncludePaths::directoryOfTestFile()
return QDir::cleanPath(includeBaseDirectory() + QLatin1String("/local")); return QDir::cleanPath(includeBaseDirectory() + QLatin1String("/local"));
} }
QString TestIncludePaths::testFilePath(const QString &fileName) FilePath TestIncludePaths::testFilePath(const QString &fileName)
{ {
return directoryOfTestFile() + QLatin1Char('/') + fileName; return FilePath::fromString(directoryOfTestFile()) / fileName;
} }
} // namespace CppEditor::Tests::Internal } // CppEditor::Tests::Internal

View File

@@ -6,6 +6,8 @@
#include <QtGlobal> #include <QtGlobal>
#include <QString> #include <QString>
namespace Utils { class FilePath; }
namespace CppEditor::Tests::Internal { namespace CppEditor::Tests::Internal {
class TestIncludePaths class TestIncludePaths
@@ -17,7 +19,7 @@ public:
static QString globalQtCoreIncludePath(); static QString globalQtCoreIncludePath();
static QString globalIncludePath(); static QString globalIncludePath();
static QString directoryOfTestFile(); static QString directoryOfTestFile();
static QString testFilePath(const QString &fileName = QLatin1String("file.cpp")); static Utils::FilePath testFilePath(const QString &fileName = QLatin1String("file.cpp"));
}; };
} // namespace CppEditor::Tests::Internal } // CppEditor::Tests::Internal

View File

@@ -383,12 +383,12 @@ void CppSourceProcessor::mergeEnvironment(Document::Ptr doc)
const QList<Document::Include> includes = doc->resolvedIncludes(); const QList<Document::Include> includes = doc->resolvedIncludes();
for (const Document::Include &incl : includes) { for (const Document::Include &incl : includes) {
const QString includedFile = incl.resolvedFileName(); const FilePath includedFile = incl.resolvedFileName();
if (Document::Ptr includedDoc = m_snapshot.document(includedFile)) if (Document::Ptr includedDoc = m_snapshot.document(includedFile))
mergeEnvironment(includedDoc); mergeEnvironment(includedDoc);
else if (!m_included.contains(FilePath::fromString(includedFile))) else if (!m_included.contains(includedFile))
run(includedFile); run(includedFile.toString());
} }
m_env.addMacros(doc->definedMacros()); m_env.addMacros(doc->definedMacros());
@@ -416,7 +416,7 @@ void CppSourceProcessor::sourceNeeded(int line, const QString &fileName, Include
const FilePath absoluteFilePath = FilePath::fromString(absoluteFileName); const FilePath absoluteFilePath = FilePath::fromString(absoluteFileName);
if (m_currentDoc) { if (m_currentDoc) {
m_currentDoc->addIncludeFile(Document::Include(fileName, absoluteFileName, line, type)); m_currentDoc->addIncludeFile(Document::Include(fileName, absoluteFilePath, line, type));
if (absoluteFileName.isEmpty()) { if (absoluteFileName.isEmpty()) {
m_currentDoc->addDiagnosticMessage(messageNoSuchFile(m_currentDoc, fileName, line)); m_currentDoc->addDiagnosticMessage(messageNoSuchFile(m_currentDoc, fileName, line));
return; return;
@@ -453,7 +453,7 @@ void CppSourceProcessor::sourceNeeded(int line, const QString &fileName, Include
document->setLanguageFeatures(m_languageFeatures); document->setLanguageFeatures(m_languageFeatures);
for (const QString &include : initialIncludes) { for (const QString &include : initialIncludes) {
m_included.insert(FilePath::fromString(include)); m_included.insert(FilePath::fromString(include));
Document::Include inc(include, include, 0, IncludeLocal); Document::Include inc(include, FilePath::fromString(include), 0, IncludeLocal);
document->addIncludeFile(inc); document->addIncludeFile(inc);
} }
if (info.exists()) if (info.exists())

View File

@@ -39,15 +39,15 @@ public:
cleanUp(); cleanUp();
} }
Document::Ptr run(const QString &filePath) const Document::Ptr run(const FilePath &filePath) const
{ {
QScopedPointer<CppSourceProcessor> sourceProcessor( QScopedPointer<CppSourceProcessor> sourceProcessor(
CppModelManager::createSourceProcessor()); CppModelManager::createSourceProcessor());
sourceProcessor->setHeaderPaths({ProjectExplorer::HeaderPath::makeUser( sourceProcessor->setHeaderPaths({ProjectExplorer::HeaderPath::makeUser(
TestIncludePaths::directoryOfTestFile())}); TestIncludePaths::directoryOfTestFile())});
sourceProcessor->run(filePath); sourceProcessor->run(filePath.toString());
Document::Ptr document = m_cmm->document(Utils::FilePath::fromString(filePath)); Document::Ptr document = m_cmm->document(filePath);
return document; return document;
} }
@@ -70,7 +70,7 @@ private:
/// Check: Resolved and unresolved includes are properly tracked. /// Check: Resolved and unresolved includes are properly tracked.
void SourceProcessorTest::testIncludesResolvedUnresolved() void SourceProcessorTest::testIncludesResolvedUnresolved()
{ {
const QString testFilePath const FilePath testFilePath
= TestIncludePaths::testFilePath(QLatin1String("test_main_resolvedUnresolved.cpp")); = TestIncludePaths::testFilePath(QLatin1String("test_main_resolvedUnresolved.cpp"));
SourcePreprocessor processor; SourcePreprocessor processor;
@@ -81,7 +81,7 @@ void SourceProcessorTest::testIncludesResolvedUnresolved()
QCOMPARE(resolvedIncludes.size(), 1); QCOMPARE(resolvedIncludes.size(), 1);
QCOMPARE(resolvedIncludes.at(0).type(), Client::IncludeLocal); QCOMPARE(resolvedIncludes.at(0).type(), Client::IncludeLocal);
QCOMPARE(resolvedIncludes.at(0).unresolvedFileName(), QLatin1String("header.h")); QCOMPARE(resolvedIncludes.at(0).unresolvedFileName(), QLatin1String("header.h"));
const QString expectedResolvedFileName const FilePath expectedResolvedFileName
= TestIncludePaths::testFilePath(QLatin1String("header.h")); = TestIncludePaths::testFilePath(QLatin1String("header.h"));
QCOMPARE(resolvedIncludes.at(0).resolvedFileName(), expectedResolvedFileName); QCOMPARE(resolvedIncludes.at(0).resolvedFileName(), expectedResolvedFileName);
@@ -95,10 +95,9 @@ void SourceProcessorTest::testIncludesResolvedUnresolved()
/// Check: Avoid self-include entries due to cyclic includes. /// Check: Avoid self-include entries due to cyclic includes.
void SourceProcessorTest::testIncludesCyclic() void SourceProcessorTest::testIncludesCyclic()
{ {
const QString fileName1 = TestIncludePaths::testFilePath(QLatin1String("cyclic1.h")); const FilePath filePath1 = TestIncludePaths::testFilePath(QLatin1String("cyclic1.h"));
const QString fileName2 = TestIncludePaths::testFilePath(QLatin1String("cyclic2.h")); const FilePath filePath2 = TestIncludePaths::testFilePath(QLatin1String("cyclic2.h"));
const QSet<FilePath> sourceFiles = {FilePath::fromString(fileName1), const QSet<FilePath> sourceFiles = {filePath1, filePath2};
FilePath::fromString(fileName2)};
// Create global snapshot (needed in BuiltinEditorDocumentParser) // Create global snapshot (needed in BuiltinEditorDocumentParser)
TestCase testCase; TestCase testCase;
@@ -106,7 +105,7 @@ void SourceProcessorTest::testIncludesCyclic()
// Open editor // Open editor
TextEditor::BaseTextEditor *editor; TextEditor::BaseTextEditor *editor;
QVERIFY(testCase.openCppEditor(FilePath::fromString(fileName1), &editor)); QVERIFY(testCase.openCppEditor(filePath1, &editor));
testCase.closeEditorAtEndOfTestCase(editor); testCase.closeEditorAtEndOfTestCase(editor);
// Check editor snapshot // Check editor snapshot
@@ -118,24 +117,24 @@ void SourceProcessorTest::testIncludesCyclic()
QCOMPARE(snapshot.size(), 3); // Configuration file included QCOMPARE(snapshot.size(), 3); // Configuration file included
// Check includes // Check includes
Document::Ptr doc1 = snapshot.document(fileName1); Document::Ptr doc1 = snapshot.document(filePath1);
QVERIFY(doc1); QVERIFY(doc1);
Document::Ptr doc2 = snapshot.document(fileName2); Document::Ptr doc2 = snapshot.document(filePath2);
QVERIFY(doc2); QVERIFY(doc2);
QCOMPARE(doc1->unresolvedIncludes().size(), 0); QCOMPARE(doc1->unresolvedIncludes().size(), 0);
QCOMPARE(doc1->resolvedIncludes().size(), 1); QCOMPARE(doc1->resolvedIncludes().size(), 1);
QCOMPARE(doc1->resolvedIncludes().first().resolvedFileName(), fileName2); QCOMPARE(doc1->resolvedIncludes().first().resolvedFileName(), filePath2);
QCOMPARE(doc2->unresolvedIncludes().size(), 0); QCOMPARE(doc2->unresolvedIncludes().size(), 0);
QCOMPARE(doc2->resolvedIncludes().size(), 1); QCOMPARE(doc2->resolvedIncludes().size(), 1);
QCOMPARE(doc2->resolvedIncludes().first().resolvedFileName(), fileName1); QCOMPARE(doc2->resolvedIncludes().first().resolvedFileName(), filePath1);
} }
/// Check: All include errors are reported as diagnostic messages. /// Check: All include errors are reported as diagnostic messages.
void SourceProcessorTest::testIncludesAllDiagnostics() void SourceProcessorTest::testIncludesAllDiagnostics()
{ {
const QString testFilePath const FilePath testFilePath
= TestIncludePaths::testFilePath(QLatin1String("test_main_allDiagnostics.cpp")); = TestIncludePaths::testFilePath(QLatin1String("test_main_allDiagnostics.cpp"));
SourcePreprocessor processor; SourcePreprocessor processor;
@@ -149,7 +148,7 @@ void SourceProcessorTest::testIncludesAllDiagnostics()
void SourceProcessorTest::testMacroUses() void SourceProcessorTest::testMacroUses()
{ {
const QString testFilePath const FilePath testFilePath
= TestIncludePaths::testFilePath(QLatin1String("test_main_macroUses.cpp")); = TestIncludePaths::testFilePath(QLatin1String("test_main_macroUses.cpp"));
SourcePreprocessor processor; SourcePreprocessor processor;

View File

@@ -450,7 +450,7 @@ int IncludeGroup::lineForNewInclude(const QString &newIncludeFileName,
return -1; return -1;
if (isSorted()) { if (isSorted()) {
const Include newInclude(newIncludeFileName, QString(), 0, newIncludeType); const Include newInclude(newIncludeFileName, FilePath(), 0, newIncludeType);
const QList<Include>::const_iterator it = std::lower_bound(m_includes.begin(), const QList<Include>::const_iterator it = std::lower_bound(m_includes.begin(),
m_includes.end(), newInclude, includeFileNamelessThen); m_includes.end(), newInclude, includeFileNamelessThen);
if (it == m_includes.end()) if (it == m_includes.end())
@@ -509,22 +509,22 @@ using Tests::Internal::TestIncludePaths;
namespace Internal { namespace Internal {
static QList<Include> includesForSource(const QString &filePath) static QList<Include> includesForSource(const FilePath &filePath)
{ {
CppModelManager *cmm = CppModelManager::instance(); CppModelManager *cmm = CppModelManager::instance();
cmm->GC(); cmm->GC();
QScopedPointer<CppSourceProcessor> sourceProcessor(CppModelManager::createSourceProcessor()); QScopedPointer<CppSourceProcessor> sourceProcessor(CppModelManager::createSourceProcessor());
sourceProcessor->setHeaderPaths({ProjectExplorer::HeaderPath::makeUser( sourceProcessor->setHeaderPaths({ProjectExplorer::HeaderPath::makeUser(
TestIncludePaths::globalIncludePath())}); TestIncludePaths::globalIncludePath())});
sourceProcessor->run(filePath); sourceProcessor->run(filePath.toString());
Document::Ptr document = cmm->document(FilePath::fromString(filePath)); Document::Ptr document = cmm->document(filePath);
return document->resolvedIncludes(); return document->resolvedIncludes();
} }
void IncludeGroupsTest::testDetectIncludeGroupsByNewLines() void IncludeGroupsTest::testDetectIncludeGroupsByNewLines()
{ {
const QString testFilePath = TestIncludePaths::testFilePath( const FilePath testFilePath = TestIncludePaths::testFilePath(
QLatin1String("test_main_detectIncludeGroupsByNewLines.cpp")); QLatin1String("test_main_detectIncludeGroupsByNewLines.cpp"));
QList<Include> includes = includesForSource(testFilePath); QList<Include> includes = includesForSource(testFilePath);
@@ -566,7 +566,7 @@ void IncludeGroupsTest::testDetectIncludeGroupsByNewLines()
void IncludeGroupsTest::testDetectIncludeGroupsByIncludeDir() void IncludeGroupsTest::testDetectIncludeGroupsByIncludeDir()
{ {
const QString testFilePath = TestIncludePaths::testFilePath( const FilePath testFilePath = TestIncludePaths::testFilePath(
QLatin1String("test_main_detectIncludeGroupsByIncludeDir.cpp")); QLatin1String("test_main_detectIncludeGroupsByIncludeDir.cpp"));
QList<Include> includes = includesForSource(testFilePath); QList<Include> includes = includesForSource(testFilePath);
@@ -590,7 +590,7 @@ void IncludeGroupsTest::testDetectIncludeGroupsByIncludeDir()
void IncludeGroupsTest::testDetectIncludeGroupsByIncludeType() void IncludeGroupsTest::testDetectIncludeGroupsByIncludeType()
{ {
const QString testFilePath = TestIncludePaths::testFilePath( const FilePath testFilePath = TestIncludePaths::testFilePath(
QLatin1String("test_main_detectIncludeGroupsByIncludeType.cpp")); QLatin1String("test_main_detectIncludeGroupsByIncludeType.cpp"));
QList<Include> includes = includesForSource(testFilePath); QList<Include> includes = includesForSource(testFilePath);

View File

@@ -114,7 +114,7 @@ static QList<Document::Ptr> findDocumentsIncluding(const Snapshot &docTable,
docList.append(doc); docList.append(doc);
} }
} else { } else {
if (include.resolvedFileName() == fileName) if (include.resolvedFileName().path() == fileName)
docList.append(doc); docList.append(doc);
} }
} }

View File

@@ -152,18 +152,18 @@ void UpdateIncludeDependenciesVisitor::visitMComponent(qmt::MComponent *componen
if (document) { if (document) {
const QList<CPlusPlus::Document::Include> includes = document->resolvedIncludes(); const QList<CPlusPlus::Document::Include> includes = document->resolvedIncludes();
for (const CPlusPlus::Document::Include &include : includes) { for (const CPlusPlus::Document::Include &include : includes) {
QString includeFilePath = include.resolvedFileName(); Utils::FilePath includeFilePath = include.resolvedFileName();
// replace proxy header with real one // replace proxy header with real one
CPlusPlus::Document::Ptr includeDocument = snapshot.document(includeFilePath); CPlusPlus::Document::Ptr includeDocument = snapshot.document(includeFilePath);
if (includeDocument) { if (includeDocument) {
QList<CPlusPlus::Document::Include> includes = includeDocument->resolvedIncludes(); QList<CPlusPlus::Document::Include> includes = includeDocument->resolvedIncludes();
if (includes.count() == 1 && if (includes.count() == 1 &&
QFileInfo(includes.at(0).resolvedFileName()).fileName() == QFileInfo(includeFilePath).fileName()) includes.at(0).resolvedFileName().fileName() == includeFilePath.fileName())
{ {
includeFilePath = includes.at(0).resolvedFileName(); includeFilePath = includes.at(0).resolvedFileName();
} }
} }
qmt::MComponent *includeComponent = findComponentFromFilePath(includeFilePath); qmt::MComponent *includeComponent = findComponentFromFilePath(includeFilePath.toString());
if (includeComponent && includeComponent != component) { if (includeComponent && includeComponent != component) {
// add dependency between components // add dependency between components
if (!m_modelUtilities->haveDependency(component, includeComponent)) { if (!m_modelUtilities->haveDependency(component, includeComponent)) {

View File

@@ -224,7 +224,7 @@ bool PxNodeUtilities::isProxyHeader(const QString &file) const
QList<CPlusPlus::Document::Include> includes = document->resolvedIncludes(); QList<CPlusPlus::Document::Include> includes = document->resolvedIncludes();
if (includes.count() != 1) if (includes.count() != 1)
return false; return false;
return QFileInfo(includes.at(0).resolvedFileName()).fileName() == QFileInfo(file).fileName(); return includes.at(0).resolvedFileName().fileName() == QFileInfo(file).fileName();
} }
return false; return false;
} }

View File

@@ -1148,14 +1148,14 @@ void tst_CheckSymbols::test_checksymbols_infiniteLoop()
const QString filePath1 = QDir::tempPath() + QLatin1String("/file1.h"); const QString filePath1 = QDir::tempPath() + QLatin1String("/file1.h");
Tests::TestCase::writeFile(FilePath::fromString(filePath1), source1); Tests::TestCase::writeFile(FilePath::fromString(filePath1), source1);
const QString filePath2 = QDir::tempPath() + QLatin1String("/file2.h"); const FilePath filePath2 = FilePath::fromString(QDir::tempPath()) / "/file2.h";
Tests::TestCase::writeFile(FilePath::fromString(filePath2), source2); Tests::TestCase::writeFile(filePath2, source2);
const Document::Ptr document1 = TestCase::createDocument(filePath1, source1); const Document::Ptr document1 = TestCase::createDocument(filePath1, source1);
document1->addIncludeFile(Document::Include("file2.h", filePath2, 1, Client::IncludeLocal)); document1->addIncludeFile(Document::Include("file2.h", filePath2, 1, Client::IncludeLocal));
Snapshot snapshot; Snapshot snapshot;
snapshot.insert(document1); snapshot.insert(document1);
snapshot.insert(TestCase::createDocument(filePath2, source2)); snapshot.insert(TestCase::createDocument(filePath2.toString(), source2));
TestCase::runCheckSymbols(document1, snapshot); TestCase::runCheckSymbols(document1, snapshot);
} }