forked from qt-creator/qt-creator
CppTools: Allow to limit the files to process by file size
...with the environment variable QTC_CPP_FILE_SIZE_LIMIT_MB. Task-number: QTCREATORBUG-14390 Change-Id: Iaefaa1a3db023b58f9351b96e1b9e2139797e280 Reviewed-by: Erik Verbruggen <erik.verbruggen@theqtcompany.com>
This commit is contained in:
@@ -42,6 +42,7 @@
|
||||
#include "cppsourceprocessor.h"
|
||||
#include "cpptoolsconstants.h"
|
||||
#include "cpptoolsplugin.h"
|
||||
#include "cpptoolsreuse.h"
|
||||
#include "editordocumenthandle.h"
|
||||
|
||||
#include <coreplugin/documentmanager.h>
|
||||
@@ -585,15 +586,38 @@ QByteArray CppModelManager::codeModelConfiguration() const
|
||||
return QByteArray::fromRawData(pp_configuration, qstrlen(pp_configuration));
|
||||
}
|
||||
|
||||
static QSet<QString> tooBigFilesRemoved(const QSet<QString> &files, int fileSizeLimit)
|
||||
{
|
||||
if (fileSizeLimit == 0)
|
||||
return files;
|
||||
|
||||
QSet<QString> result;
|
||||
QFileInfo fileInfo;
|
||||
|
||||
QSetIterator<QString> i(files);
|
||||
while (i.hasNext()) {
|
||||
const QString filePath = i.next();
|
||||
fileInfo.setFile(filePath);
|
||||
if (skipFileDueToSizeLimit(fileInfo), fileSizeLimit)
|
||||
continue;
|
||||
|
||||
result << filePath;
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
QFuture<void> CppModelManager::updateSourceFiles(const QSet<QString> &sourceFiles,
|
||||
ProgressNotificationMode mode)
|
||||
{
|
||||
if (sourceFiles.isEmpty() || !d->m_indexerEnabled)
|
||||
return QFuture<void>();
|
||||
|
||||
const auto filteredFiles = tooBigFilesRemoved(sourceFiles, fileSizeLimit());
|
||||
|
||||
if (d->m_indexingSupporter)
|
||||
d->m_indexingSupporter->refreshSourceFiles(sourceFiles, mode);
|
||||
return d->m_internalIndexingSupport->refreshSourceFiles(sourceFiles, mode);
|
||||
d->m_indexingSupporter->refreshSourceFiles(filteredFiles, mode);
|
||||
return d->m_internalIndexingSupport->refreshSourceFiles(filteredFiles, mode);
|
||||
}
|
||||
|
||||
QList<ProjectInfo> CppModelManager::projectInfos() const
|
||||
|
Reference in New Issue
Block a user