aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorEike Ziller <eike.ziller@qt.io>2020-09-11 11:32:43 +0200
committerEike Ziller <eike.ziller@qt.io>2020-09-14 07:26:54 +0000
commit58d288b5234c18f98e39213810ac277c2571ccd7 (patch)
treeada2abfba1d32b02464f09b7ab2decc49f88829b
parent8d760eff8f5fd3f3b2c545706d55bba0ac16b729 (diff)
Proparser/QtSupport: Fix build with Qt6
Pulls in some QStringView related updates to proparser: f5d8ad61a4c85a656a7332c43d0c42f5eaf43593 "qmake: use new QString::arg(QStringView) overload" 52f3a7d9d40d3bf835bb0716ad201ee56731b980 "Build qmake with QT_USE_STRINGBUILDER" c49728eb27be0f3f2eaaa77b0ed573f5d8705af1 "Port qmake from QStringRef to QStringView" But do it in a way compatible with Qt5. Since some QStringView API is not available in Qt5 (see QTBUG-86516), this means using a StringView typedef that is either QStringRef (Qt5) or QStringView (Qt6) Task-number: QTCREATORBUG-24098 Change-Id: Ic9a73ca450543f3fdd5fcf9d686c4b773a48854c Reviewed-by: Christian Kandeler <christian.kandeler@qt.io> Reviewed-by: hjk <hjk@qt.io>
-rw-r--r--src/plugins/qtsupport/qtversionmanager.cpp4
-rw-r--r--src/shared/proparser/ioutils.cpp8
-rw-r--r--src/shared/proparser/ioutils.h4
-rw-r--r--src/shared/proparser/profileevaluator.cpp10
-rw-r--r--src/shared/proparser/proitems.cpp10
-rw-r--r--src/shared/proparser/proitems.h135
-rw-r--r--src/shared/proparser/prowriter.cpp2
-rw-r--r--src/shared/proparser/qmakebuiltins.cpp90
-rw-r--r--src/shared/proparser/qmakeevaluator.cpp24
-rw-r--r--src/shared/proparser/qmakeevaluator.h6
-rw-r--r--src/shared/proparser/qmakeevaluator_p.h2
-rw-r--r--src/shared/proparser/qmakeparser.cpp12
-rw-r--r--src/shared/proparser/qmakeparser.h6
13 files changed, 177 insertions, 136 deletions
diff --git a/src/plugins/qtsupport/qtversionmanager.cpp b/src/plugins/qtsupport/qtversionmanager.cpp
index 504a4961d22..289affee6b7 100644
--- a/src/plugins/qtsupport/qtversionmanager.cpp
+++ b/src/plugins/qtsupport/qtversionmanager.cpp
@@ -207,7 +207,7 @@ static bool restoreQtVersions()
if (!key.startsWith(keyPrefix))
continue;
bool ok;
- int count = key.midRef(keyPrefix.count()).toInt(&ok);
+ int count = key.mid(keyPrefix.count()).toInt(&ok);
if (!ok || count < 0)
continue;
@@ -281,7 +281,7 @@ void QtVersionManager::updateFromInstaller(bool emitSignal)
if (!key.startsWith(keyPrefix))
continue;
bool ok;
- int count = key.midRef(keyPrefix.count()).toInt(&ok);
+ int count = key.mid(keyPrefix.count()).toInt(&ok);
if (!ok || count < 0)
continue;
diff --git a/src/shared/proparser/ioutils.cpp b/src/shared/proparser/ioutils.cpp
index 63a40fc2d04..10d75817650 100644
--- a/src/shared/proparser/ioutils.cpp
+++ b/src/shared/proparser/ioutils.cpp
@@ -88,14 +88,14 @@ bool IoUtils::isRelativePath(const QString &path)
return true;
}
-QStringRef IoUtils::pathName(const QString &fileName)
+QStringView IoUtils::pathName(const QString &fileName)
{
- return fileName.leftRef(fileName.lastIndexOf(QLatin1Char('/')) + 1);
+ return QStringView{fileName}.left(fileName.lastIndexOf(QLatin1Char('/')) + 1);
}
-QStringRef IoUtils::fileName(const QString &fileName)
+QStringView IoUtils::fileName(const QString &fileName)
{
- return fileName.midRef(fileName.lastIndexOf(QLatin1Char('/')) + 1);
+ return QStringView(fileName).mid(fileName.lastIndexOf(QLatin1Char('/')) + 1);
}
QString IoUtils::resolvePath(const QString &baseDir, const QString &fileName)
diff --git a/src/shared/proparser/ioutils.h b/src/shared/proparser/ioutils.h
index 71a7ffed565..f9224b5c1d7 100644
--- a/src/shared/proparser/ioutils.h
+++ b/src/shared/proparser/ioutils.h
@@ -49,8 +49,8 @@ public:
static bool exists(const QString &fileName) { return fileType(fileName) != FileNotFound; }
static bool isRelativePath(const QString &fileName);
static bool isAbsolutePath(const QString &fileName) { return !isRelativePath(fileName); }
- static QStringRef pathName(const QString &fileName); // Requires normalized path
- static QStringRef fileName(const QString &fileName); // Requires normalized path
+ static QStringView pathName(const QString &fileName); // Requires normalized path
+ static QStringView fileName(const QString &fileName); // Requires normalized path
static QString resolvePath(const QString &baseDir, const QString &fileName);
static QString shellQuoteUnix(const QString &arg);
static QString shellQuoteWin(const QString &arg);
diff --git a/src/shared/proparser/profileevaluator.cpp b/src/shared/proparser/profileevaluator.cpp
index f6b2d3c5f31..131105b91f3 100644
--- a/src/shared/proparser/profileevaluator.cpp
+++ b/src/shared/proparser/profileevaluator.cpp
@@ -93,7 +93,7 @@ QVector<ProFileEvaluator::SourceFile> ProFileEvaluator::fixifiedValues(
if (IoUtils::exists(fn)) {
result << SourceFile{fn, str.sourceFile()};
} else {
- QStringRef fileNamePattern;
+ QStringView fileNamePattern;
if (expandWildcards) {
fileNamePattern = IoUtils::fileName(fn);
expandWildcards = fileNamePattern.contains('*')
@@ -215,7 +215,7 @@ ProFileEvaluator::TemplateType ProFileEvaluator::templateType() const
if (!t.compare(QLatin1String("app"), Qt::CaseInsensitive))
return TT_Application;
if (!t.compare(QLatin1String("lib"), Qt::CaseInsensitive))
- return d->isActiveConfig(QStringRef(&str_staticlib)) ? TT_StaticLibrary : TT_SharedLibrary;
+ return d->isActiveConfig(Utils::make_stringview(str_staticlib)) ? TT_StaticLibrary : TT_SharedLibrary;
if (!t.compare(QLatin1String("script"), Qt::CaseInsensitive))
return TT_Script;
if (!t.compare(QLatin1String("aux"), Qt::CaseInsensitive))
@@ -249,7 +249,7 @@ bool ProFileEvaluator::accept(ProFile *pro, QMakeEvaluator::LoadFlags flags)
ProStringList &incpath = d->valuesRef(ProKey("INCLUDEPATH"));
incpath += d->values(ProKey("QMAKE_INCDIR"));
- if (!d->isActiveConfig(QStringRef(&str_no_include_pwd))) {
+ if (!d->isActiveConfig(Utils::make_stringview(str_no_include_pwd))) {
incpath.prepend(ProString(pro->directoryName()));
// It's pretty stupid that this is appended - it should be the second entry.
if (pro->directoryName() != d->m_outputDir)
@@ -266,8 +266,8 @@ bool ProFileEvaluator::accept(ProFile *pro, QMakeEvaluator::LoadFlags flags)
break;
case TT_SharedLibrary:
{
- bool plugin = d->isActiveConfig(QStringRef(&str_plugin));
- if (!plugin || !d->isActiveConfig(QStringRef(&str_plugin_no_share_shlib_cflags)))
+ bool plugin = d->isActiveConfig(Utils::make_stringview(str_plugin));
+ if (!plugin || !d->isActiveConfig(Utils::make_stringview(str_plugin_no_share_shlib_cflags)))
cxxflags += d->values(ProKey("QMAKE_CXXFLAGS_SHLIB"));
if (plugin)
cxxflags += d->values(ProKey("QMAKE_CXXFLAGS_PLUGIN"));
diff --git a/src/shared/proparser/proitems.cpp b/src/shared/proparser/proitems.cpp
index 5d7f6ddb6f3..bfb5dc63b2c 100644
--- a/src/shared/proparser/proitems.cpp
+++ b/src/shared/proparser/proitems.cpp
@@ -66,8 +66,8 @@ ProString::ProString(const QString &str) :
{
}
-ProString::ProString(const QStringRef &str) :
- m_string(*str.string()), m_offset(str.position()), m_length(str.size()), m_file(0), m_hash(0x80000000)
+ProString::ProString(Utils::StringView str) :
+ m_string(str.toString()), m_offset(0), m_length(str.size()), m_file(0), m_hash(0x80000000)
{
}
@@ -333,7 +333,7 @@ ProString ProString::trimmed() const
QTextStream &operator<<(QTextStream &t, const ProString &str)
{
- t << str.toQStringRef();
+ t << str.toStringView();
return t;
}
@@ -458,10 +458,10 @@ bool ProStringList::contains(const ProString &str, Qt::CaseSensitivity cs) const
return false;
}
-bool ProStringList::contains(const QStringRef &str, Qt::CaseSensitivity cs) const
+bool ProStringList::contains(Utils::StringView str, Qt::CaseSensitivity cs) const
{
for (int i = 0; i < size(); i++)
- if (!at(i).toQStringRef().compare(str, cs))
+ if (!at(i).toStringView().compare(str, cs))
return true;
return false;
}
diff --git a/src/shared/proparser/proitems.h b/src/shared/proparser/proitems.h
index 7fbeb54f1cf..f9f0c88fff7 100644
--- a/src/shared/proparser/proitems.h
+++ b/src/shared/proparser/proitems.h
@@ -31,6 +31,8 @@
#include <qvector.h>
#include <qhash.h>
+#include <utils/porting.h>
+
QT_BEGIN_NAMESPACE
class QTextStream;
@@ -62,9 +64,17 @@ class ProFile;
class ProString {
public:
ProString();
- PROITEM_EXPLICIT ProString(const QString &str);
- PROITEM_EXPLICIT ProString(const QStringRef &str);
+ template<typename A, typename B>
+ ProString &operator=(const QStringBuilder<A, B> &str)
+ { return *this = QString(str); }
+ ProString(const QString &str);
+ PROITEM_EXPLICIT ProString(Utils::StringView str);
PROITEM_EXPLICIT ProString(const char *str);
+ template<typename A, typename B>
+ ProString(const QStringBuilder<A, B> &str)
+ : ProString(QString(str))
+ {}
+
ProString(const QString &str, int offset, int length);
void setValue(const QString &str);
void clear() { m_string.clear(); m_length = 0; }
@@ -75,12 +85,16 @@ public:
ProString &prepend(const ProString &other);
ProString &append(const ProString &other, bool *pending = 0);
ProString &append(const QString &other) { return append(ProString(other)); }
+ template<typename A, typename B>
+ ProString &append(const QStringBuilder<A, B> &other) { return append(QString(other)); }
ProString &append(const QLatin1String other);
ProString &append(const char *other) { return append(QLatin1String(other)); }
ProString &append(QChar other);
ProString &append(const ProStringList &other, bool *pending = 0, bool skipEmpty1st = false);
ProString &operator+=(const ProString &other) { return append(other); }
ProString &operator+=(const QString &other) { return append(other); }
+ template<typename A, typename B>
+ ProString &operator+=(const QStringBuilder<A, B> &other) { return append(QString(other)); }
ProString &operator+=(const QLatin1String other) { return append(other); }
ProString &operator+=(const char *other) { return append(other); }
ProString &operator+=(QChar other) { return append(other); }
@@ -88,16 +102,16 @@ public:
void chop(int n) { Q_ASSERT(n <= m_length); m_length -= n; }
void chopFront(int n) { Q_ASSERT(n <= m_length); m_offset += n; m_length -= n; }
- bool operator==(const ProString &other) const { return toQStringRef() == other.toQStringRef(); }
- bool operator==(const QString &other) const { return toQStringRef() == other; }
- bool operator==(const QStringRef &other) const { return toQStringRef() == other; }
- bool operator==(QLatin1String other) const { return toQStringRef() == other; }
- bool operator==(const char *other) const { return toQStringRef() == QLatin1String(other); }
+ bool operator==(const ProString &other) const { return toStringView() == other.toStringView(); }
+ bool operator==(const QString &other) const { return toStringView() == other; }
+ bool operator==(Utils::StringView other) const { return toStringView() == other; }
+ bool operator==(QLatin1String other) const { return toStringView() == other; }
+ bool operator==(const char *other) const { return toStringView() == QLatin1String(other); }
bool operator!=(const ProString &other) const { return !(*this == other); }
bool operator!=(const QString &other) const { return !(*this == other); }
bool operator!=(QLatin1String other) const { return !(*this == other); }
bool operator!=(const char *other) const { return !(*this == other); }
- bool operator<(const ProString &other) const { return toQStringRef() < other.toQStringRef(); }
+ bool operator<(const ProString &other) const { return toStringView() < other.toStringView(); }
bool isNull() const { return m_string.isNull(); }
bool isEmpty() const { return !m_length; }
int length() const { return m_length; }
@@ -108,34 +122,38 @@ public:
ProString left(int len) const { return mid(0, len); }
ProString right(int len) const { return mid(qMax(0, size() - len)); }
ProString trimmed() const;
- int compare(const ProString &sub, Qt::CaseSensitivity cs = Qt::CaseSensitive) const { return toQStringRef().compare(sub.toQStringRef(), cs); }
- int compare(const QString &sub, Qt::CaseSensitivity cs = Qt::CaseSensitive) const { return toQStringRef().compare(sub, cs); }
- int compare(const char *sub, Qt::CaseSensitivity cs = Qt::CaseSensitive) const { return toQStringRef().compare(QLatin1String(sub), cs); }
- bool startsWith(const ProString &sub, Qt::CaseSensitivity cs = Qt::CaseSensitive) const { return toQStringRef().startsWith(sub.toQStringRef(), cs); }
- bool startsWith(const QString &sub, Qt::CaseSensitivity cs = Qt::CaseSensitive) const { return toQStringRef().startsWith(sub, cs); }
- bool startsWith(const char *sub, Qt::CaseSensitivity cs = Qt::CaseSensitive) const { return toQStringRef().startsWith(QLatin1String(sub), cs); }
- bool startsWith(QChar c, Qt::CaseSensitivity cs = Qt::CaseSensitive) const { return toQStringRef().startsWith(c, cs); }
- bool endsWith(const ProString &sub, Qt::CaseSensitivity cs = Qt::CaseSensitive) const { return toQStringRef().endsWith(sub.toQStringRef(), cs); }
- bool endsWith(const QString &sub, Qt::CaseSensitivity cs = Qt::CaseSensitive) const { return toQStringRef().endsWith(sub, cs); }
- bool endsWith(const char *sub, Qt::CaseSensitivity cs = Qt::CaseSensitive) const { return toQStringRef().endsWith(QLatin1String(sub), cs); }
- bool endsWith(QChar c, Qt::CaseSensitivity cs = Qt::CaseSensitive) const { return toQStringRef().endsWith(c, cs); }
- int indexOf(const QString &s, int from = 0, Qt::CaseSensitivity cs = Qt::CaseSensitive) const { return toQStringRef().indexOf(s, from, cs); }
- int indexOf(const char *s, int from = 0, Qt::CaseSensitivity cs = Qt::CaseSensitive) const { return toQStringRef().indexOf(QLatin1String(s), from, cs); }
- int indexOf(QChar c, int from = 0, Qt::CaseSensitivity cs = Qt::CaseSensitive) const { return toQStringRef().indexOf(c, from, cs); }
- int lastIndexOf(const QString &s, int from = -1, Qt::CaseSensitivity cs = Qt::CaseSensitive) const { return toQStringRef().lastIndexOf(s, from, cs); }
- int lastIndexOf(const char *s, int from = -1, Qt::CaseSensitivity cs = Qt::CaseSensitive) const { return toQStringRef().lastIndexOf(QLatin1String(s), from, cs); }
- int lastIndexOf(QChar c, int from = -1, Qt::CaseSensitivity cs = Qt::CaseSensitive) const { return toQStringRef().lastIndexOf(c, from, cs); }
+ int compare(const ProString &sub, Qt::CaseSensitivity cs = Qt::CaseSensitive) const { return toStringView().compare(sub.toStringView(), cs); }
+ int compare(const QString &sub, Qt::CaseSensitivity cs = Qt::CaseSensitive) const { return toStringView().compare(sub, cs); }
+ int compare(const char *sub, Qt::CaseSensitivity cs = Qt::CaseSensitive) const { return toStringView().compare(QLatin1String(sub), cs); }
+ bool startsWith(const ProString &sub, Qt::CaseSensitivity cs = Qt::CaseSensitive) const { return toStringView().startsWith(sub.toStringView(), cs); }
+ bool startsWith(const QString &sub, Qt::CaseSensitivity cs = Qt::CaseSensitive) const { return toStringView().startsWith(sub, cs); }
+ bool startsWith(const char *sub, Qt::CaseSensitivity cs = Qt::CaseSensitive) const { return toStringView().startsWith(QLatin1String(sub), cs); }
+ bool startsWith(QChar c, Qt::CaseSensitivity cs = Qt::CaseSensitive) const { return toStringView().startsWith(c, cs); }
+ template<typename A, typename B>
+ bool startsWith(const QStringBuilder<A, B> &str) { return startsWith(QString(str)); }
+ bool endsWith(const ProString &sub, Qt::CaseSensitivity cs = Qt::CaseSensitive) const { return toStringView().endsWith(sub.toStringView(), cs); }
+ bool endsWith(const QString &sub, Qt::CaseSensitivity cs = Qt::CaseSensitive) const { return toStringView().endsWith(sub, cs); }
+ bool endsWith(const char *sub, Qt::CaseSensitivity cs = Qt::CaseSensitive) const { return toStringView().endsWith(QLatin1String(sub), cs); }
+ template<typename A, typename B>
+ bool endsWith(const QStringBuilder<A, B> &str) { return endsWith(QString(str)); }
+ bool endsWith(QChar c, Qt::CaseSensitivity cs = Qt::CaseSensitive) const { return toStringView().endsWith(c, cs); }
+ int indexOf(const QString &s, int from = 0, Qt::CaseSensitivity cs = Qt::CaseSensitive) const { return toStringView().indexOf(s, from, cs); }
+ int indexOf(const char *s, int from = 0, Qt::CaseSensitivity cs = Qt::CaseSensitive) const { return toStringView().indexOf(QLatin1String(s), from, cs); }
+ int indexOf(QChar c, int from = 0, Qt::CaseSensitivity cs = Qt::CaseSensitive) const { return toStringView().indexOf(c, from, cs); }
+ int lastIndexOf(const QString &s, int from = -1, Qt::CaseSensitivity cs = Qt::CaseSensitive) const { return toStringView().lastIndexOf(s, from, cs); }
+ int lastIndexOf(const char *s, int from = -1, Qt::CaseSensitivity cs = Qt::CaseSensitive) const { return toStringView().lastIndexOf(QLatin1String(s), from, cs); }
+ int lastIndexOf(QChar c, int from = -1, Qt::CaseSensitivity cs = Qt::CaseSensitive) const { return toStringView().lastIndexOf(c, from, cs); }
bool contains(const QString &s, Qt::CaseSensitivity cs = Qt::CaseSensitive) const { return indexOf(s, 0, cs) >= 0; }
bool contains(const char *s, Qt::CaseSensitivity cs = Qt::CaseSensitive) const { return indexOf(QLatin1String(s), 0, cs) >= 0; }
bool contains(QChar c, Qt::CaseSensitivity cs = Qt::CaseSensitive) const { return indexOf(c, 0, cs) >= 0; }
- int toLongLong(bool *ok = 0, int base = 10) const { return toQStringRef().toLongLong(ok, base); }
- int toInt(bool *ok = 0, int base = 10) const { return toQStringRef().toInt(ok, base); }
- short toShort(bool *ok = 0, int base = 10) const { return toQStringRef().toShort(ok, base); }
+ int toLongLong(bool *ok = 0, int base = 10) const { return toStringView().toLongLong(ok, base); }
+ int toInt(bool *ok = 0, int base = 10) const { return toStringView().toInt(ok, base); }
+ short toShort(bool *ok = 0, int base = 10) const { return toStringView().toShort(ok, base); }
uint hash() const { return m_hash; }
static uint hash(const QChar *p, int n);
- ALWAYS_INLINE QStringRef toQStringRef() const { return QStringRef(&m_string, m_offset, m_length); }
+ ALWAYS_INLINE Utils::StringView toStringView() const { return Utils::make_stringview(m_string).mid(m_offset, m_length); }
ALWAYS_INLINE ProKey &toKey() { return *(ProKey *)this; }
ALWAYS_INLINE const ProKey &toKey() const { return *(const ProKey *)this; }
@@ -143,7 +161,7 @@ public:
QString toQString() const;
QString &toQString(QString &tmp) const;
- QByteArray toLatin1() const { return toQStringRef().toLatin1(); }
+ QByteArray toLatin1() const { return toStringView().toLatin1(); }
private:
ProString(const ProKey &other);
@@ -174,6 +192,11 @@ class ProKey : public ProString {
public:
ALWAYS_INLINE ProKey() : ProString() {}
explicit ProKey(const QString &str);
+ template<typename A, typename B>
+ ProKey(const QStringBuilder<A, B> &str)
+ : ProString(str)
+ {}
+
PROITEM_EXPLICIT ProKey(const char *str);
ProKey(const QString &str, int off, int len);
ProKey(const QString &str, int off, int len, uint hash);
@@ -197,27 +220,43 @@ private:
};
Q_DECLARE_TYPEINFO(ProKey, Q_MOVABLE_TYPE);
-uint qHash(const ProString &str);
-QString operator+(const ProString &one, const ProString &two);
-inline QString operator+(const ProString &one, const QString &two)
- { return one.toQStringRef() + two; }
-inline QString operator+(const QString &one, const ProString &two)
- { return one + two.toQStringRef(); }
+template <> struct QConcatenable<ProString> : private QAbstractConcatenable
+{
+ typedef ProString type;
+ typedef QString ConvertTo;
+ enum { ExactSize = true };
+ static int size(const ProString &a) { return a.length(); }
+ static inline void appendTo(const ProString &a, QChar *&out)
+ {
+ const auto n = a.size();
+ memcpy(out, a.toStringView().data(), sizeof(QChar) * n);
+ out += n;
+ }
+};
-inline QString operator+(const ProString &one, const char *two)
- { return one.toQStringRef() + QLatin1String(two); }
-inline QString operator+(const char *one, const ProString &two)
- { return QLatin1String(one) + two.toQStringRef(); }
+template <> struct QConcatenable<ProKey> : private QAbstractConcatenable
+{
+ typedef ProKey type;
+ typedef QString ConvertTo;
+ enum { ExactSize = true };
+ static int size(const ProKey &a) { return a.length(); }
+ static inline void appendTo(const ProKey &a, QChar *&out)
+ {
+ const auto n = a.size();
+ memcpy(out, a.toStringView().data(), sizeof(QChar) * n);
+ out += n;
+ }
+};
-inline QString &operator+=(QString &that, const ProString &other)
- { return that += other.toQStringRef(); }
-inline bool operator==(const QString &that, const ProString &other)
- { return other == that; }
-inline bool operator!=(const QString &that, const ProString &other)
- { return !(other == that); }
+uint qHash(const ProString &str);
+
+inline QString &operator+=(QString &that, const ProString &other)
+ { return that += other.toStringView(); }
QTextStream &operator<<(QTextStream &t, const ProString &str);
+template<typename A, typename B>
+QTextStream &operator<<(QTextStream &t, const QStringBuilder<A, B> &str) { return t << QString(str); }
class ProStringList : public QVector<ProString> {
public:
@@ -234,6 +273,8 @@ public:
QString join(const ProString &sep) const;
QString join(const QString &sep) const;
QString join(QChar sep) const;
+ template<typename A, typename B>
+ QString join(const QStringBuilder<A, B> &str) { return join(QString(str)); }
void insertUnique(const ProStringList &value);
@@ -245,7 +286,7 @@ public:
void removeDuplicates();
bool contains(const ProString &str, Qt::CaseSensitivity cs = Qt::CaseSensitive) const;
- bool contains(const QStringRef &str, Qt::CaseSensitivity cs = Qt::CaseSensitive) const;
+ bool contains(Utils::StringView str, Qt::CaseSensitivity cs = Qt::CaseSensitive) const;
bool contains(const QString &str, Qt::CaseSensitivity cs = Qt::CaseSensitive) const
{ return contains(ProString(str), cs); }
bool contains(const char *str, Qt::CaseSensitivity cs = Qt::CaseSensitive) const;
diff --git a/src/shared/proparser/prowriter.cpp b/src/shared/proparser/prowriter.cpp
index 557bef4371c..5940142b2b2 100644
--- a/src/shared/proparser/prowriter.cpp
+++ b/src/shared/proparser/prowriter.cpp
@@ -181,7 +181,7 @@ QString ProWriter::compileScope(const QString &scope)
if (scope.isEmpty())
return QString();
QMakeParser parser(nullptr, nullptr, nullptr);
- ProFile *includeFile = parser.parsedProBlock(QStringRef(&scope), 0, "no-file", 1);
+ ProFile *includeFile = parser.parsedProBlock(Utils::make_stringview(scope), 0, "no-file", 1);
if (!includeFile)
return QString();
const QString result = includeFile->items();
diff --git a/src/shared/proparser/qmakebuiltins.cpp b/src/shared/proparser/qmakebuiltins.cpp
index bdd6ab6a6c8..09d7d9509b4 100644
--- a/src/shared/proparser/qmakebuiltins.cpp
+++ b/src/shared/proparser/qmakebuiltins.cpp
@@ -572,7 +572,7 @@ QMakeEvaluator::VisitReturn QMakeEvaluator::evaluateBuiltinExpand(
}
} else {
if (args.count() != 1) {
- evalError(fL1S("%1(var) requires one argument.").arg(func.toQString(m_tmp1)));
+ evalError(fL1S("%1(var) requires one argument.").arg(func.toStringView()));
} else {
var = args[0];
regexp = true;
@@ -610,7 +610,7 @@ QMakeEvaluator::VisitReturn QMakeEvaluator::evaluateBuiltinExpand(
} else {
QString tmp = args.at(0).toQString(m_tmp1);
for (int i = 1; i < args.count(); ++i)
- tmp = tmp.arg(args.at(i).toQString(m_tmp2));
+ tmp = tmp.arg(args.at(i).toStringView());
ret << (tmp.isSharedWith(m_tmp1) ? args.at(0) : ProString(tmp).setSource(args.at(0)));
}
break;
@@ -625,22 +625,22 @@ QMakeEvaluator::VisitReturn QMakeEvaluator::evaluateBuiltinExpand(
bool leftalign = false;
enum { DefaultSign, PadSign, AlwaysSign } sign = DefaultSign;
if (args.count() >= 2) {
- const auto opts = split_value_list(args.at(1).toQStringRef());
+ const auto opts = split_value_list(args.at(1).toStringView());
for (const ProString &opt : opts) {
- opt.toQString(m_tmp3);
- if (m_tmp3.startsWith(QLatin1String("ibase="))) {
- ibase = m_tmp3.midRef(6).toInt();
- } else if (m_tmp3.startsWith(QLatin1String("obase="))) {
- obase = m_tmp3.midRef(6).toInt();
- } else if (m_tmp3.startsWith(QLatin1String("width="))) {
- width = m_tmp3.midRef(6).toInt();
- } else if (m_tmp3 == QLatin1String("zeropad")) {
+ auto sw = opt.toStringView();
+ if (sw.startsWith(QLatin1String("ibase="))) {
+ ibase = sw.mid(6).toInt();
+ } else if (sw.startsWith(QLatin1String("obase="))) {
+ obase = sw.mid(6).toInt();
+ } else if (sw.startsWith(QLatin1String("width="))) {
+ width = sw.mid(6).toInt();
+ } else if (sw == QLatin1String("zeropad")) {
zeropad = true;
- } else if (m_tmp3 == QLatin1String("padsign")) {
+ } else if (sw == QLatin1String("padsign")) {
sign = PadSign;
- } else if (m_tmp3 == QLatin1String("alwayssign")) {
+ } else if (sw == QLatin1String("alwayssign")) {
sign = AlwaysSign;
- } else if (m_tmp3 == QLatin1String("leftalign")) {
+ } else if (sw == QLatin1String("leftalign")) {
leftalign = true;
} else {
evalError(fL1S("format_number(): invalid format option %1.").arg(m_tmp3));
@@ -699,7 +699,7 @@ QMakeEvaluator::VisitReturn QMakeEvaluator::evaluateBuiltinExpand(
qlonglong num = arg.toLongLong(&ok);
if (!ok) {
evalError(fL1S("num_add(): malformed number %1.")
- .arg(arg.toQString(m_tmp3)));
+ .arg(arg.toStringView()));
goto nafail;
}
sum += num;
@@ -739,7 +739,7 @@ QMakeEvaluator::VisitReturn QMakeEvaluator::evaluateBuiltinExpand(
const QString &sep = (args.count() == 2) ? args.at(1).toQString(m_tmp1) : statics.field_sep;
const auto vars = values(map(args.at(0)));
for (const ProString &var : vars) {
- const auto splits = var.toQStringRef().split(sep);
+ const auto splits = var.toStringView().split(sep);
for (const auto &splt : splits)
ret << ProString(splt).setSource(var);
}
@@ -786,7 +786,7 @@ QMakeEvaluator::VisitReturn QMakeEvaluator::evaluateBuiltinExpand(
case E_FIRST:
case E_LAST:
if (args.count() != 1) {
- evalError(fL1S("%1(var) requires one argument.").arg(func.toQString(m_tmp1)));
+ evalError(fL1S("%1(var) requires one argument.").arg(func.toStringView()));
} else {
const ProStringList &var = values(map(args.at(0)));
if (!var.isEmpty()) {
@@ -800,7 +800,7 @@ QMakeEvaluator::VisitReturn QMakeEvaluator::evaluateBuiltinExpand(
case E_TAKE_FIRST:
case E_TAKE_LAST:
if (args.count() != 1) {
- evalError(fL1S("%1(var) requires one argument.").arg(func.toQString(m_tmp1)));
+ evalError(fL1S("%1(var) requires one argument.").arg(func.toStringView()));
} else {
ProStringList &var = valuesRef(map(args.at(0)));
if (!var.isEmpty()) {
@@ -854,7 +854,7 @@ QMakeEvaluator::VisitReturn QMakeEvaluator::evaluateBuiltinExpand(
ret += ProString(stream.readLine());
} else {
const QString &line = stream.readLine();
- ret += split_value_list(QStringRef(&line).trimmed());
+ ret += split_value_list(Utils::make_stringview(line).trimmed());
if (!singleLine)
ret += ProString("\n");
}
@@ -885,7 +885,7 @@ QMakeEvaluator::VisitReturn QMakeEvaluator::evaluateBuiltinExpand(
ret = ProStringList(ProString(tmp));
ProStringList lst;
for (const ProString &arg : args)
- lst += split_value_list(arg.toQStringRef(), arg.sourceFile()); // Relies on deep copy
+ lst += split_value_list(arg.toStringView(), arg.sourceFile()); // Relies on deep copy
m_valuemapStack.top()[ret.at(0).toKey()] = lst;
break; }
case E_FIND:
@@ -939,7 +939,7 @@ QMakeEvaluator::VisitReturn QMakeEvaluator::evaluateBuiltinExpand(
output.replace(QLatin1Char('\t'), QLatin1Char(' '));
if (singleLine)
output.replace(QLatin1Char('\n'), QLatin1Char(' '));
- ret += split_value_list(QStringRef(&output));
+ ret += split_value_list(Utils::make_stringview(output));
}
}
}
@@ -1112,7 +1112,7 @@ QMakeEvaluator::VisitReturn QMakeEvaluator::evaluateBuiltinExpand(
evalError(fL1S("Unexpected EOF."));
return ReturnError;
}
- ret = split_value_list(QStringRef(&line));
+ ret = split_value_list(QStringView(line));
}
}
break; }
@@ -1144,7 +1144,7 @@ QMakeEvaluator::VisitReturn QMakeEvaluator::evaluateBuiltinExpand(
case E_RESOLVE_DEPENDS:
if (args.count() < 1 || args.count() > 4) {
evalError(fL1S("%1(var, [prefix, [suffixes, [prio-suffix]]]) requires one to four arguments.")
- .arg(func.toQString(m_tmp1)));
+ .arg(func.toStringView()));
} else {
QHash<ProKey, QSet<ProKey> > dependencies;
ProValueMap dependees;
@@ -1154,7 +1154,7 @@ QMakeEvaluator::VisitReturn 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).toQStringRef()),
+ : split_value_list(args.at(2).toStringView()),
priosfx, dependencies, dependees, rootSet);
while (!rootSet.isEmpty()) {
QMultiMap<int, ProString>::iterator it = rootSet.begin();
@@ -1321,7 +1321,7 @@ QMakeEvaluator::VisitReturn QMakeEvaluator::evaluateBuiltinExpand(
break;
#endif
default:
- evalError(fL1S("Function '%1' is not implemented.").arg(func.toQString(m_tmp1)));
+ evalError(fL1S("Function '%1' is not implemented.").arg(func.toStringView()));
break;
}
@@ -1352,7 +1352,7 @@ QMakeEvaluator::VisitReturn QMakeEvaluator::evaluateBuiltinConditional(
return returnBool(findValues(var, &it));
}
evalError(fL1S("defined(function, type): unexpected type [%1].")
- .arg(args.at(1).toQString(m_tmp1)));
+ .arg(args.at(1).toStringView()));
return ReturnFalse;
}
return returnBool(m_functionDefs.replaceFunctions.contains(var)
@@ -1469,7 +1469,7 @@ QMakeEvaluator::VisitReturn QMakeEvaluator::evaluateBuiltinConditional(
case T_EVAL: {
VisitReturn ret = ReturnFalse;
QString contents = args.join(statics.field_sep);
- ProFile *pro = m_parser->parsedProBlock(QStringRef(&contents),
+ ProFile *pro = m_parser->parsedProBlock(Utils::make_stringview(contents),
0, m_current.pro->fileName(), m_current.line);
if (m_cumulative || pro->isOk()) {
m_locationStack.push(m_current);
@@ -1485,7 +1485,7 @@ QMakeEvaluator::VisitReturn QMakeEvaluator::evaluateBuiltinConditional(
evalError(fL1S("if(condition) requires one argument."));
return ReturnFalse;
}
- return evaluateConditional(args.at(0).toQStringRef(),
+ return evaluateConditional(args.at(0).toStringView(),
m_current.pro->fileName(), m_current.line);
}
case T_CONFIG: {
@@ -1494,13 +1494,13 @@ QMakeEvaluator::VisitReturn QMakeEvaluator::evaluateBuiltinConditional(
return ReturnFalse;
}
if (args.count() == 1)
- return returnBool(isActiveConfig(args.at(0).toQStringRef()));
- const auto mutuals = args.at(1).toQStringRef().split(QLatin1Char('|'));
+ return returnBool(isActiveConfig(args.at(0).toStringView()));
+ const auto mutuals = args.at(1).toStringView().split(QLatin1Char('|'));
const ProStringList &configs = values(statics.strCONFIG);
for (int i = configs.size() - 1; i >= 0; i--) {
for (int mut = 0; mut < mutuals.count(); mut++) {
- if (configs[i].toQStringRef() == mutuals[mut].trimmed())
+ if (configs[i].toStringView() == mutuals[mut].trimmed())
return returnBool(configs[i] == args[0]);
}
}
@@ -1532,11 +1532,11 @@ QMakeEvaluator::VisitReturn QMakeEvaluator::evaluateBuiltinConditional(
return ReturnTrue;
}
} else {
- const auto mutuals = args.at(2).toQStringRef().split(QLatin1Char('|'));
+ const auto mutuals = args.at(2).toStringView().split(QLatin1Char('|'));
for (int i = l.size() - 1; i >= 0; i--) {
const ProString val = l[i];
for (int mut = 0; mut < mutuals.count(); mut++) {
- if (val.toQStringRef() == mutuals[mut].trimmed()) {
+ if (val.toStringView() == mutuals[mut].trimmed()) {
return returnBool((!regx.pattern().isEmpty()
&& regx.match(val.toQString(m_tmp[m_toggle ^= 1])).hasMatch())
|| val == qry);
@@ -1567,7 +1567,7 @@ QMakeEvaluator::VisitReturn QMakeEvaluator::evaluateBuiltinConditional(
|| comp == QLatin1String("=") || comp == QLatin1String("==")) {
// fallthrough
} else {
- evalError(fL1S("Unexpected modifier to count(%2).").arg(comp.toQString(m_tmp1)));
+ evalError(fL1S("Unexpected modifier to count(%2).").arg(comp.toStringView()));
return ReturnFalse;
}
}
@@ -1577,7 +1577,7 @@ QMakeEvaluator::VisitReturn QMakeEvaluator::evaluateBuiltinConditional(
case T_LESSTHAN: {
if (args.count() != 2) {
evalError(fL1S("%1(variable, value) requires two arguments.")
- .arg(function.toQString(m_tmp1)));
+ .arg(function.toStringView()));
return ReturnFalse;
}
const QString &rhs(args.at(1).toQString(m_tmp1)),
@@ -1599,16 +1599,16 @@ QMakeEvaluator::VisitReturn QMakeEvaluator::evaluateBuiltinConditional(
case T_EQUALS:
if (args.count() != 2) {
evalError(fL1S("%1(variable, value) requires two arguments.")
- .arg(function.toQString(m_tmp1)));
+ .arg(function.toStringView()));
return ReturnFalse;
}
return returnBool(values(map(args.at(0))).join(statics.field_sep)
- == args.at(1).toQStringRef());
+ == args.at(1).toStringView());
case T_VERSION_AT_LEAST:
case T_VERSION_AT_MOST: {
if (args.count() != 2) {
evalError(fL1S("%1(variable, versionNumber) requires two arguments.")
- .arg(function.toQString(m_tmp1)));
+ .arg(function.toStringView()));
return ReturnFalse;
}
const QVersionNumber lvn = QVersionNumber::fromString(values(args.at(0).toKey()).join('.'));
@@ -1620,7 +1620,7 @@ QMakeEvaluator::VisitReturn QMakeEvaluator::evaluateBuiltinConditional(
case T_CLEAR: {
if (args.count() != 1) {
evalError(fL1S("%1(variable) requires one argument.")
- .arg(function.toQString(m_tmp1)));
+ .arg(function.toStringView()));
return ReturnFalse;
}
ProValueMap *hsh;
@@ -1637,7 +1637,7 @@ QMakeEvaluator::VisitReturn QMakeEvaluator::evaluateBuiltinConditional(
case T_UNSET: {
if (args.count() != 1) {
evalError(fL1S("%1(variable) requires one argument.")
- .arg(function.toQString(m_tmp1)));
+ .arg(function.toStringView()));
return ReturnFalse;
}
ProValueMap *hsh;
@@ -1743,7 +1743,7 @@ QMakeEvaluator::VisitReturn QMakeEvaluator::evaluateBuiltinConditional(
case T_MESSAGE: {
if (args.count() != 1) {
evalError(fL1S("%1(message) requires one argument.")
- .arg(function.toQString(m_tmp1)));
+ .arg(function.toStringView()));
return ReturnFalse;
}
const QString &msg = m_option->expandEnvVars(args.at(0).toQString(m_tmp2));
@@ -1845,7 +1845,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).toQStringRef());
+ const auto opts = split_value_list(args.at(2).toStringView());
for (const ProString &opt : opts) {
if (opt == QLatin1String("append")) {
mode = QIODevice::Append;
@@ -1888,7 +1888,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).toQStringRef());
+ const auto opts = split_value_list(args.at(1).toStringView());
for (const ProString &opt : opts) {
if (opt == QLatin1String("transient")) {
persist = false;
@@ -1921,7 +1921,7 @@ QMakeEvaluator::VisitReturn QMakeEvaluator::evaluateBuiltinConditional(
srcvar = dstvar;
ProValueMap::Iterator srcvarIt;
if (!findValues(srcvar, &srcvarIt)) {
- evalError(fL1S("Variable %1 is not defined.").arg(srcvar.toQString(m_tmp1)));
+ evalError(fL1S("Variable %1 is not defined.").arg(srcvar.toStringView()));
return ReturnFalse;
}
// The caches for the host and target may differ (e.g., when we are manipulating
@@ -2051,7 +2051,7 @@ QMakeEvaluator::VisitReturn QMakeEvaluator::evaluateBuiltinConditional(
#endif
return ReturnTrue;
default:
- evalError(fL1S("Function '%1' is not implemented.").arg(function.toQString(m_tmp1)));
+ evalError(fL1S("Function '%1' is not implemented.").arg(function.toStringView()));
return ReturnFalse;
}
}
diff --git a/src/shared/proparser/qmakeevaluator.cpp b/src/shared/proparser/qmakeevaluator.cpp
index b674ad3e4c2..ff87a1b8f40 100644
--- a/src/shared/proparser/qmakeevaluator.cpp
+++ b/src/shared/proparser/qmakeevaluator.cpp
@@ -269,7 +269,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 QStringRef &vals, int source)
+ProStringList QMakeEvaluator::split_value_list(Utils::StringView vals, int source)
{
QString build;
ProStringList ret;
@@ -648,7 +648,7 @@ QMakeEvaluator::VisitReturn QMakeEvaluator::visitProBlock(
evalError(fL1S("Conditional must expand to exactly one word."));
okey = false;
} else {
- okey = isActiveConfig(curr.at(0).toQStringRef(), true);
+ okey = isActiveConfig(curr.at(0).toStringView(), true);
traceMsg("condition %s is %s", dbgStr(curr.at(0)), dbgBool(okey));
okey ^= invert;
}
@@ -775,7 +775,7 @@ QMakeEvaluator::VisitReturn QMakeEvaluator::visitProLoop(
}
infinite = true;
} else {
- const QStringRef &itl = it_list.toQStringRef();
+ auto itl = it_list.toStringView();
int dotdot = itl.indexOf(statics.strDotDot);
if (dotdot != -1) {
bool ok;
@@ -872,7 +872,7 @@ QMakeEvaluator::VisitReturn QMakeEvaluator::visitProVariable(
ProStringList varVal;
if (expandVariableReferences(tokPtr, sizeHint, &varVal, true) == ReturnError)
return ReturnError;
- const QStringRef &val = varVal.at(0).toQStringRef();
+ auto val = varVal.at(0).toStringView();
if (val.length() < 4 || val.at(0) != QLatin1Char('s')) {
evalError(fL1S("The ~= operator can handle only the s/// function."));
return ReturnTrue;
@@ -1310,7 +1310,7 @@ void QMakeEvaluator::setupProject()
void QMakeEvaluator::evaluateCommand(const QString &cmds, const QString &where)
{
if (!cmds.isEmpty()) {
- ProFile *pro = m_parser->parsedProBlock(QStringRef(&cmds), 0, where, -1);
+ ProFile *pro = m_parser->parsedProBlock(Utils::make_stringview(cmds), 0, where, -1);
if (pro->isOk()) {
m_locationStack.push(m_current);
visitProBlock(pro, pro->tokPtr());
@@ -1583,7 +1583,7 @@ ProString QMakeEvaluator::propertyValue(const ProKey &name) const
return ProString(m_mkspecPaths.join(m_option->dirlist_sep));
ProString ret = m_option->propertyValue(name);
// if (ret.isNull())
-// evalError(fL1S("Querying unknown property %1").arg(name.toQString(m_mtmp)));
+// evalError(fL1S("Querying unknown property %1").arg(name.toStringView()));
return ret;
}
@@ -1618,7 +1618,7 @@ QString QMakeEvaluator::currentDirectory() const
return QString();
}
-bool QMakeEvaluator::isActiveConfig(const QStringRef &config, bool regex)
+bool QMakeEvaluator::isActiveConfig(Utils::StringView config, bool regex)
{
// magic types for easy flipping
if (config == statics.strtrue)
@@ -1781,7 +1781,7 @@ QMakeEvaluator::VisitReturn QMakeEvaluator::evaluateConditionalFunction(
}
skipExpression(tokPtr);
- evalError(fL1S("'%1' is not a recognized test function.").arg(func.toQString(m_tmp1)));
+ evalError(fL1S("'%1' is not a recognized test function.").arg(func.toStringView()));
return ReturnFalse;
}
@@ -1807,12 +1807,12 @@ QMakeEvaluator::VisitReturn QMakeEvaluator::evaluateExpandFunction(
}
skipExpression(tokPtr);
- evalError(fL1S("'%1' is not a recognized replace function.").arg(func.toQString(m_tmp1)));
+ evalError(fL1S("'%1' is not a recognized replace function.").arg(func.toStringView()));
return ReturnFalse;
}
QMakeEvaluator::VisitReturn QMakeEvaluator::evaluateConditional(
- const QStringRef &cond, const QString &where, int line)
+ Utils::StringView cond, const QString &where, int line)
{
VisitReturn ret = ReturnFalse;
ProFile *pro = m_parser->parsedProBlock(cond, 0, where, line, QMakeParser::TestGrammar);
@@ -1830,7 +1830,7 @@ QMakeEvaluator::VisitReturn QMakeEvaluator::checkRequirements(const ProStringLis
{
ProStringList &failed = valuesRef(ProKey("QMAKE_FAILED_REQUIREMENTS"));
for (const ProString &dep : deps) {
- VisitReturn vr = evaluateConditional(dep.toQStringRef(), m_current.pro->fileName(), m_current.line);
+ VisitReturn vr = evaluateConditional(dep.toStringView(), m_current.pro->fileName(), m_current.line);
if (vr == ReturnError)
return ReturnError;
if (vr != ReturnTrue)
@@ -1996,7 +1996,7 @@ QMakeEvaluator::VisitReturn QMakeEvaluator::evaluateFeatureFile(
int start_root = 0;
const QStringList &paths = m_featureRoots->paths;
if (!currFn.isEmpty()) {
- QStringRef currPath = IoUtils::pathName(currFn);
+ auto currPath = IoUtils::pathName(currFn);
for (int root = 0; root < paths.size(); ++root)
if (currPath == paths.at(root)) {
start_root = root + 1;
diff --git a/src/shared/proparser/qmakeevaluator.h b/src/shared/proparser/qmakeevaluator.h
index 284acc54fdb..db051f8d87f 100644
--- a/src/shared/proparser/qmakeevaluator.h
+++ b/src/shared/proparser/qmakeevaluator.h
@@ -174,7 +174,7 @@ public:
void setTemplate();
- ProStringList split_value_list(const QStringRef &vals, int source = 0);
+ ProStringList split_value_list(Utils::StringView vals, int source = 0);
VisitReturn expandVariableReferences(const ushort *&tokPtr, int sizeHint, ProStringList *ret, bool joined);
QString currentFileName() const;
@@ -214,7 +214,7 @@ public:
VisitReturn evaluateBuiltinExpand(int func_t, const ProKey &function, const ProStringList &args, ProStringList &ret);
VisitReturn evaluateBuiltinConditional(int func_t, const ProKey &function, const ProStringList &args);
- VisitReturn evaluateConditional(const QStringRef &cond, const QString &where, int line = -1);
+ VisitReturn evaluateConditional(Utils::StringView cond, const QString &where, int line = -1);
#ifdef PROEVALUATOR_FULL
VisitReturn checkRequirements(const ProStringList &deps);
#endif
@@ -222,7 +222,7 @@ public:
void updateMkspecPaths();
void updateFeaturePaths();
- bool isActiveConfig(const QStringRef &config, bool regex = false);
+ bool isActiveConfig(Utils::StringView config, bool regex = false);
void populateDeps(
const ProStringList &deps, const ProString &prefix, const ProStringList &suffixes,
diff --git a/src/shared/proparser/qmakeevaluator_p.h b/src/shared/proparser/qmakeevaluator_p.h
index f8c5573060a..ee268520a0c 100644
--- a/src/shared/proparser/qmakeevaluator_p.h
+++ b/src/shared/proparser/qmakeevaluator_p.h
@@ -37,7 +37,7 @@
r == ReturnNext ? "next" : \
r == ReturnReturn ? "return" : \
"<invalid>")
-# define dbgKey(s) s.toString().toQStringRef().toLocal8Bit().constData()
+# define dbgKey(s) s.toString().toQStringView().toLocal8Bit().constData()
# define dbgStr(s) qPrintable(formatValue(s, true))
# define dbgStrList(s) qPrintable(formatValueList(s))
# define dbgSepStrList(s) qPrintable(formatValueList(s, true))
diff --git a/src/shared/proparser/qmakeparser.cpp b/src/shared/proparser/qmakeparser.cpp
index 1d72f72f164..f42d2181477 100644
--- a/src/shared/proparser/qmakeparser.cpp
+++ b/src/shared/proparser/qmakeparser.cpp
@@ -214,7 +214,7 @@ ProFile *QMakeParser::parsedProFile(const QString &fileName, ParseFlags flags)
#endif
QString contents;
if (readFile(id, flags, &contents)) {
- pro = parsedProBlock(QStringRef(&contents), id, fileName, 1, FullGrammar);
+ pro = parsedProBlock(Utils::make_stringview(contents), id, fileName, 1, FullGrammar);
pro->itemsRef()->squeeze();
pro->ref();
} else {
@@ -235,7 +235,7 @@ ProFile *QMakeParser::parsedProFile(const QString &fileName, ParseFlags flags)
} else {
QString contents;
if (readFile(id, flags, &contents))
- pro = parsedProBlock(QStringRef(&contents), id, fileName, 1, FullGrammar);
+ pro = parsedProBlock(Utils::make_stringview(contents), id, fileName, 1, FullGrammar);
else
pro = 0;
}
@@ -243,7 +243,7 @@ ProFile *QMakeParser::parsedProFile(const QString &fileName, ParseFlags flags)
}
ProFile *QMakeParser::parsedProBlock(
- const QStringRef &contents, int id, const QString &name, int line, SubGrammar grammar)
+ Utils::StringView contents, int id, const QString &name, int line, SubGrammar grammar)
{
ProFile *pro = new ProFile(id, name);
read(pro, contents, line, grammar);
@@ -307,7 +307,7 @@ void QMakeParser::finalizeHashStr(ushort *buf, uint len)
buf[-2] = (ushort)(hash >> 16);
}
-void QMakeParser::read(ProFile *pro, const QStringRef &in, int line, SubGrammar grammar)
+void QMakeParser::read(ProFile *pro, Utils::StringView in, int line, SubGrammar grammar)
{
m_proFile = pro;
m_lineNo = line;
@@ -355,7 +355,7 @@ void QMakeParser::read(ProFile *pro, const QStringRef &in, int line, SubGrammar
QStack<ParseCtx> xprStack;
xprStack.reserve(10);
- const ushort *cur = (const ushort *)in.unicode();
+ const ushort *cur = (const ushort *)in.data();
const ushort *inend = cur + in.length();
m_canElse = false;
freshLine:
@@ -1257,7 +1257,7 @@ void QMakeParser::finalizeCall(ushort *&tokPtr, ushort *uc, ushort *ptr, int arg
bool QMakeParser::resolveVariable(ushort *xprPtr, int tlen, int needSep, ushort **ptr,
ushort **buf, QString *xprBuff,
ushort **tokPtr, QString *tokBuff,
- const ushort *cur, const QStringRef &in)
+ const ushort *cur, Utils::StringView in)
{
QString out;
m_tmp.setRawData((const QChar *)xprPtr, tlen);
diff --git a/src/shared/proparser/qmakeparser.h b/src/shared/proparser/qmakeparser.h
index ab765c5d9bd..905b50608bd 100644
--- a/src/shared/proparser/qmakeparser.h
+++ b/src/shared/proparser/qmakeparser.h
@@ -89,7 +89,7 @@ public:
enum SubGrammar { FullGrammar, TestGrammar, ValueGrammar };
// fileName is expected to be absolute and cleanPath()ed.
ProFile *parsedProFile(const QString &fileName, ParseFlags flags = ParseDefault);
- ProFile *parsedProBlock(const QStringRef &contents, int id, const QString &name, int line = 0,
+ ProFile *parsedProBlock(Utils::StringView contents, int id, const QString &name, int line = 0,
SubGrammar grammar = FullGrammar);
void discardFileFromCache(int id);
@@ -131,7 +131,7 @@ private:
};
bool readFile(int id, QMakeParser::ParseFlags flags, QString *contents);
- void read(ProFile *pro, const QStringRef &content, int line, SubGrammar grammar);
+ void read(ProFile *pro, Utils::StringView content, int line, SubGrammar grammar);
ALWAYS_INLINE void putTok(ushort *&tokPtr, ushort tok);
ALWAYS_INLINE void putBlockLen(ushort *&tokPtr, uint len);
@@ -142,7 +142,7 @@ private:
ALWAYS_INLINE bool resolveVariable(ushort *xprPtr, int tlen, int needSep, ushort **ptr,
ushort **buf, QString *xprBuff,
ushort **tokPtr, QString *tokBuff,
- const ushort *cur, const QStringRef &in);
+ const ushort *cur, Utils::StringView in);
void finalizeCond(ushort *&tokPtr, ushort *uc, ushort *ptr, int wordCount);
void finalizeCall(ushort *&tokPtr, ushort *uc, ushort *ptr, int argc);
void warnOperator(const char *msg);