qmake: use std names on a linked list
This is preparation of moving from QLinkedList to std::list, which is in preparation of deprecating QLinkedList. Change-Id: Ief259bc8c7178be5ca04812c6890cf65d86c069d Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
This commit is contained in:
parent
388fe97f2a
commit
0d88721d77
@ -1457,15 +1457,15 @@ QMakeEvaluator::VisitReturn QMakeEvaluator::evaluateBuiltinConditional(
|
|||||||
}
|
}
|
||||||
case T_EXPORT: {
|
case T_EXPORT: {
|
||||||
const ProKey &var = map(args.at(0));
|
const ProKey &var = map(args.at(0));
|
||||||
for (ProValueMapStack::Iterator vmi = m_valuemapStack.end();
|
for (ProValueMapStack::iterator vmi = m_valuemapStack.end();
|
||||||
--vmi != m_valuemapStack.begin(); ) {
|
--vmi != m_valuemapStack.begin(); ) {
|
||||||
ProValueMap::Iterator it = (*vmi).find(var);
|
ProValueMap::Iterator it = (*vmi).find(var);
|
||||||
if (it != (*vmi).end()) {
|
if (it != (*vmi).end()) {
|
||||||
if (it->constBegin() == statics.fakeValue.constBegin()) {
|
if (it->constBegin() == statics.fakeValue.constBegin()) {
|
||||||
// This is stupid, but qmake doesn't propagate deletions
|
// This is stupid, but qmake doesn't propagate deletions
|
||||||
m_valuemapStack.first()[var] = ProStringList();
|
m_valuemapStack.front()[var] = ProStringList();
|
||||||
} else {
|
} else {
|
||||||
m_valuemapStack.first()[var] = *it;
|
m_valuemapStack.front()[var] = *it;
|
||||||
}
|
}
|
||||||
(*vmi).erase(it);
|
(*vmi).erase(it);
|
||||||
while (--vmi != m_valuemapStack.begin())
|
while (--vmi != m_valuemapStack.begin())
|
||||||
@ -1476,7 +1476,7 @@ QMakeEvaluator::VisitReturn QMakeEvaluator::evaluateBuiltinConditional(
|
|||||||
return ReturnTrue;
|
return ReturnTrue;
|
||||||
}
|
}
|
||||||
case T_DISCARD_FROM: {
|
case T_DISCARD_FROM: {
|
||||||
if (m_valuemapStack.count() != 1) {
|
if (m_valuemapStack.size() != 1) {
|
||||||
evalError(fL1S("discard_from() cannot be called from functions."));
|
evalError(fL1S("discard_from() cannot be called from functions."));
|
||||||
return ReturnFalse;
|
return ReturnFalse;
|
||||||
}
|
}
|
||||||
@ -1486,7 +1486,7 @@ QMakeEvaluator::VisitReturn QMakeEvaluator::evaluateBuiltinConditional(
|
|||||||
int pro = m_vfs->idForFileName(fn, flags | QMakeVfs::VfsAccessedOnly);
|
int pro = m_vfs->idForFileName(fn, flags | QMakeVfs::VfsAccessedOnly);
|
||||||
if (!pro)
|
if (!pro)
|
||||||
return ReturnFalse;
|
return ReturnFalse;
|
||||||
ProValueMap &vmap = m_valuemapStack.first();
|
ProValueMap &vmap = m_valuemapStack.front();
|
||||||
for (auto vit = vmap.begin(); vit != vmap.end(); ) {
|
for (auto vit = vmap.begin(); vit != vmap.end(); ) {
|
||||||
if (!vit->isEmpty()) {
|
if (!vit->isEmpty()) {
|
||||||
auto isFrom = [pro](const ProString &s) {
|
auto isFrom = [pro](const ProString &s) {
|
||||||
@ -1514,7 +1514,7 @@ QMakeEvaluator::VisitReturn QMakeEvaluator::evaluateBuiltinConditional(
|
|||||||
else
|
else
|
||||||
++fit;
|
++fit;
|
||||||
}
|
}
|
||||||
ProStringList &iif = m_valuemapStack.first()[ProKey("QMAKE_INTERNAL_INCLUDED_FILES")];
|
ProStringList &iif = m_valuemapStack.front()[ProKey("QMAKE_INTERNAL_INCLUDED_FILES")];
|
||||||
int idx = iif.indexOf(ProString(fn));
|
int idx = iif.indexOf(ProString(fn));
|
||||||
if (idx >= 0)
|
if (idx >= 0)
|
||||||
iif.removeAt(idx);
|
iif.removeAt(idx);
|
||||||
|
@ -1439,7 +1439,7 @@ QMakeEvaluator::VisitReturn QMakeEvaluator::visitProFile(
|
|||||||
|
|
||||||
for (ProValueMap::ConstIterator it = m_extraVars.constBegin();
|
for (ProValueMap::ConstIterator it = m_extraVars.constBegin();
|
||||||
it != m_extraVars.constEnd(); ++it)
|
it != m_extraVars.constEnd(); ++it)
|
||||||
m_valuemapStack.first().insert(it.key(), it.value());
|
m_valuemapStack.front().insert(it.key(), it.value());
|
||||||
|
|
||||||
// In case default_pre needs to make decisions based on the current
|
// In case default_pre needs to make decisions based on the current
|
||||||
// build pass configuration.
|
// build pass configuration.
|
||||||
@ -1707,7 +1707,7 @@ QMakeEvaluator::VisitReturn QMakeEvaluator::evaluateFunction(
|
|||||||
{
|
{
|
||||||
VisitReturn vr;
|
VisitReturn vr;
|
||||||
|
|
||||||
if (m_valuemapStack.count() >= 100) {
|
if (m_valuemapStack.size() >= 100) {
|
||||||
evalError(fL1S("Ran into infinite recursion (depth > 100)."));
|
evalError(fL1S("Ran into infinite recursion (depth > 100)."));
|
||||||
vr = ReturnFalse;
|
vr = ReturnFalse;
|
||||||
} else {
|
} else {
|
||||||
@ -1859,7 +1859,7 @@ static bool isFunctParam(const ProKey &variableName)
|
|||||||
|
|
||||||
ProValueMap *QMakeEvaluator::findValues(const ProKey &variableName, ProValueMap::Iterator *rit)
|
ProValueMap *QMakeEvaluator::findValues(const ProKey &variableName, ProValueMap::Iterator *rit)
|
||||||
{
|
{
|
||||||
ProValueMapStack::Iterator vmi = m_valuemapStack.end();
|
ProValueMapStack::iterator vmi = m_valuemapStack.end();
|
||||||
for (bool first = true; ; first = false) {
|
for (bool first = true; ; first = false) {
|
||||||
--vmi;
|
--vmi;
|
||||||
ProValueMap::Iterator it = (*vmi).find(variableName);
|
ProValueMap::Iterator it = (*vmi).find(variableName);
|
||||||
@ -1886,7 +1886,7 @@ ProStringList &QMakeEvaluator::valuesRef(const ProKey &variableName)
|
|||||||
return *it;
|
return *it;
|
||||||
}
|
}
|
||||||
if (!isFunctParam(variableName)) {
|
if (!isFunctParam(variableName)) {
|
||||||
ProValueMapStack::Iterator vmi = m_valuemapStack.end();
|
ProValueMapStack::iterator vmi = m_valuemapStack.end();
|
||||||
if (--vmi != m_valuemapStack.begin()) {
|
if (--vmi != m_valuemapStack.begin()) {
|
||||||
do {
|
do {
|
||||||
--vmi;
|
--vmi;
|
||||||
@ -1905,7 +1905,7 @@ ProStringList &QMakeEvaluator::valuesRef(const ProKey &variableName)
|
|||||||
|
|
||||||
ProStringList QMakeEvaluator::values(const ProKey &variableName) const
|
ProStringList QMakeEvaluator::values(const ProKey &variableName) const
|
||||||
{
|
{
|
||||||
ProValueMapStack::ConstIterator vmi = m_valuemapStack.constEnd();
|
ProValueMapStack::const_iterator vmi = m_valuemapStack.cend();
|
||||||
for (bool first = true; ; first = false) {
|
for (bool first = true; ; first = false) {
|
||||||
--vmi;
|
--vmi;
|
||||||
ProValueMap::ConstIterator it = (*vmi).constFind(variableName);
|
ProValueMap::ConstIterator it = (*vmi).constFind(variableName);
|
||||||
@ -1914,7 +1914,7 @@ ProStringList QMakeEvaluator::values(const ProKey &variableName) const
|
|||||||
break;
|
break;
|
||||||
return *it;
|
return *it;
|
||||||
}
|
}
|
||||||
if (vmi == m_valuemapStack.constBegin())
|
if (vmi == m_valuemapStack.cbegin())
|
||||||
break;
|
break;
|
||||||
if (first && isFunctParam(variableName))
|
if (first && isFunctParam(variableName))
|
||||||
break;
|
break;
|
||||||
@ -1942,7 +1942,7 @@ QMakeEvaluator::VisitReturn QMakeEvaluator::evaluateFile(
|
|||||||
m_current = m_locationStack.pop();
|
m_current = m_locationStack.pop();
|
||||||
pro->deref();
|
pro->deref();
|
||||||
if (ok == ReturnTrue && !(flags & LoadHidden)) {
|
if (ok == ReturnTrue && !(flags & LoadHidden)) {
|
||||||
ProStringList &iif = m_valuemapStack.first()[ProKey("QMAKE_INTERNAL_INCLUDED_FILES")];
|
ProStringList &iif = m_valuemapStack.front()[ProKey("QMAKE_INTERNAL_INCLUDED_FILES")];
|
||||||
ProString ifn(fileName);
|
ProString ifn(fileName);
|
||||||
if (!iif.contains(ifn))
|
if (!iif.contains(ifn))
|
||||||
iif << ifn;
|
iif << ifn;
|
||||||
@ -2071,7 +2071,7 @@ QMakeEvaluator::VisitReturn QMakeEvaluator::evaluateFileInto(
|
|||||||
return ret;
|
return ret;
|
||||||
*values = visitor.m_valuemapStack.top();
|
*values = visitor.m_valuemapStack.top();
|
||||||
ProKey qiif("QMAKE_INTERNAL_INCLUDED_FILES");
|
ProKey qiif("QMAKE_INTERNAL_INCLUDED_FILES");
|
||||||
ProStringList &iif = m_valuemapStack.first()[qiif];
|
ProStringList &iif = m_valuemapStack.front()[qiif];
|
||||||
const auto ifns = values->value(qiif);
|
const auto ifns = values->value(qiif);
|
||||||
for (const ProString &ifn : ifns)
|
for (const ProString &ifn : ifns)
|
||||||
if (!iif.contains(ifn))
|
if (!iif.contains(ifn))
|
||||||
|
@ -99,10 +99,10 @@ public:
|
|||||||
class QMAKE_EXPORT ProValueMapStack : public QLinkedList<ProValueMap>
|
class QMAKE_EXPORT ProValueMapStack : public QLinkedList<ProValueMap>
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
inline void push(const ProValueMap &t) { append(t); }
|
inline void push(const ProValueMap &t) { push_back(t); }
|
||||||
inline ProValueMap pop() { return takeLast(); }
|
inline ProValueMap pop() { auto r = std::move(back()); pop_back(); return r; }
|
||||||
ProValueMap &top() { return last(); }
|
ProValueMap &top() { return back(); }
|
||||||
const ProValueMap &top() const { return last(); }
|
const ProValueMap &top() const { return back(); }
|
||||||
};
|
};
|
||||||
|
|
||||||
namespace QMakeInternal { struct QMakeBuiltin; }
|
namespace QMakeInternal { struct QMakeBuiltin; }
|
||||||
|
@ -143,15 +143,15 @@ ProString QMakeProject::expand(const QString &expr, const QString &where, int li
|
|||||||
|
|
||||||
bool QMakeProject::isEmpty(const ProKey &v) const
|
bool QMakeProject::isEmpty(const ProKey &v) const
|
||||||
{
|
{
|
||||||
ProValueMap::ConstIterator it = m_valuemapStack.first().constFind(v);
|
ProValueMap::ConstIterator it = m_valuemapStack.front().constFind(v);
|
||||||
return it == m_valuemapStack.first().constEnd() || it->isEmpty();
|
return it == m_valuemapStack.front().constEnd() || it->isEmpty();
|
||||||
}
|
}
|
||||||
|
|
||||||
void QMakeProject::dump() const
|
void QMakeProject::dump() const
|
||||||
{
|
{
|
||||||
QStringList out;
|
QStringList out;
|
||||||
for (ProValueMap::ConstIterator it = m_valuemapStack.first().begin();
|
for (ProValueMap::ConstIterator it = m_valuemapStack.front().begin();
|
||||||
it != m_valuemapStack.first().end(); ++it) {
|
it != m_valuemapStack.front().end(); ++it) {
|
||||||
if (!it.key().startsWith('.')) {
|
if (!it.key().startsWith('.')) {
|
||||||
QString str = it.key() + " =";
|
QString str = it.key() + " =";
|
||||||
for (const ProString &v : it.value())
|
for (const ProString &v : it.value())
|
||||||
|
@ -58,12 +58,12 @@ public:
|
|||||||
{ m_current.clear(); return evaluateConditional(QStringRef(&v), file, line) == ReturnTrue; }
|
{ m_current.clear(); return evaluateConditional(QStringRef(&v), file, line) == ReturnTrue; }
|
||||||
bool test(const ProKey &func, const QList<ProStringList> &args);
|
bool test(const ProKey &func, const QList<ProStringList> &args);
|
||||||
|
|
||||||
bool isSet(const ProKey &v) const { return m_valuemapStack.first().contains(v); }
|
bool isSet(const ProKey &v) const { return m_valuemapStack.front().contains(v); }
|
||||||
bool isEmpty(const ProKey &v) const;
|
bool isEmpty(const ProKey &v) const;
|
||||||
ProStringList &values(const ProKey &v) { return valuesRef(v); }
|
ProStringList &values(const ProKey &v) { return valuesRef(v); }
|
||||||
int intValue(const ProKey &v, int defaultValue = 0) const;
|
int intValue(const ProKey &v, int defaultValue = 0) const;
|
||||||
const ProValueMap &variables() const { return m_valuemapStack.first(); }
|
const ProValueMap &variables() const { return m_valuemapStack.front(); }
|
||||||
ProValueMap &variables() { return m_valuemapStack.first(); }
|
ProValueMap &variables() { return m_valuemapStack.front(); }
|
||||||
bool isActiveConfig(const QString &config, bool regex = false)
|
bool isActiveConfig(const QString &config, bool regex = false)
|
||||||
{ return QMakeEvaluator::isActiveConfig(QStringRef(&config), regex); }
|
{ return QMakeEvaluator::isActiveConfig(QStringRef(&config), regex); }
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user