forked from qt-creator/qt-creator
qmake: fix excessive detaching of raw data
... in $$basename(), $$dirname(), and contains(). the latter case is marginal, as it only applies to mutuals which are regexes, which i don't remember ever seeing used. QRegExp saves a copy of the matched string, so it's necessary to alternate between two temporaries to avoid detaching. we already did that in most places. Change-Id: I97b8294585c17c76d1756f83971f42cb88353af0 Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io> (cherry picked from qtbase/5131bb9bed3af7a2ecfce27af3940ff11ed219c2) Reviewed-by: Tobias Hunger <tobias.hunger@qt.io>
This commit is contained in:
@@ -583,8 +583,8 @@ QMakeEvaluator::VisitReturn QMakeEvaluator::evaluateBuiltinExpand(
|
||||
if (regexp) {
|
||||
QRegExp sepRx(sep);
|
||||
for (const ProString &str : strings) {
|
||||
const QString &rstr = str.toQString(m_tmp1).section(sepRx, beg, end);
|
||||
ret << (rstr.isSharedWith(m_tmp1) ? str : ProString(rstr).setSource(str));
|
||||
const QString &rstr = str.toQString(m_tmp[m_toggle ^= 1]).section(sepRx, beg, end);
|
||||
ret << (rstr.isSharedWith(m_tmp[m_toggle]) ? str : ProString(rstr).setSource(str));
|
||||
}
|
||||
} else {
|
||||
for (const ProString &str : strings) {
|
||||
@@ -1473,7 +1473,7 @@ QMakeEvaluator::VisitReturn QMakeEvaluator::evaluateBuiltinConditional(
|
||||
for (int mut = 0; mut < mutuals.count(); mut++) {
|
||||
if (val.toQStringRef() == mutuals[mut].trimmed()) {
|
||||
return returnBool((!regx.isEmpty()
|
||||
&& regx.exactMatch(val.toQString(m_tmp2)))
|
||||
&& regx.exactMatch(val.toQString(m_tmp[m_toggle ^= 1])))
|
||||
|| val == qry);
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user