Do not pass QStringView by const reference

That's what the documentation says:

  https://doc.qt.io/qt-6/qstringview.html#details

Change-Id: I0b41fc4abad1601c0ed416a505534cf7ae7633e1
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Eike Ziller <eike.ziller@qt.io>
This commit is contained in:
Kai Köhne
2021-06-15 20:25:49 +02:00
committed by Kai Koehne
parent 4bfcea22bf
commit bf04c98c1c
22 changed files with 68 additions and 68 deletions

View File

@@ -33,7 +33,7 @@ QT_QML_BEGIN_NAMESPACE
using namespace LanguageUtils; using namespace LanguageUtils;
static int parseInt(const QStringView &str, bool *ok) static int parseInt(QStringView str, bool *ok)
{ {
int pos = 0; int pos = 0;
int number = 0; int number = 0;

View File

@@ -318,12 +318,12 @@ class QML_PARSER_EXPORT UiQualifiedId: public Node
public: public:
QMLJS_DECLARE_AST_NODE(UiQualifiedId) QMLJS_DECLARE_AST_NODE(UiQualifiedId)
UiQualifiedId(const QStringView &name) UiQualifiedId(QStringView name)
: next(this) : next(this)
, name(name) , name(name)
{ kind = K; } { kind = K; }
UiQualifiedId(UiQualifiedId *previous, const QStringView &name) UiQualifiedId(UiQualifiedId *previous, QStringView name)
: name(name) : name(name)
{ {
kind = K; kind = K;
@@ -513,7 +513,7 @@ class QML_PARSER_EXPORT IdentifierExpression: public LeftHandSideExpression
public: public:
QMLJS_DECLARE_AST_NODE(IdentifierExpression) QMLJS_DECLARE_AST_NODE(IdentifierExpression)
IdentifierExpression(const QStringView &n) IdentifierExpression(QStringView n)
: name(n) : name(n)
{ {
kind = K; kind = K;
@@ -658,7 +658,7 @@ class QML_PARSER_EXPORT StringLiteral : public LeftHandSideExpression
public: public:
QMLJS_DECLARE_AST_NODE(StringLiteral) QMLJS_DECLARE_AST_NODE(StringLiteral)
StringLiteral(const QStringView &v) StringLiteral(QStringView v)
: value(v) : value(v)
{ {
kind = K; kind = K;
@@ -682,7 +682,7 @@ class QML_PARSER_EXPORT TemplateLiteral : public LeftHandSideExpression
public: public:
QMLJS_DECLARE_AST_NODE(TemplateLiteral) QMLJS_DECLARE_AST_NODE(TemplateLiteral)
TemplateLiteral(const QStringView &str, const QStringView &raw, ExpressionNode *e) TemplateLiteral(QStringView str, QStringView raw, ExpressionNode *e)
: value(str) : value(str)
, rawValue(raw) , rawValue(raw)
, expression(e) , expression(e)
@@ -712,7 +712,7 @@ class QML_PARSER_EXPORT RegExpLiteral: public LeftHandSideExpression
public: public:
QMLJS_DECLARE_AST_NODE(RegExpLiteral) QMLJS_DECLARE_AST_NODE(RegExpLiteral)
RegExpLiteral(const QStringView &p, int f) RegExpLiteral(QStringView p, int f)
: pattern(p) : pattern(p)
, flags(f) , flags(f)
{ {
@@ -907,7 +907,7 @@ public:
: initializer(i), type(t) : initializer(i), type(t)
{ kind = K; } { kind = K; }
PatternElement(const QStringView &n, PatternElement(QStringView n,
TypeAnnotation *typeAnnotation = nullptr, TypeAnnotation *typeAnnotation = nullptr,
ExpressionNode *i = nullptr, ExpressionNode *i = nullptr,
Type t = Binding) Type t = Binding)
@@ -1007,7 +1007,7 @@ public:
: PatternElement(i, t), name(name) : PatternElement(i, t), name(name)
{ kind = K; } { kind = K; }
PatternProperty(PropertyName *name, const QStringView &n, ExpressionNode *i = nullptr) PatternProperty(PropertyName *name, QStringView n, ExpressionNode *i = nullptr)
: PatternElement(n, /*type annotation*/ nullptr, i) : PatternElement(n, /*type annotation*/ nullptr, i)
, name(name) , name(name)
{ kind = K; } { kind = K; }
@@ -1078,7 +1078,7 @@ class QML_PARSER_EXPORT IdentifierPropertyName: public PropertyName
public: public:
QMLJS_DECLARE_AST_NODE(IdentifierPropertyName) QMLJS_DECLARE_AST_NODE(IdentifierPropertyName)
IdentifierPropertyName(const QStringView &n) IdentifierPropertyName(QStringView n)
: id(n) : id(n)
{ {
kind = K; kind = K;
@@ -1097,7 +1097,7 @@ class QML_PARSER_EXPORT StringLiteralPropertyName: public PropertyName
public: public:
QMLJS_DECLARE_AST_NODE(StringLiteralPropertyName) QMLJS_DECLARE_AST_NODE(StringLiteralPropertyName)
StringLiteralPropertyName(const QStringView &n) StringLiteralPropertyName(QStringView n)
: id(n) : id(n)
{ {
kind = K; kind = K;
@@ -1180,7 +1180,7 @@ class QML_PARSER_EXPORT FieldMemberExpression: public LeftHandSideExpression
public: public:
QMLJS_DECLARE_AST_NODE(FieldMemberExpression) QMLJS_DECLARE_AST_NODE(FieldMemberExpression)
FieldMemberExpression(ExpressionNode *b, const QStringView &n) FieldMemberExpression(ExpressionNode *b, QStringView n)
: base(b) : base(b)
, name(n) , name(n)
{ {
@@ -1972,7 +1972,7 @@ class QML_PARSER_EXPORT ContinueStatement: public Statement
public: public:
QMLJS_DECLARE_AST_NODE(ContinueStatement) QMLJS_DECLARE_AST_NODE(ContinueStatement)
ContinueStatement(const QStringView &l = QStringView()) ContinueStatement(QStringView l = QStringView())
: label(l) : label(l)
{ {
kind = K; kind = K;
@@ -1998,7 +1998,7 @@ class QML_PARSER_EXPORT BreakStatement: public Statement
public: public:
QMLJS_DECLARE_AST_NODE(BreakStatement) QMLJS_DECLARE_AST_NODE(BreakStatement)
BreakStatement(const QStringView &l) BreakStatement(QStringView l)
: label(l) : label(l)
{ {
kind = K; kind = K;
@@ -2229,7 +2229,7 @@ class QML_PARSER_EXPORT LabelledStatement: public Statement
public: public:
QMLJS_DECLARE_AST_NODE(LabelledStatement) QMLJS_DECLARE_AST_NODE(LabelledStatement)
LabelledStatement(const QStringView &l, Statement *stmt) LabelledStatement(QStringView l, Statement *stmt)
: label(l) : label(l)
, statement(stmt) , statement(stmt)
{ {
@@ -2364,7 +2364,7 @@ class QML_PARSER_EXPORT FunctionExpression: public ExpressionNode
public: public:
QMLJS_DECLARE_AST_NODE(FunctionExpression) QMLJS_DECLARE_AST_NODE(FunctionExpression)
FunctionExpression(const QStringView &n, FunctionExpression(QStringView n,
FormalParameterList *f, FormalParameterList *f,
StatementList *b, StatementList *b,
TypeAnnotation *typeAnnotation = nullptr) TypeAnnotation *typeAnnotation = nullptr)
@@ -2405,7 +2405,7 @@ class QML_PARSER_EXPORT FunctionDeclaration: public FunctionExpression
public: public:
QMLJS_DECLARE_AST_NODE(FunctionDeclaration) QMLJS_DECLARE_AST_NODE(FunctionDeclaration)
FunctionDeclaration(const QStringView &n, FunctionDeclaration(QStringView n,
FormalParameterList *f, FormalParameterList *f,
StatementList *b, StatementList *b,
TypeAnnotation *typeAnnotation = nullptr) TypeAnnotation *typeAnnotation = nullptr)
@@ -2506,7 +2506,7 @@ class QML_PARSER_EXPORT ClassExpression : public ExpressionNode
public: public:
QMLJS_DECLARE_AST_NODE(ClassExpression) QMLJS_DECLARE_AST_NODE(ClassExpression)
ClassExpression(const QStringView &n, ExpressionNode *heritage, ClassElementList *elements) ClassExpression(QStringView n, ExpressionNode *heritage, ClassElementList *elements)
: name(n) : name(n)
, heritage(heritage) , heritage(heritage)
, elements(elements) , elements(elements)
@@ -2538,7 +2538,7 @@ class QML_PARSER_EXPORT ClassDeclaration: public ClassExpression
public: public:
QMLJS_DECLARE_AST_NODE(ClassDeclaration) QMLJS_DECLARE_AST_NODE(ClassDeclaration)
ClassDeclaration(const QStringView &n, ExpressionNode *heritage, ClassElementList *elements) ClassDeclaration(QStringView n, ExpressionNode *heritage, ClassElementList *elements)
: ClassExpression(n, heritage, elements) : ClassExpression(n, heritage, elements)
{ {
kind = K; } kind = K; }
@@ -2610,13 +2610,13 @@ class QML_PARSER_EXPORT ImportSpecifier: public Node
public: public:
QMLJS_DECLARE_AST_NODE(ImportSpecifier) QMLJS_DECLARE_AST_NODE(ImportSpecifier)
ImportSpecifier(const QStringView &importedBinding) ImportSpecifier(QStringView importedBinding)
: importedBinding(importedBinding) : importedBinding(importedBinding)
{ {
kind = K; kind = K;
} }
ImportSpecifier(const QStringView &identifier, const QStringView &importedBinding) ImportSpecifier(QStringView identifier, QStringView importedBinding)
: identifier(identifier) : identifier(identifier)
, importedBinding(importedBinding) , importedBinding(importedBinding)
{ {
@@ -2718,7 +2718,7 @@ class QML_PARSER_EXPORT NameSpaceImport: public Node
public: public:
QMLJS_DECLARE_AST_NODE(NameSpaceImport) QMLJS_DECLARE_AST_NODE(NameSpaceImport)
NameSpaceImport(const QStringView &importedBinding) NameSpaceImport(QStringView importedBinding)
: importedBinding(importedBinding) : importedBinding(importedBinding)
{ {
kind = K; kind = K;
@@ -2742,7 +2742,7 @@ class QML_PARSER_EXPORT ImportClause: public Node
public: public:
QMLJS_DECLARE_AST_NODE(ImportClause) QMLJS_DECLARE_AST_NODE(ImportClause)
ImportClause(const QStringView &importedDefaultBinding) ImportClause(QStringView importedDefaultBinding)
: importedDefaultBinding(importedDefaultBinding) : importedDefaultBinding(importedDefaultBinding)
{ {
kind = K; kind = K;
@@ -2760,14 +2760,14 @@ public:
kind = K; kind = K;
} }
ImportClause(const QStringView &importedDefaultBinding, NameSpaceImport *nameSpaceImport) ImportClause(QStringView importedDefaultBinding, NameSpaceImport *nameSpaceImport)
: importedDefaultBinding(importedDefaultBinding) : importedDefaultBinding(importedDefaultBinding)
, nameSpaceImport(nameSpaceImport) , nameSpaceImport(nameSpaceImport)
{ {
kind = K; kind = K;
} }
ImportClause(const QStringView &importedDefaultBinding, NamedImports *namedImports) ImportClause(QStringView importedDefaultBinding, NamedImports *namedImports)
: importedDefaultBinding(importedDefaultBinding) : importedDefaultBinding(importedDefaultBinding)
, namedImports(namedImports) , namedImports(namedImports)
{ {
@@ -2793,7 +2793,7 @@ class QML_PARSER_EXPORT FromClause: public Node
public: public:
QMLJS_DECLARE_AST_NODE(FromClause) QMLJS_DECLARE_AST_NODE(FromClause)
FromClause(const QStringView &moduleSpecifier) FromClause(QStringView moduleSpecifier)
: moduleSpecifier(moduleSpecifier) : moduleSpecifier(moduleSpecifier)
{ {
kind = K; kind = K;
@@ -2824,7 +2824,7 @@ public:
kind = K; kind = K;
} }
ImportDeclaration(const QStringView &moduleSpecifier) ImportDeclaration(QStringView moduleSpecifier)
: moduleSpecifier(moduleSpecifier) : moduleSpecifier(moduleSpecifier)
{ {
kind = K; kind = K;
@@ -2851,14 +2851,14 @@ class QML_PARSER_EXPORT ExportSpecifier: public Node
public: public:
QMLJS_DECLARE_AST_NODE(ExportSpecifier) QMLJS_DECLARE_AST_NODE(ExportSpecifier)
ExportSpecifier(const QStringView &identifier) ExportSpecifier(QStringView identifier)
: identifier(identifier) : identifier(identifier)
, exportedIdentifier(identifier) , exportedIdentifier(identifier)
{ {
kind = K; kind = K;
} }
ExportSpecifier(const QStringView &identifier, const QStringView &exportedIdentifier) ExportSpecifier(QStringView identifier, QStringView exportedIdentifier)
: identifier(identifier) : identifier(identifier)
, exportedIdentifier(exportedIdentifier) , exportedIdentifier(exportedIdentifier)
{ {
@@ -3047,7 +3047,7 @@ class QML_PARSER_EXPORT UiImport: public Node
public: public:
QMLJS_DECLARE_AST_NODE(UiImport) QMLJS_DECLARE_AST_NODE(UiImport)
UiImport(const QStringView &fileName) UiImport(QStringView fileName)
: fileName(fileName) : fileName(fileName)
, importUri(nullptr) , importUri(nullptr)
{ kind = K; } { kind = K; }
@@ -3319,14 +3319,14 @@ class QML_PARSER_EXPORT UiParameterList: public Node
public: public:
QMLJS_DECLARE_AST_NODE(UiParameterList) QMLJS_DECLARE_AST_NODE(UiParameterList)
UiParameterList(UiQualifiedId *t, const QStringView &n) UiParameterList(UiQualifiedId *t, QStringView n)
: type(t) : type(t)
, name(n) , name(n)
, next(this) , next(this)
{ {
kind = K; } kind = K; }
UiParameterList(UiParameterList *previous, UiQualifiedId *t, const QStringView &n) UiParameterList(UiParameterList *previous, UiQualifiedId *t, QStringView n)
: type(t) : type(t)
, name(n) , name(n)
{ {
@@ -3368,7 +3368,7 @@ class QML_PARSER_EXPORT UiPublicMember: public UiObjectMember
public: public:
QMLJS_DECLARE_AST_NODE(UiPublicMember) QMLJS_DECLARE_AST_NODE(UiPublicMember)
UiPublicMember(UiQualifiedId *memberType, const QStringView &name) UiPublicMember(UiQualifiedId *memberType, QStringView name)
: type(Property) : type(Property)
, memberType(memberType) , memberType(memberType)
, name(name) , name(name)
@@ -3379,7 +3379,7 @@ public:
, parameters(nullptr) , parameters(nullptr)
{ kind = K; } { kind = K; }
UiPublicMember(UiQualifiedId *memberType, const QStringView &name, Statement *statement) UiPublicMember(UiQualifiedId *memberType, QStringView name, Statement *statement)
: type(Property) : type(Property)
, memberType(memberType) , memberType(memberType)
, name(name) , name(name)
@@ -3468,7 +3468,7 @@ class QML_PARSER_EXPORT UiInlineComponent: public UiObjectMember
public: public:
QMLJS_DECLARE_AST_NODE(UiInlineComponent) QMLJS_DECLARE_AST_NODE(UiInlineComponent)
UiInlineComponent(const QStringView &inlineComponentName, UiObjectDefinition *inlineComponent) UiInlineComponent(QStringView inlineComponentName, UiObjectDefinition *inlineComponent)
: name(inlineComponentName) : name(inlineComponentName)
, component(inlineComponent) , component(inlineComponent)
{ kind = K; } { kind = K; }
@@ -3615,13 +3615,13 @@ class QML_PARSER_EXPORT UiEnumMemberList: public Node
{ {
QMLJS_DECLARE_AST_NODE(UiEnumMemberList) QMLJS_DECLARE_AST_NODE(UiEnumMemberList)
public: public:
UiEnumMemberList(const QStringView &member, double v = 0.0) UiEnumMemberList(QStringView member, double v = 0.0)
: next(this) : next(this)
, member(member) , member(member)
, value(v) , value(v)
{ kind = K; } { kind = K; }
UiEnumMemberList(UiEnumMemberList *previous, const QStringView &member) UiEnumMemberList(UiEnumMemberList *previous, QStringView member)
: member(member) : member(member)
{ {
kind = K; kind = K;
@@ -3630,7 +3630,7 @@ public:
value = previous->value + 1; value = previous->value + 1;
} }
UiEnumMemberList(UiEnumMemberList *previous, const QStringView &member, double v) UiEnumMemberList(UiEnumMemberList *previous, QStringView member, double v)
: member(member) : member(member)
, value(v) , value(v)
{ {
@@ -3670,7 +3670,7 @@ class QML_PARSER_EXPORT UiEnumDeclaration: public UiObjectMember
public: public:
QMLJS_DECLARE_AST_NODE(UiEnumDeclaration) QMLJS_DECLARE_AST_NODE(UiEnumDeclaration)
UiEnumDeclaration(const QStringView &name, UiEnumMemberList *members) UiEnumDeclaration(QStringView name, UiEnumMemberList *members)
: name(name) : name(name)
, members(members) , members(members)
{ kind = K; } { kind = K; }

View File

@@ -1063,7 +1063,7 @@ void ObjectValue::setMember(const QString &name, const Value *value)
m_members[name].value = value; m_members[name].value = value;
} }
void ObjectValue::setMember(const QStringView &name, const Value *value) void ObjectValue::setMember(QStringView name, const Value *value)
{ {
m_members[name.toString()].value = value; m_members[name.toString()].value = value;
} }

View File

@@ -507,7 +507,7 @@ public:
virtual void processMembers(MemberProcessor *processor) const; virtual void processMembers(MemberProcessor *processor) const;
virtual void setMember(const QString &name, const Value *value); virtual void setMember(const QString &name, const Value *value);
virtual void setMember(const QStringView &name, const Value *value); virtual void setMember(QStringView name, const Value *value);
virtual void setPropertyInfo(const QString &name, const PropertyInfo &propertyInfo); virtual void setPropertyInfo(const QString &name, const PropertyInfo &propertyInfo);
virtual void removeMember(const QString &name); virtual void removeMember(const QString &name);

View File

@@ -108,7 +108,7 @@ static const char matchMaskAttributeC[] = "mask";
*/ */
MimeTypeParserBase::ParseState MimeTypeParserBase::nextState(ParseState currentState, MimeTypeParserBase::ParseState MimeTypeParserBase::nextState(ParseState currentState,
const QStringView &startElement) QStringView startElement)
{ {
switch (currentState) { switch (currentState) {
case ParseBeginning: case ParseBeginning:

View File

@@ -91,7 +91,7 @@ private:
ParseError ParseError
}; };
static ParseState nextState(ParseState currentState, const QStringView &startElement); static ParseState nextState(ParseState currentState, QStringView startElement);
}; };

View File

@@ -334,7 +334,7 @@ void AbstractSettings::readDocumentation()
QStringList keys; QStringList keys;
while (!(xml.atEnd() || xml.hasError())) { while (!(xml.atEnd() || xml.hasError())) {
if (xml.readNext() == QXmlStreamReader::StartElement) { if (xml.readNext() == QXmlStreamReader::StartElement) {
const QStringView &name = xml.name(); QStringView name = xml.name();
if (name == QLatin1String(Constants::DOCUMENTATION_XMLENTRY)) { if (name == QLatin1String(Constants::DOCUMENTATION_XMLENTRY)) {
keys.clear(); keys.clear();
} else if (name == QLatin1String(Constants::DOCUMENTATION_XMLKEY)) { } else if (name == QLatin1String(Constants::DOCUMENTATION_XMLKEY)) {

View File

@@ -454,7 +454,7 @@ bool ClangCompletionAssistProcessor::accepts() const
&& tokens.at(1).kind() == T_IDENTIFIER) { && tokens.at(1).kind() == T_IDENTIFIER) {
const QString &line = tc.block().text(); const QString &line = tc.block().text();
const Token &idToken = tokens.at(1); const Token &idToken = tokens.at(1);
const QStringView &identifier = Utils::midView(line, QStringView identifier = Utils::midView(line,
idToken.utf16charsBegin(), idToken.utf16charsBegin(),
idToken.utf16chars()); idToken.utf16chars());
if (identifier == QLatin1String("include") if (identifier == QLatin1String("include")

View File

@@ -242,7 +242,7 @@ struct Attribute {
}; };
} }
static QList<Attribute> toAttributes(const QStringView &attributes) static QList<Attribute> toAttributes(QStringView attributes)
{ {
QList<Attribute> result; QList<Attribute> result;
const QRegularExpression att("\\s+([a-zA-Z]+)\\s*=\\s*('.*?'|\".*?\")"); const QRegularExpression att("\\s+([a-zA-Z]+)\\s*=\\s*('.*?'|\".*?\")");
@@ -260,8 +260,8 @@ static QList<Attribute> toAttributes(const QStringView &attributes)
return result; return result;
} }
static inline ParseState nextOpeningState(ParseState current, const QStringView &tagView, static inline ParseState nextOpeningState(ParseState current, QStringView tagView,
const QStringView &attributesView) QStringView attributesView)
{ {
switch (current) { switch (current) {
case OutSideTable: case OutSideTable:
@@ -300,7 +300,7 @@ static inline ParseState nextOpeningState(ParseState current, const QStringView
return ParseError; return ParseError;
} }
static inline ParseState nextClosingState(ParseState current, const QStringView &element) static inline ParseState nextClosingState(ParseState current, QStringView element)
{ {
switch (current) { switch (current) {
case OutSideTable: case OutSideTable:

View File

@@ -278,7 +278,7 @@ void CppHighlighter::setLanguageFeatures(const LanguageFeatures &languageFeature
} }
} }
bool CppHighlighter::isPPKeyword(const QStringView &text) const bool CppHighlighter::isPPKeyword(QStringView text) const
{ {
switch (text.length()) switch (text.length())
{ {
@@ -370,7 +370,7 @@ void CppHighlighter::highlightWord(QStringView word, int position, int length)
} }
} }
bool CppHighlighter::highlightRawStringLiteral(const QStringView &_text, const Token &tk) bool CppHighlighter::highlightRawStringLiteral(QStringView _text, const Token &tk)
{ {
// Step one: Does the lexer think this is a raw string literal? // Step one: Does the lexer think this is a raw string literal?
switch (tk.kind()) { switch (tk.kind()) {

View File

@@ -47,12 +47,12 @@ public:
private: private:
void highlightWord(QStringView word, int position, int length); void highlightWord(QStringView word, int position, int length);
bool highlightRawStringLiteral(const QStringView &text, const CPlusPlus::Token &tk); bool highlightRawStringLiteral(QStringView text, const CPlusPlus::Token &tk);
void highlightDoxygenComment(const QString &text, int position, void highlightDoxygenComment(const QString &text, int position,
int length); int length);
bool isPPKeyword(const QStringView &text) const; bool isPPKeyword(QStringView text) const;
private: private:
CPlusPlus::LanguageFeatures m_languageFeatures = CPlusPlus::LanguageFeatures::defaultFeatures(); CPlusPlus::LanguageFeatures m_languageFeatures = CPlusPlus::LanguageFeatures::defaultFeatures();

View File

@@ -880,7 +880,7 @@ bool InternalCppCompletionAssistProcessor::accepts() const
&& tokens.at(1).kind() == T_IDENTIFIER) { && tokens.at(1).kind() == T_IDENTIFIER) {
const QString &line = tc.block().text(); const QString &line = tc.block().text();
const Token &idToken = tokens.at(1); const Token &idToken = tokens.at(1);
const QStringView &identifier = idToken.utf16charsEnd() > line.size() QStringView identifier = idToken.utf16charsEnd() > line.size()
? QStringView(line).mid( ? QStringView(line).mid(
idToken.utf16charsBegin()) idToken.utf16charsBegin())
: QStringView(line) : QStringView(line)

View File

@@ -1039,7 +1039,7 @@ void CdbEngine::runCommand(const DebuggerCommand &dbgCmd)
} }
QTC_CHECK(argumentSplitPos == arguments.size()); QTC_CHECK(argumentSplitPos == arguments.size());
int tokenPart = splittedArguments.size(); int tokenPart = splittedArguments.size();
for (const QStringView &part : qAsConst(splittedArguments)) for (QStringView part : qAsConst(splittedArguments))
str << prefix << " -t " << token << '.' << --tokenPart << ' ' << part << '\n'; str << prefix << " -t " << token << '.' << --tokenPart << ' ' << part << '\n';
} else { } else {
cmd = prefix; cmd = prefix;

View File

@@ -42,7 +42,7 @@ public:
StringInputStream &operator<<(char a) { m_target.append(a); return *this; } StringInputStream &operator<<(char a) { m_target.append(a); return *this; }
StringInputStream &operator<<(const char *a) { m_target.append(QString::fromUtf8(a)); return *this; } StringInputStream &operator<<(const char *a) { m_target.append(QString::fromUtf8(a)); return *this; }
StringInputStream &operator<<(const QString &a) { m_target.append(a); return *this; } StringInputStream &operator<<(const QString &a) { m_target.append(a); return *this; }
StringInputStream &operator<<(const QStringView &a) StringInputStream &operator<<(QStringView a)
{ {
m_target.append(a.toString()); m_target.append(a.toString());
return *this; return *this;

View File

@@ -260,7 +260,7 @@ void GlslHighlighter::highlightLine(const QString &text, int position, int lengt
} }
} }
bool GlslHighlighter::isPPKeyword(const QStringView &text) const bool GlslHighlighter::isPPKeyword(QStringView text) const
{ {
switch (text.length()) switch (text.length())
{ {

View File

@@ -40,7 +40,7 @@ public:
protected: protected:
void highlightBlock(const QString &text) override; void highlightBlock(const QString &text) override;
void highlightLine(const QString &text, int position, int length, const QTextCharFormat &format); void highlightLine(const QString &text, int position, int length, const QTextCharFormat &format);
bool isPPKeyword(const QStringView &text) const; bool isPPKeyword(QStringView text) const;
}; };
} // namespace Internal } // namespace Internal

View File

@@ -308,7 +308,7 @@ static inline QMap<QString, QString> attributesToStringMap(const QXmlStreamAttri
} }
// Switch parser state depending on opening element name. // Switch parser state depending on opening element name.
static ParseState nextOpeningState(ParseState in, const QStringView &name) static ParseState nextOpeningState(ParseState in, QStringView name)
{ {
switch (in) { switch (in) {
case ParseBeginning: case ParseBeginning:
@@ -375,7 +375,7 @@ static ParseState nextOpeningState(ParseState in, const QStringView &name)
} }
// Switch parser state depending on closing element name. // Switch parser state depending on closing element name.
static ParseState nextClosingState(ParseState in, const QStringView &name) static ParseState nextClosingState(ParseState in, QStringView name)
{ {
switch (in) { switch (in) {
case ParseBeginning: case ParseBeginning:

View File

@@ -121,7 +121,7 @@ static bool shouldInsertNewline(const QTextCursor &tc)
return false; return false;
} }
static bool isCompleteStringLiteral(const QStringView &text) static bool isCompleteStringLiteral(QStringView text)
{ {
if (text.length() < 2) if (text.length() < 2)
return false; return false;

View File

@@ -417,7 +417,7 @@ protected:
{ {
UiQualifiedId *id = qualifiedTypeNameId(member); UiQualifiedId *id = qualifiedTypeNameId(member);
if (id) { if (id) {
const QStringView &name = id->name; QStringView name = id->name;
if (!name.isEmpty() && name.at(0).isUpper()) if (!name.isEmpty() && name.at(0).isUpper())
return true; return true;
} }
@@ -435,7 +435,7 @@ protected:
else if (script->qualifiedId->next) else if (script->qualifiedId->next)
return false; return false;
const QStringView &propertyName = script->qualifiedId->name; QStringView propertyName = script->qualifiedId->name;
if (propertyName == QLatin1String("id")) if (propertyName == QLatin1String("id"))
return true; return true;

View File

@@ -202,7 +202,7 @@ void QmlJSHighlighter::highlightBlock(const QString &text)
onBlockEnd(m_scanner.state()); onBlockEnd(m_scanner.state());
} }
bool QmlJSHighlighter::maybeQmlKeyword(const QStringView &text) const bool QmlJSHighlighter::maybeQmlKeyword(QStringView text) const
{ {
if (text.isEmpty()) if (text.isEmpty())
return false; return false;
@@ -228,7 +228,7 @@ bool QmlJSHighlighter::maybeQmlKeyword(const QStringView &text) const
return false; return false;
} }
bool QmlJSHighlighter::maybeQmlBuiltinType(const QStringView &text) const bool QmlJSHighlighter::maybeQmlBuiltinType(QStringView text) const
{ {
if (text.isEmpty()) if (text.isEmpty())
return false; return false;

View File

@@ -56,8 +56,8 @@ protected:
void onOpeningParenthesis(QChar parenthesis, int pos, bool atStart); void onOpeningParenthesis(QChar parenthesis, int pos, bool atStart);
void onClosingParenthesis(QChar parenthesis, int pos, bool atEnd); void onClosingParenthesis(QChar parenthesis, int pos, bool atEnd);
bool maybeQmlKeyword(const QStringView &text) const; bool maybeQmlKeyword(QStringView text) const;
bool maybeQmlBuiltinType(const QStringView &text) const; bool maybeQmlBuiltinType(QStringView text) const;
private: private:
bool m_qmlEnabled; bool m_qmlEnabled;

View File

@@ -239,7 +239,7 @@ protected:
m_scopeBuilder.pop(); m_scopeBuilder.pop();
} }
void processName(const QStringView &name, SourceLocation location) void processName(QStringView name, SourceLocation location)
{ {
if (name.isEmpty()) if (name.isEmpty())
return; return;