forked from qt-creator/qt-creator
CPlusPlus: Proliferate FilePath use
The starts with CppDocument::filePath(), plus a bit of the fallout This is one patch of potentially many. It is hard to draw the line where to stop this kind of chunk, this here converts a few additional functions for which including it in the patch looked like less churn than without. Converting is mostly fromString/toString, with a few exceptions for "already seem" like caches, that use cheaper "path()" to avoid likely performance regressions (on Windows FilePath comparison is currently case-insenstive, and more expensive). There should be no difference for local operation with this patch. Change-Id: I7b35f98a0a6f0bfed4ea0f8f987faf586f7a8f2b Reviewed-by: Christian Kandeler <christian.kandeler@qt.io>
This commit is contained in:
@@ -239,7 +239,7 @@ public:
|
||||
categorize(categorize)
|
||||
{ }
|
||||
|
||||
QList<CPlusPlus::Usage> operator()(const Utils::FilePath &fileName)
|
||||
QList<CPlusPlus::Usage> operator()(const Utils::FilePath &filePath)
|
||||
{
|
||||
QList<CPlusPlus::Usage> usages;
|
||||
if (future->isPaused())
|
||||
@@ -248,18 +248,18 @@ public:
|
||||
return usages;
|
||||
const CPlusPlus::Identifier *symbolId = symbol->identifier();
|
||||
|
||||
if (CPlusPlus::Document::Ptr previousDoc = snapshot.document(fileName)) {
|
||||
if (CPlusPlus::Document::Ptr previousDoc = snapshot.document(filePath)) {
|
||||
CPlusPlus::Control *control = previousDoc->control();
|
||||
if (!control->findIdentifier(symbolId->chars(), symbolId->size()))
|
||||
return usages; // skip this document, it's not using symbolId.
|
||||
}
|
||||
CPlusPlus::Document::Ptr doc;
|
||||
const QByteArray unpreprocessedSource = getSource(fileName, workingCopy);
|
||||
const QByteArray unpreprocessedSource = getSource(filePath, workingCopy);
|
||||
|
||||
if (symbolDocument && fileName == Utils::FilePath::fromString(symbolDocument->fileName())) {
|
||||
if (symbolDocument && filePath == symbolDocument->filePath()) {
|
||||
doc = symbolDocument;
|
||||
} else {
|
||||
doc = snapshot.preprocessedDocument(unpreprocessedSource, fileName);
|
||||
doc = snapshot.preprocessedDocument(unpreprocessedSource, filePath);
|
||||
doc->tokenize();
|
||||
}
|
||||
|
||||
@@ -541,10 +541,9 @@ CPlusPlus::Symbol *CppFindReferences::findSymbol(const CppFindReferencesParamete
|
||||
|
||||
CPlusPlus::Document::Ptr newSymbolDocument = snapshot.document(symbolFile);
|
||||
// document is not parsed and has no bindings yet, do it
|
||||
QByteArray source = getSource(Utils::FilePath::fromString(newSymbolDocument->fileName()),
|
||||
m_modelManager->workingCopy());
|
||||
QByteArray source = getSource(newSymbolDocument->filePath(), m_modelManager->workingCopy());
|
||||
CPlusPlus::Document::Ptr doc =
|
||||
snapshot.preprocessedDocument(source, FilePath::fromString(newSymbolDocument->fileName()));
|
||||
snapshot.preprocessedDocument(source, newSymbolDocument->filePath());
|
||||
doc->check();
|
||||
|
||||
// find matching symbol in new document and return the new parameters
|
||||
|
||||
Reference in New Issue
Block a user