From bf04c98c1c3d8e03db61b0811e1cc47517c49afa Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Kai=20K=C3=B6hne?= Date: Tue, 15 Jun 2021 20:25:49 +0200 Subject: [PATCH] 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 Reviewed-by: Eike Ziller --- src/libs/qmljs/parser/qmldirparser.cpp | 2 +- src/libs/qmljs/parser/qmljsast_p.h | 76 +++++++++---------- src/libs/qmljs/qmljsinterpreter.cpp | 2 +- src/libs/qmljs/qmljsinterpreter.h | 2 +- src/libs/utils/mimetypes/mimetypeparser.cpp | 2 +- src/libs/utils/mimetypes/mimetypeparser_p.h | 2 +- src/plugins/beautifier/abstractsettings.cpp | 2 +- .../clangcompletionassistprocessor.cpp | 2 +- .../cpaster/pastebindotcomprotocol.cpp | 8 +- src/plugins/cppeditor/cpphighlighter.cpp | 4 +- src/plugins/cppeditor/cpphighlighter.h | 4 +- src/plugins/cpptools/cppcompletionassist.cpp | 2 +- src/plugins/debugger/cdb/cdbengine.cpp | 2 +- src/plugins/debugger/cdb/stringinputstream.h | 2 +- src/plugins/glsleditor/glslhighlighter.cpp | 2 +- src/plugins/glsleditor/glslhighlighter.h | 2 +- .../customwizard/customwizardparameters.cpp | 4 +- .../qmljseditor/qmljsautocompleter.cpp | 2 +- src/plugins/qmljseditor/qmljseditor.cpp | 4 +- src/plugins/qmljseditor/qmljshighlighter.cpp | 4 +- src/plugins/qmljseditor/qmljshighlighter.h | 4 +- .../qmljseditor/qmljssemantichighlighter.cpp | 2 +- 22 files changed, 68 insertions(+), 68 deletions(-) diff --git a/src/libs/qmljs/parser/qmldirparser.cpp b/src/libs/qmljs/parser/qmldirparser.cpp index e15d467b8fe..88a5b5f6ab0 100644 --- a/src/libs/qmljs/parser/qmldirparser.cpp +++ b/src/libs/qmljs/parser/qmldirparser.cpp @@ -33,7 +33,7 @@ QT_QML_BEGIN_NAMESPACE using namespace LanguageUtils; -static int parseInt(const QStringView &str, bool *ok) +static int parseInt(QStringView str, bool *ok) { int pos = 0; int number = 0; diff --git a/src/libs/qmljs/parser/qmljsast_p.h b/src/libs/qmljs/parser/qmljsast_p.h index f9c77c53f1e..9086b981fad 100644 --- a/src/libs/qmljs/parser/qmljsast_p.h +++ b/src/libs/qmljs/parser/qmljsast_p.h @@ -318,12 +318,12 @@ class QML_PARSER_EXPORT UiQualifiedId: public Node public: QMLJS_DECLARE_AST_NODE(UiQualifiedId) - UiQualifiedId(const QStringView &name) + UiQualifiedId(QStringView name) : next(this) , name(name) { kind = K; } - UiQualifiedId(UiQualifiedId *previous, const QStringView &name) + UiQualifiedId(UiQualifiedId *previous, QStringView name) : name(name) { kind = K; @@ -513,7 +513,7 @@ class QML_PARSER_EXPORT IdentifierExpression: public LeftHandSideExpression public: QMLJS_DECLARE_AST_NODE(IdentifierExpression) - IdentifierExpression(const QStringView &n) + IdentifierExpression(QStringView n) : name(n) { kind = K; @@ -658,7 +658,7 @@ class QML_PARSER_EXPORT StringLiteral : public LeftHandSideExpression public: QMLJS_DECLARE_AST_NODE(StringLiteral) - StringLiteral(const QStringView &v) + StringLiteral(QStringView v) : value(v) { kind = K; @@ -682,7 +682,7 @@ class QML_PARSER_EXPORT TemplateLiteral : public LeftHandSideExpression public: QMLJS_DECLARE_AST_NODE(TemplateLiteral) - TemplateLiteral(const QStringView &str, const QStringView &raw, ExpressionNode *e) + TemplateLiteral(QStringView str, QStringView raw, ExpressionNode *e) : value(str) , rawValue(raw) , expression(e) @@ -712,7 +712,7 @@ class QML_PARSER_EXPORT RegExpLiteral: public LeftHandSideExpression public: QMLJS_DECLARE_AST_NODE(RegExpLiteral) - RegExpLiteral(const QStringView &p, int f) + RegExpLiteral(QStringView p, int f) : pattern(p) , flags(f) { @@ -907,7 +907,7 @@ public: : initializer(i), type(t) { kind = K; } - PatternElement(const QStringView &n, + PatternElement(QStringView n, TypeAnnotation *typeAnnotation = nullptr, ExpressionNode *i = nullptr, Type t = Binding) @@ -1007,7 +1007,7 @@ public: : PatternElement(i, t), name(name) { 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) , name(name) { kind = K; } @@ -1078,7 +1078,7 @@ class QML_PARSER_EXPORT IdentifierPropertyName: public PropertyName public: QMLJS_DECLARE_AST_NODE(IdentifierPropertyName) - IdentifierPropertyName(const QStringView &n) + IdentifierPropertyName(QStringView n) : id(n) { kind = K; @@ -1097,7 +1097,7 @@ class QML_PARSER_EXPORT StringLiteralPropertyName: public PropertyName public: QMLJS_DECLARE_AST_NODE(StringLiteralPropertyName) - StringLiteralPropertyName(const QStringView &n) + StringLiteralPropertyName(QStringView n) : id(n) { kind = K; @@ -1180,7 +1180,7 @@ class QML_PARSER_EXPORT FieldMemberExpression: public LeftHandSideExpression public: QMLJS_DECLARE_AST_NODE(FieldMemberExpression) - FieldMemberExpression(ExpressionNode *b, const QStringView &n) + FieldMemberExpression(ExpressionNode *b, QStringView n) : base(b) , name(n) { @@ -1972,7 +1972,7 @@ class QML_PARSER_EXPORT ContinueStatement: public Statement public: QMLJS_DECLARE_AST_NODE(ContinueStatement) - ContinueStatement(const QStringView &l = QStringView()) + ContinueStatement(QStringView l = QStringView()) : label(l) { kind = K; @@ -1998,7 +1998,7 @@ class QML_PARSER_EXPORT BreakStatement: public Statement public: QMLJS_DECLARE_AST_NODE(BreakStatement) - BreakStatement(const QStringView &l) + BreakStatement(QStringView l) : label(l) { kind = K; @@ -2229,7 +2229,7 @@ class QML_PARSER_EXPORT LabelledStatement: public Statement public: QMLJS_DECLARE_AST_NODE(LabelledStatement) - LabelledStatement(const QStringView &l, Statement *stmt) + LabelledStatement(QStringView l, Statement *stmt) : label(l) , statement(stmt) { @@ -2364,7 +2364,7 @@ class QML_PARSER_EXPORT FunctionExpression: public ExpressionNode public: QMLJS_DECLARE_AST_NODE(FunctionExpression) - FunctionExpression(const QStringView &n, + FunctionExpression(QStringView n, FormalParameterList *f, StatementList *b, TypeAnnotation *typeAnnotation = nullptr) @@ -2405,7 +2405,7 @@ class QML_PARSER_EXPORT FunctionDeclaration: public FunctionExpression public: QMLJS_DECLARE_AST_NODE(FunctionDeclaration) - FunctionDeclaration(const QStringView &n, + FunctionDeclaration(QStringView n, FormalParameterList *f, StatementList *b, TypeAnnotation *typeAnnotation = nullptr) @@ -2506,7 +2506,7 @@ class QML_PARSER_EXPORT ClassExpression : public ExpressionNode public: QMLJS_DECLARE_AST_NODE(ClassExpression) - ClassExpression(const QStringView &n, ExpressionNode *heritage, ClassElementList *elements) + ClassExpression(QStringView n, ExpressionNode *heritage, ClassElementList *elements) : name(n) , heritage(heritage) , elements(elements) @@ -2538,7 +2538,7 @@ class QML_PARSER_EXPORT ClassDeclaration: public ClassExpression public: QMLJS_DECLARE_AST_NODE(ClassDeclaration) - ClassDeclaration(const QStringView &n, ExpressionNode *heritage, ClassElementList *elements) + ClassDeclaration(QStringView n, ExpressionNode *heritage, ClassElementList *elements) : ClassExpression(n, heritage, elements) { kind = K; } @@ -2610,13 +2610,13 @@ class QML_PARSER_EXPORT ImportSpecifier: public Node public: QMLJS_DECLARE_AST_NODE(ImportSpecifier) - ImportSpecifier(const QStringView &importedBinding) + ImportSpecifier(QStringView importedBinding) : importedBinding(importedBinding) { kind = K; } - ImportSpecifier(const QStringView &identifier, const QStringView &importedBinding) + ImportSpecifier(QStringView identifier, QStringView importedBinding) : identifier(identifier) , importedBinding(importedBinding) { @@ -2718,7 +2718,7 @@ class QML_PARSER_EXPORT NameSpaceImport: public Node public: QMLJS_DECLARE_AST_NODE(NameSpaceImport) - NameSpaceImport(const QStringView &importedBinding) + NameSpaceImport(QStringView importedBinding) : importedBinding(importedBinding) { kind = K; @@ -2742,7 +2742,7 @@ class QML_PARSER_EXPORT ImportClause: public Node public: QMLJS_DECLARE_AST_NODE(ImportClause) - ImportClause(const QStringView &importedDefaultBinding) + ImportClause(QStringView importedDefaultBinding) : importedDefaultBinding(importedDefaultBinding) { kind = K; @@ -2760,14 +2760,14 @@ public: kind = K; } - ImportClause(const QStringView &importedDefaultBinding, NameSpaceImport *nameSpaceImport) + ImportClause(QStringView importedDefaultBinding, NameSpaceImport *nameSpaceImport) : importedDefaultBinding(importedDefaultBinding) , nameSpaceImport(nameSpaceImport) { kind = K; } - ImportClause(const QStringView &importedDefaultBinding, NamedImports *namedImports) + ImportClause(QStringView importedDefaultBinding, NamedImports *namedImports) : importedDefaultBinding(importedDefaultBinding) , namedImports(namedImports) { @@ -2793,7 +2793,7 @@ class QML_PARSER_EXPORT FromClause: public Node public: QMLJS_DECLARE_AST_NODE(FromClause) - FromClause(const QStringView &moduleSpecifier) + FromClause(QStringView moduleSpecifier) : moduleSpecifier(moduleSpecifier) { kind = K; @@ -2824,7 +2824,7 @@ public: kind = K; } - ImportDeclaration(const QStringView &moduleSpecifier) + ImportDeclaration(QStringView moduleSpecifier) : moduleSpecifier(moduleSpecifier) { kind = K; @@ -2851,14 +2851,14 @@ class QML_PARSER_EXPORT ExportSpecifier: public Node public: QMLJS_DECLARE_AST_NODE(ExportSpecifier) - ExportSpecifier(const QStringView &identifier) + ExportSpecifier(QStringView identifier) : identifier(identifier) , exportedIdentifier(identifier) { kind = K; } - ExportSpecifier(const QStringView &identifier, const QStringView &exportedIdentifier) + ExportSpecifier(QStringView identifier, QStringView exportedIdentifier) : identifier(identifier) , exportedIdentifier(exportedIdentifier) { @@ -3047,7 +3047,7 @@ class QML_PARSER_EXPORT UiImport: public Node public: QMLJS_DECLARE_AST_NODE(UiImport) - UiImport(const QStringView &fileName) + UiImport(QStringView fileName) : fileName(fileName) , importUri(nullptr) { kind = K; } @@ -3319,14 +3319,14 @@ class QML_PARSER_EXPORT UiParameterList: public Node public: QMLJS_DECLARE_AST_NODE(UiParameterList) - UiParameterList(UiQualifiedId *t, const QStringView &n) + UiParameterList(UiQualifiedId *t, QStringView n) : type(t) , name(n) , next(this) { kind = K; } - UiParameterList(UiParameterList *previous, UiQualifiedId *t, const QStringView &n) + UiParameterList(UiParameterList *previous, UiQualifiedId *t, QStringView n) : type(t) , name(n) { @@ -3368,7 +3368,7 @@ class QML_PARSER_EXPORT UiPublicMember: public UiObjectMember public: QMLJS_DECLARE_AST_NODE(UiPublicMember) - UiPublicMember(UiQualifiedId *memberType, const QStringView &name) + UiPublicMember(UiQualifiedId *memberType, QStringView name) : type(Property) , memberType(memberType) , name(name) @@ -3379,7 +3379,7 @@ public: , parameters(nullptr) { kind = K; } - UiPublicMember(UiQualifiedId *memberType, const QStringView &name, Statement *statement) + UiPublicMember(UiQualifiedId *memberType, QStringView name, Statement *statement) : type(Property) , memberType(memberType) , name(name) @@ -3468,7 +3468,7 @@ class QML_PARSER_EXPORT UiInlineComponent: public UiObjectMember public: QMLJS_DECLARE_AST_NODE(UiInlineComponent) - UiInlineComponent(const QStringView &inlineComponentName, UiObjectDefinition *inlineComponent) + UiInlineComponent(QStringView inlineComponentName, UiObjectDefinition *inlineComponent) : name(inlineComponentName) , component(inlineComponent) { kind = K; } @@ -3615,13 +3615,13 @@ class QML_PARSER_EXPORT UiEnumMemberList: public Node { QMLJS_DECLARE_AST_NODE(UiEnumMemberList) public: - UiEnumMemberList(const QStringView &member, double v = 0.0) + UiEnumMemberList(QStringView member, double v = 0.0) : next(this) , member(member) , value(v) { kind = K; } - UiEnumMemberList(UiEnumMemberList *previous, const QStringView &member) + UiEnumMemberList(UiEnumMemberList *previous, QStringView member) : member(member) { kind = K; @@ -3630,7 +3630,7 @@ public: value = previous->value + 1; } - UiEnumMemberList(UiEnumMemberList *previous, const QStringView &member, double v) + UiEnumMemberList(UiEnumMemberList *previous, QStringView member, double v) : member(member) , value(v) { @@ -3670,7 +3670,7 @@ class QML_PARSER_EXPORT UiEnumDeclaration: public UiObjectMember public: QMLJS_DECLARE_AST_NODE(UiEnumDeclaration) - UiEnumDeclaration(const QStringView &name, UiEnumMemberList *members) + UiEnumDeclaration(QStringView name, UiEnumMemberList *members) : name(name) , members(members) { kind = K; } diff --git a/src/libs/qmljs/qmljsinterpreter.cpp b/src/libs/qmljs/qmljsinterpreter.cpp index 0efe52d45bc..9ae98e35309 100644 --- a/src/libs/qmljs/qmljsinterpreter.cpp +++ b/src/libs/qmljs/qmljsinterpreter.cpp @@ -1063,7 +1063,7 @@ void ObjectValue::setMember(const QString &name, const 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; } diff --git a/src/libs/qmljs/qmljsinterpreter.h b/src/libs/qmljs/qmljsinterpreter.h index 65cc010537b..69293867857 100644 --- a/src/libs/qmljs/qmljsinterpreter.h +++ b/src/libs/qmljs/qmljsinterpreter.h @@ -507,7 +507,7 @@ public: virtual void processMembers(MemberProcessor *processor) const; 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 removeMember(const QString &name); diff --git a/src/libs/utils/mimetypes/mimetypeparser.cpp b/src/libs/utils/mimetypes/mimetypeparser.cpp index fb5161d0fc8..7d431da26ef 100644 --- a/src/libs/utils/mimetypes/mimetypeparser.cpp +++ b/src/libs/utils/mimetypes/mimetypeparser.cpp @@ -108,7 +108,7 @@ static const char matchMaskAttributeC[] = "mask"; */ MimeTypeParserBase::ParseState MimeTypeParserBase::nextState(ParseState currentState, - const QStringView &startElement) + QStringView startElement) { switch (currentState) { case ParseBeginning: diff --git a/src/libs/utils/mimetypes/mimetypeparser_p.h b/src/libs/utils/mimetypes/mimetypeparser_p.h index 3d239d76dff..c1bd4bc976a 100644 --- a/src/libs/utils/mimetypes/mimetypeparser_p.h +++ b/src/libs/utils/mimetypes/mimetypeparser_p.h @@ -91,7 +91,7 @@ private: ParseError }; - static ParseState nextState(ParseState currentState, const QStringView &startElement); + static ParseState nextState(ParseState currentState, QStringView startElement); }; diff --git a/src/plugins/beautifier/abstractsettings.cpp b/src/plugins/beautifier/abstractsettings.cpp index e1524ac1d9d..28d8ac6b049 100644 --- a/src/plugins/beautifier/abstractsettings.cpp +++ b/src/plugins/beautifier/abstractsettings.cpp @@ -334,7 +334,7 @@ void AbstractSettings::readDocumentation() QStringList keys; while (!(xml.atEnd() || xml.hasError())) { if (xml.readNext() == QXmlStreamReader::StartElement) { - const QStringView &name = xml.name(); + QStringView name = xml.name(); if (name == QLatin1String(Constants::DOCUMENTATION_XMLENTRY)) { keys.clear(); } else if (name == QLatin1String(Constants::DOCUMENTATION_XMLKEY)) { diff --git a/src/plugins/clangcodemodel/clangcompletionassistprocessor.cpp b/src/plugins/clangcodemodel/clangcompletionassistprocessor.cpp index 3902119e8cd..90644fd6e4e 100644 --- a/src/plugins/clangcodemodel/clangcompletionassistprocessor.cpp +++ b/src/plugins/clangcodemodel/clangcompletionassistprocessor.cpp @@ -454,7 +454,7 @@ bool ClangCompletionAssistProcessor::accepts() const && tokens.at(1).kind() == T_IDENTIFIER) { const QString &line = tc.block().text(); const Token &idToken = tokens.at(1); - const QStringView &identifier = Utils::midView(line, + QStringView identifier = Utils::midView(line, idToken.utf16charsBegin(), idToken.utf16chars()); if (identifier == QLatin1String("include") diff --git a/src/plugins/cpaster/pastebindotcomprotocol.cpp b/src/plugins/cpaster/pastebindotcomprotocol.cpp index c503bfe3330..7ff8469ea2e 100644 --- a/src/plugins/cpaster/pastebindotcomprotocol.cpp +++ b/src/plugins/cpaster/pastebindotcomprotocol.cpp @@ -242,7 +242,7 @@ struct Attribute { }; } -static QList toAttributes(const QStringView &attributes) +static QList toAttributes(QStringView attributes) { QList result; const QRegularExpression att("\\s+([a-zA-Z]+)\\s*=\\s*('.*?'|\".*?\")"); @@ -260,8 +260,8 @@ static QList toAttributes(const QStringView &attributes) return result; } -static inline ParseState nextOpeningState(ParseState current, const QStringView &tagView, - const QStringView &attributesView) +static inline ParseState nextOpeningState(ParseState current, QStringView tagView, + QStringView attributesView) { switch (current) { case OutSideTable: @@ -300,7 +300,7 @@ static inline ParseState nextOpeningState(ParseState current, const QStringView return ParseError; } -static inline ParseState nextClosingState(ParseState current, const QStringView &element) +static inline ParseState nextClosingState(ParseState current, QStringView element) { switch (current) { case OutSideTable: diff --git a/src/plugins/cppeditor/cpphighlighter.cpp b/src/plugins/cppeditor/cpphighlighter.cpp index 49984cc11e6..9cec74e314e 100644 --- a/src/plugins/cppeditor/cpphighlighter.cpp +++ b/src/plugins/cppeditor/cpphighlighter.cpp @@ -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()) { @@ -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? switch (tk.kind()) { diff --git a/src/plugins/cppeditor/cpphighlighter.h b/src/plugins/cppeditor/cpphighlighter.h index 7e55fa4ad88..f6e711694ec 100644 --- a/src/plugins/cppeditor/cpphighlighter.h +++ b/src/plugins/cppeditor/cpphighlighter.h @@ -47,12 +47,12 @@ public: private: 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, int length); - bool isPPKeyword(const QStringView &text) const; + bool isPPKeyword(QStringView text) const; private: CPlusPlus::LanguageFeatures m_languageFeatures = CPlusPlus::LanguageFeatures::defaultFeatures(); diff --git a/src/plugins/cpptools/cppcompletionassist.cpp b/src/plugins/cpptools/cppcompletionassist.cpp index a8f01d0a0ed..f5f929fd551 100644 --- a/src/plugins/cpptools/cppcompletionassist.cpp +++ b/src/plugins/cpptools/cppcompletionassist.cpp @@ -880,7 +880,7 @@ bool InternalCppCompletionAssistProcessor::accepts() const && tokens.at(1).kind() == T_IDENTIFIER) { const QString &line = tc.block().text(); const Token &idToken = tokens.at(1); - const QStringView &identifier = idToken.utf16charsEnd() > line.size() + QStringView identifier = idToken.utf16charsEnd() > line.size() ? QStringView(line).mid( idToken.utf16charsBegin()) : QStringView(line) diff --git a/src/plugins/debugger/cdb/cdbengine.cpp b/src/plugins/debugger/cdb/cdbengine.cpp index acdd042d07f..b920b69d0c2 100644 --- a/src/plugins/debugger/cdb/cdbengine.cpp +++ b/src/plugins/debugger/cdb/cdbengine.cpp @@ -1039,7 +1039,7 @@ void CdbEngine::runCommand(const DebuggerCommand &dbgCmd) } QTC_CHECK(argumentSplitPos == arguments.size()); int tokenPart = splittedArguments.size(); - for (const QStringView &part : qAsConst(splittedArguments)) + for (QStringView part : qAsConst(splittedArguments)) str << prefix << " -t " << token << '.' << --tokenPart << ' ' << part << '\n'; } else { cmd = prefix; diff --git a/src/plugins/debugger/cdb/stringinputstream.h b/src/plugins/debugger/cdb/stringinputstream.h index 7ed82b38785..8612916c83d 100644 --- a/src/plugins/debugger/cdb/stringinputstream.h +++ b/src/plugins/debugger/cdb/stringinputstream.h @@ -42,7 +42,7 @@ public: 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 QString &a) { m_target.append(a); return *this; } - StringInputStream &operator<<(const QStringView &a) + StringInputStream &operator<<(QStringView a) { m_target.append(a.toString()); return *this; diff --git a/src/plugins/glsleditor/glslhighlighter.cpp b/src/plugins/glsleditor/glslhighlighter.cpp index 7eb0d03fa44..19cbb32691e 100644 --- a/src/plugins/glsleditor/glslhighlighter.cpp +++ b/src/plugins/glsleditor/glslhighlighter.cpp @@ -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()) { diff --git a/src/plugins/glsleditor/glslhighlighter.h b/src/plugins/glsleditor/glslhighlighter.h index 868705efad8..9148d19b55a 100644 --- a/src/plugins/glsleditor/glslhighlighter.h +++ b/src/plugins/glsleditor/glslhighlighter.h @@ -40,7 +40,7 @@ public: protected: void highlightBlock(const QString &text) override; 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 diff --git a/src/plugins/projectexplorer/customwizard/customwizardparameters.cpp b/src/plugins/projectexplorer/customwizard/customwizardparameters.cpp index c85aa111366..59e09fbe1ee 100644 --- a/src/plugins/projectexplorer/customwizard/customwizardparameters.cpp +++ b/src/plugins/projectexplorer/customwizard/customwizardparameters.cpp @@ -308,7 +308,7 @@ static inline QMap attributesToStringMap(const QXmlStreamAttri } // 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) { case ParseBeginning: @@ -375,7 +375,7 @@ static ParseState nextOpeningState(ParseState in, const QStringView &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) { case ParseBeginning: diff --git a/src/plugins/qmljseditor/qmljsautocompleter.cpp b/src/plugins/qmljseditor/qmljsautocompleter.cpp index 43209507ca5..60ebeb68a64 100644 --- a/src/plugins/qmljseditor/qmljsautocompleter.cpp +++ b/src/plugins/qmljseditor/qmljsautocompleter.cpp @@ -121,7 +121,7 @@ static bool shouldInsertNewline(const QTextCursor &tc) return false; } -static bool isCompleteStringLiteral(const QStringView &text) +static bool isCompleteStringLiteral(QStringView text) { if (text.length() < 2) return false; diff --git a/src/plugins/qmljseditor/qmljseditor.cpp b/src/plugins/qmljseditor/qmljseditor.cpp index 39105a0406c..b6f8287561a 100644 --- a/src/plugins/qmljseditor/qmljseditor.cpp +++ b/src/plugins/qmljseditor/qmljseditor.cpp @@ -417,7 +417,7 @@ protected: { UiQualifiedId *id = qualifiedTypeNameId(member); if (id) { - const QStringView &name = id->name; + QStringView name = id->name; if (!name.isEmpty() && name.at(0).isUpper()) return true; } @@ -435,7 +435,7 @@ protected: else if (script->qualifiedId->next) return false; - const QStringView &propertyName = script->qualifiedId->name; + QStringView propertyName = script->qualifiedId->name; if (propertyName == QLatin1String("id")) return true; diff --git a/src/plugins/qmljseditor/qmljshighlighter.cpp b/src/plugins/qmljseditor/qmljshighlighter.cpp index 998021ce50b..86f8cfbd64c 100644 --- a/src/plugins/qmljseditor/qmljshighlighter.cpp +++ b/src/plugins/qmljseditor/qmljshighlighter.cpp @@ -202,7 +202,7 @@ void QmlJSHighlighter::highlightBlock(const QString &text) onBlockEnd(m_scanner.state()); } -bool QmlJSHighlighter::maybeQmlKeyword(const QStringView &text) const +bool QmlJSHighlighter::maybeQmlKeyword(QStringView text) const { if (text.isEmpty()) return false; @@ -228,7 +228,7 @@ bool QmlJSHighlighter::maybeQmlKeyword(const QStringView &text) const return false; } -bool QmlJSHighlighter::maybeQmlBuiltinType(const QStringView &text) const +bool QmlJSHighlighter::maybeQmlBuiltinType(QStringView text) const { if (text.isEmpty()) return false; diff --git a/src/plugins/qmljseditor/qmljshighlighter.h b/src/plugins/qmljseditor/qmljshighlighter.h index 07bd8736ff8..88c72528fe3 100644 --- a/src/plugins/qmljseditor/qmljshighlighter.h +++ b/src/plugins/qmljseditor/qmljshighlighter.h @@ -56,8 +56,8 @@ protected: void onOpeningParenthesis(QChar parenthesis, int pos, bool atStart); void onClosingParenthesis(QChar parenthesis, int pos, bool atEnd); - bool maybeQmlKeyword(const QStringView &text) const; - bool maybeQmlBuiltinType(const QStringView &text) const; + bool maybeQmlKeyword(QStringView text) const; + bool maybeQmlBuiltinType(QStringView text) const; private: bool m_qmlEnabled; diff --git a/src/plugins/qmljseditor/qmljssemantichighlighter.cpp b/src/plugins/qmljseditor/qmljssemantichighlighter.cpp index 9db93925a34..1236cc1b9f3 100644 --- a/src/plugins/qmljseditor/qmljssemantichighlighter.cpp +++ b/src/plugins/qmljseditor/qmljssemantichighlighter.cpp @@ -239,7 +239,7 @@ protected: m_scopeBuilder.pop(); } - void processName(const QStringView &name, SourceLocation location) + void processName(QStringView name, SourceLocation location) { if (name.isEmpty()) return;