C++: handle case-insensitive file names in the CPlusPlus::Snapshot

... by keying on Utils::FileName

Task-number: QTCREATORBUG-12390
Change-Id: Ia98afb5a9160a7fd9225a2f9e02539ff3c35ae86
Reviewed-by: Nikolai Kosjar <nikolai.kosjar@theqtcompany.com>
This commit is contained in:
Erik Verbruggen
2014-11-27 12:11:46 +01:00
committed by Erik Verbruggen
parent a8ece5e9b0
commit a48adcf9be
16 changed files with 141 additions and 78 deletions

View File

@@ -741,17 +741,17 @@ bool Snapshot::isEmpty() const
return _documents.isEmpty();
}
Snapshot::const_iterator Snapshot::find(const QString &fileName) const
Snapshot::const_iterator Snapshot::find(const Utils::FileName &fileName) const
{
return _documents.find(fileName);
}
void Snapshot::remove(const QString &fileName)
void Snapshot::remove(const Utils::FileName &fileName)
{
_documents.remove(fileName);
}
bool Snapshot::contains(const QString &fileName) const
bool Snapshot::contains(const Utils::FileName &fileName) const
{
return _documents.contains(fileName);
}
@@ -759,15 +759,15 @@ bool Snapshot::contains(const QString &fileName) const
void Snapshot::insert(Document::Ptr doc)
{
if (doc) {
_documents.insert(doc->fileName(), doc);
_documents.insert(Utils::FileName::fromString(doc->fileName()), doc);
m_deps.files.clear(); // Will trigger re-build when accessed.
}
}
Document::Ptr Snapshot::preprocessedDocument(const QByteArray &source,
const QString &fileName) const
const Utils::FileName &fileName) const
{
Document::Ptr newDoc = Document::create(fileName);
Document::Ptr newDoc = Document::create(fileName.toString());
if (Document::Ptr thisDocument = document(fileName)) {
newDoc->_revision = thisDocument->_revision;
newDoc->_editorRevision = thisDocument->_editorRevision;
@@ -821,7 +821,7 @@ QList<Snapshot::IncludeLocation> Snapshot::includeLocationsOfDocument(const QStr
return result;
}
QStringList Snapshot::filesDependingOn(const QString &fileName) const
Utils::FileNameList Snapshot::filesDependingOn(const Utils::FileName &fileName) const
{
updateDependencyTable();
return m_deps.filesDependingOn(fileName);
@@ -850,7 +850,7 @@ void Snapshot::allIncludesForDocument_helper(const QString &fileName, QSet<QStri
}
}
Document::Ptr Snapshot::document(const QString &fileName) const
Document::Ptr Snapshot::document(const Utils::FileName &fileName) const
{
return _documents.value(fileName);
}