make split_value_list() take a QStringRef as input
this also saves some of the cheap but ugly toQString() calls. Change-Id: Iebe644986501db3878306521c76e4ba2c2fb97b4 Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
This commit is contained in:
parent
ad17a35853
commit
981f8ad2e4
@ -532,7 +532,7 @@ ProStringList QMakeEvaluator::evaluateBuiltinExpand(
|
||||
bool leftalign = false;
|
||||
enum { DefaultSign, PadSign, AlwaysSign } sign = DefaultSign;
|
||||
if (args.count() >= 2) {
|
||||
const auto opts = split_value_list(args.at(1).toQString(m_tmp2));
|
||||
const auto opts = split_value_list(args.at(1).toQStringRef());
|
||||
for (const ProString &opt : opts) {
|
||||
opt.toQString(m_tmp3);
|
||||
if (m_tmp3.startsWith(QLatin1String("ibase="))) {
|
||||
@ -726,7 +726,8 @@ ProStringList QMakeEvaluator::evaluateBuiltinExpand(
|
||||
if (lines) {
|
||||
ret += ProString(stream.readLine());
|
||||
} else {
|
||||
ret += split_value_list(stream.readLine().trimmed());
|
||||
const QString &line = stream.readLine();
|
||||
ret += split_value_list(QStringRef(&line).trimmed());
|
||||
if (!singleLine)
|
||||
ret += ProString("\n");
|
||||
}
|
||||
@ -758,7 +759,7 @@ ProStringList QMakeEvaluator::evaluateBuiltinExpand(
|
||||
ret = ProStringList(ProString(tmp));
|
||||
ProStringList lst;
|
||||
for (const ProString &arg : args)
|
||||
lst += split_value_list(arg.toQString(m_tmp1), arg.sourceFile()); // Relies on deep copy
|
||||
lst += split_value_list(arg.toQStringRef(), arg.sourceFile()); // Relies on deep copy
|
||||
m_valuemapStack.top()[ret.at(0).toKey()] = lst;
|
||||
break; }
|
||||
case E_FIND:
|
||||
@ -805,7 +806,7 @@ ProStringList QMakeEvaluator::evaluateBuiltinExpand(
|
||||
output.replace(QLatin1Char('\t'), QLatin1Char(' '));
|
||||
if (singleLine)
|
||||
output.replace(QLatin1Char('\n'), QLatin1Char(' '));
|
||||
ret += split_value_list(output);
|
||||
ret += split_value_list(QStringRef(&output));
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -954,7 +955,8 @@ ProStringList QMakeEvaluator::evaluateBuiltinExpand(
|
||||
QFile qfile;
|
||||
if (qfile.open(stdin, QIODevice::ReadOnly)) {
|
||||
QTextStream t(&qfile);
|
||||
ret = split_value_list(t.readLine());
|
||||
const QString &line = t.readLine();
|
||||
ret = split_value_list(QStringRef(&line));
|
||||
}
|
||||
}
|
||||
break; }
|
||||
@ -988,7 +990,7 @@ ProStringList QMakeEvaluator::evaluateBuiltinExpand(
|
||||
ProString priosfx = args.count() < 4 ? ProString(".priority") : args.at(3);
|
||||
populateDeps(orgList, prefix,
|
||||
args.count() < 3 ? ProStringList(ProString(".depends"))
|
||||
: split_value_list(args.at(2).toQString(m_tmp2)),
|
||||
: split_value_list(args.at(2).toQStringRef()),
|
||||
priosfx, dependencies, dependees, rootSet);
|
||||
while (!rootSet.isEmpty()) {
|
||||
QMultiMap<int, ProString>::iterator it = rootSet.begin();
|
||||
@ -1569,7 +1571,7 @@ QMakeEvaluator::VisitReturn QMakeEvaluator::evaluateBuiltinConditional(
|
||||
if (!vals.isEmpty())
|
||||
contents = vals.join(QLatin1Char('\n')) + QLatin1Char('\n');
|
||||
if (args.count() >= 3) {
|
||||
const auto opts = split_value_list(args.at(2).toQString(m_tmp2));
|
||||
const auto opts = split_value_list(args.at(2).toQStringRef());
|
||||
for (const ProString &opt : opts) {
|
||||
opt.toQString(m_tmp3);
|
||||
if (m_tmp3 == QLatin1String("append")) {
|
||||
@ -1642,7 +1644,7 @@ QMakeEvaluator::VisitReturn QMakeEvaluator::evaluateBuiltinConditional(
|
||||
enum { CacheSet, CacheAdd, CacheSub } mode = CacheSet;
|
||||
ProKey srcvar;
|
||||
if (args.count() >= 2) {
|
||||
const auto opts = split_value_list(args.at(1).toQString(m_tmp2));
|
||||
const auto opts = split_value_list(args.at(1).toQStringRef());
|
||||
for (const ProString &opt : opts) {
|
||||
opt.toQString(m_tmp3);
|
||||
if (m_tmp3 == QLatin1String("transient")) {
|
||||
|
@ -270,7 +270,7 @@ void QMakeEvaluator::skipHashStr(const ushort *&tokPtr)
|
||||
|
||||
// FIXME: this should not build new strings for direct sections.
|
||||
// Note that the E_SPRINTF and E_LIST implementations rely on the deep copy.
|
||||
ProStringList QMakeEvaluator::split_value_list(const QString &vals, const ProFile *source)
|
||||
ProStringList QMakeEvaluator::split_value_list(const QStringRef &vals, const ProFile *source)
|
||||
{
|
||||
QString build;
|
||||
ProStringList ret;
|
||||
|
@ -176,7 +176,7 @@ public:
|
||||
|
||||
void setTemplate();
|
||||
|
||||
ProStringList split_value_list(const QString &vals, const ProFile *source = 0);
|
||||
ProStringList split_value_list(const QStringRef &vals, const ProFile *source = 0);
|
||||
ProStringList expandVariableReferences(const ProString &value, int *pos = 0, bool joined = false);
|
||||
ProStringList expandVariableReferences(const ushort *&tokPtr, int sizeHint = 0, bool joined = false);
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user