forked from qt-creator/qt-creator
CppTool: Avoid a use of QStringRef
Change-Id: I2a82bad7d91e059915526f0cf7b89f0d8367463a Reviewed-by: Christian Kandeler <christian.kandeler@qt.io>
This commit is contained in:
@@ -195,7 +195,7 @@ void CppHighlighter::highlightBlock(const QString &text)
|
||||
|
||||
} else if (tk.isKeyword()
|
||||
|| (m_languageFeatures.qtKeywordsEnabled
|
||||
&& CppTools::isQtKeyword(text.midRef(tk.utf16charsBegin(), tk.utf16chars())))
|
||||
&& CppTools::isQtKeyword(QStringView{text}.mid(tk.utf16charsBegin(), tk.utf16chars())))
|
||||
|| (m_languageFeatures.objCEnabled && tk.isObjCAtKeyword())) {
|
||||
setFormat(tk.utf16charsBegin(), tk.utf16chars(), formatForCategory(C_KEYWORD));
|
||||
} else if (tk.isPrimitiveType()) {
|
||||
|
@@ -123,7 +123,7 @@ CppTools::CheckSymbols *createHighlighter(const CPlusPlus::Document::Ptr &doc,
|
||||
const QString name = macro.macro().nameToQString();
|
||||
|
||||
//Filter out QtKeywords
|
||||
if (features.qtKeywordsEnabled && isQtKeyword(QStringRef(&name)))
|
||||
if (features.qtKeywordsEnabled && isQtKeyword(name))
|
||||
continue;
|
||||
|
||||
SimpleLexer tokenize;
|
||||
|
@@ -214,7 +214,7 @@ bool isValidIdentifier(const QString &s)
|
||||
return true;
|
||||
}
|
||||
|
||||
bool isQtKeyword(const QStringRef &text)
|
||||
bool isQtKeyword(QStringView text)
|
||||
{
|
||||
switch (text.length()) {
|
||||
case 4:
|
||||
|
@@ -52,7 +52,7 @@ namespace CppTools {
|
||||
void CPPTOOLS_EXPORT moveCursorToEndOfIdentifier(QTextCursor *tc);
|
||||
void CPPTOOLS_EXPORT moveCursorToStartOfIdentifier(QTextCursor *tc);
|
||||
|
||||
bool CPPTOOLS_EXPORT isQtKeyword(const QStringRef &text);
|
||||
bool CPPTOOLS_EXPORT isQtKeyword(QStringView text);
|
||||
|
||||
bool CPPTOOLS_EXPORT isValidAsciiIdentifierChar(const QChar &ch);
|
||||
bool CPPTOOLS_EXPORT isValidFirstIdentifierChar(const QChar &ch);
|
||||
|
Reference in New Issue
Block a user