ClangSupport: Use simpler structures in some cases

The patch is mostly mechanical, but contains also a few spurious changes
from values references for some local variables, foreach -> ranged for
etc that I coulnd't resist.

Change-Id: I58f0bd972546895eb318607cbfbd7ac35caf3f23
Reviewed-by: Ivan Donchevskii <ivan.donchevskii@qt.io>
This commit is contained in:
hjk
2018-04-04 18:25:23 +02:00
parent 4a0bbed560
commit cf4dbb4bb6
150 changed files with 1814 additions and 2598 deletions

View File

@@ -123,7 +123,7 @@ const TimePoint UnsavedFiles::lastChangeTimePoint() const
void UnsavedFiles::updateUnsavedFileWithFileContainer(const FileContainer &fileContainer)
{
if (fileContainer.hasUnsavedFileContent())
if (fileContainer.hasUnsavedFileContent)
addOrUpdateUnsavedFile(fileContainer);
else
removeUnsavedFile(fileContainer);
@@ -131,7 +131,7 @@ void UnsavedFiles::updateUnsavedFileWithFileContainer(const FileContainer &fileC
void UnsavedFiles::removeUnsavedFile(const FileContainer &fileContainer)
{
const Utf8String filePath = fileContainer.filePath();
const Utf8String &filePath = fileContainer.filePath;
auto removeBeginIterator = std::partition(d->unsavedFiles.begin(),
d->unsavedFiles.end(),
[filePath] (const UnsavedFile &unsavedFile) { return filePath != unsavedFile.filePath(); });
@@ -141,8 +141,8 @@ void UnsavedFiles::removeUnsavedFile(const FileContainer &fileContainer)
void UnsavedFiles::addOrUpdateUnsavedFile(const FileContainer &fileContainer)
{
const Utf8String filePath = fileContainer.filePath();
const Utf8String fileContent = fileContainer.unsavedFileContent();
const Utf8String &filePath = fileContainer.filePath;
const Utf8String &fileContent = fileContainer.unsavedFileContent;
auto isSameFile = [filePath] (const UnsavedFile &unsavedFile) { return filePath == unsavedFile.filePath(); };
auto unsavedFileIterator = std::find_if(d->unsavedFiles.begin(), d->unsavedFiles.end(), isSameFile);