forked from qt-creator/qt-creator
qmake: fix raw data detach avoidance
the m_tmp array is a member, so the index toggle for accessing it also needs to be one - otherwise, odd iteration counts will defeat the mechanism. Change-Id: If7a800ed5a4b4168625daf1ebbd5d2d164569d8e Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io> (cherry picked from qtbase/ccb8afcda752093bfb6bc32f560131a91bd826a1) Reviewed-by: Tobias Hunger <tobias.hunger@qt.io>
This commit is contained in:
@@ -884,12 +884,10 @@ QMakeEvaluator::VisitReturn QMakeEvaluator::evaluateBuiltinExpand(
|
|||||||
evalError(fL1S("find(var, str) requires two arguments."));
|
evalError(fL1S("find(var, str) requires two arguments."));
|
||||||
} else {
|
} else {
|
||||||
QRegExp regx(args.at(1).toQString());
|
QRegExp regx(args.at(1).toQString());
|
||||||
int t = 0;
|
|
||||||
const auto vals = values(map(args.at(0)));
|
const auto vals = values(map(args.at(0)));
|
||||||
for (const ProString &val : vals) {
|
for (const ProString &val : vals) {
|
||||||
if (regx.indexIn(val.toQString(m_tmp[t])) != -1)
|
if (regx.indexIn(val.toQString(m_tmp[m_toggle ^= 1])) != -1)
|
||||||
ret += val;
|
ret += val;
|
||||||
t ^= 1;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
@@ -1389,12 +1387,10 @@ QMakeEvaluator::VisitReturn QMakeEvaluator::evaluateBuiltinConditional(
|
|||||||
copy.detach();
|
copy.detach();
|
||||||
regx.setPattern(copy);
|
regx.setPattern(copy);
|
||||||
}
|
}
|
||||||
int t = 0;
|
|
||||||
const auto strings = vars.value(map(args.at(1)));
|
const auto strings = vars.value(map(args.at(1)));
|
||||||
for (const ProString &s : strings) {
|
for (const ProString &s : strings) {
|
||||||
if ((!regx.isEmpty() && regx.exactMatch(s.toQString(m_tmp[t]))) || s == qry)
|
if ((!regx.isEmpty() && regx.exactMatch(s.toQString(m_tmp[m_toggle ^= 1]))) || s == qry)
|
||||||
return ReturnTrue;
|
return ReturnTrue;
|
||||||
t ^= 1;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return ReturnFalse;
|
return ReturnFalse;
|
||||||
@@ -1459,12 +1455,10 @@ QMakeEvaluator::VisitReturn QMakeEvaluator::evaluateBuiltinConditional(
|
|||||||
}
|
}
|
||||||
const ProStringList &l = values(map(args.at(0)));
|
const ProStringList &l = values(map(args.at(0)));
|
||||||
if (args.count() == 2) {
|
if (args.count() == 2) {
|
||||||
int t = 0;
|
|
||||||
for (int i = 0; i < l.size(); ++i) {
|
for (int i = 0; i < l.size(); ++i) {
|
||||||
const ProString &val = l[i];
|
const ProString &val = l[i];
|
||||||
if ((!regx.isEmpty() && regx.exactMatch(val.toQString(m_tmp[t]))) || val == qry)
|
if ((!regx.isEmpty() && regx.exactMatch(val.toQString(m_tmp[m_toggle ^= 1]))) || val == qry)
|
||||||
return ReturnTrue;
|
return ReturnTrue;
|
||||||
t ^= 1;
|
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
const auto mutuals = args.at(2).toQStringRef().split(QLatin1Char('|'));
|
const auto mutuals = args.at(2).toQStringRef().split(QLatin1Char('|'));
|
||||||
|
@@ -223,6 +223,7 @@ QMakeEvaluator::QMakeEvaluator(QMakeGlobals *option, QMakeParser *parser, QMakeV
|
|||||||
m_skipLevel = 0;
|
m_skipLevel = 0;
|
||||||
#endif
|
#endif
|
||||||
m_listCount = 0;
|
m_listCount = 0;
|
||||||
|
m_toggle = 0;
|
||||||
m_valuemapStack.push(ProValueMap());
|
m_valuemapStack.push(ProValueMap());
|
||||||
m_valuemapInited = false;
|
m_valuemapInited = false;
|
||||||
}
|
}
|
||||||
@@ -1648,12 +1649,10 @@ bool QMakeEvaluator::isActiveConfig(const QStringRef &config, bool regex)
|
|||||||
return true;
|
return true;
|
||||||
|
|
||||||
// CONFIG variable
|
// CONFIG variable
|
||||||
int t = 0;
|
|
||||||
const auto configValues = values(statics.strCONFIG);
|
const auto configValues = values(statics.strCONFIG);
|
||||||
for (const ProString &configValue : configValues) {
|
for (const ProString &configValue : configValues) {
|
||||||
if (re.exactMatch(configValue.toQString(m_tmp[t])))
|
if (re.exactMatch(configValue.toQString(m_tmp[m_toggle ^= 1])))
|
||||||
return true;
|
return true;
|
||||||
t ^= 1;
|
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
// mkspecs
|
// mkspecs
|
||||||
|
@@ -283,6 +283,7 @@ public:
|
|||||||
QString m_outputDir;
|
QString m_outputDir;
|
||||||
|
|
||||||
int m_listCount;
|
int m_listCount;
|
||||||
|
int m_toggle;
|
||||||
bool m_valuemapInited;
|
bool m_valuemapInited;
|
||||||
bool m_hostBuild;
|
bool m_hostBuild;
|
||||||
QString m_qmakespec;
|
QString m_qmakespec;
|
||||||
|
Reference in New Issue
Block a user