forked from qt-creator/qt-creator
Merge remote-tracking branch 'origin/3.4'
Change-Id: I35ba4cc7f7052699c3006545514c866be3cb5fdd
This commit is contained in:
@@ -38,6 +38,7 @@
|
||||
#include <cplusplus/LookupContext.h>
|
||||
#include <utils/qtcassert.h>
|
||||
|
||||
#include <QDebug>
|
||||
#include <QSet>
|
||||
#include <QStringRef>
|
||||
#include <QTextCursor>
|
||||
@@ -250,4 +251,33 @@ TextEditor::TextEditorWidget::Link linkToSymbol(Symbol *symbol)
|
||||
return Link(filename, line, column);
|
||||
}
|
||||
|
||||
int fileSizeLimit()
|
||||
{
|
||||
static const QByteArray fileSizeLimitAsByteArray = qgetenv("QTC_CPP_FILE_SIZE_LIMIT_MB");
|
||||
static int fileSizeLimitAsInt = -1;
|
||||
|
||||
if (fileSizeLimitAsInt == -1) {
|
||||
bool ok;
|
||||
const int limit = fileSizeLimitAsByteArray.toInt(&ok);
|
||||
fileSizeLimitAsInt = ok && limit >= 0 ? limit : 0;
|
||||
}
|
||||
|
||||
return fileSizeLimitAsInt;
|
||||
}
|
||||
|
||||
bool skipFileDueToSizeLimit(const QFileInfo &fileInfo, int limitInMB)
|
||||
{
|
||||
if (limitInMB == 0) // unlimited
|
||||
return false;
|
||||
|
||||
const int fileSizeInMB = fileInfo.size() * 1000 * 1000;
|
||||
if (fileSizeInMB > limitInMB) {
|
||||
qWarning() << "Files to process limited by QTC_CPP_FILE_SIZE_LIMIT_MB, skipping"
|
||||
<< fileInfo.absoluteFilePath();
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
} // CppTools
|
||||
|
||||
Reference in New Issue
Block a user