forked from qt-creator/qt-creator
Fix warnings about possible detach of temporary objects
Calling first() or last() on temporary container may unnecessarily detach the container. Fix it by calling constFirst() and constLast(). Change-Id: I2460efd5dbee1534eec8a514d9bff2a947bfddf9 Reviewed-by: Tim Jenssen <tim.jenssen@qt.io>
This commit is contained in:
@@ -127,7 +127,7 @@ QString CppToolsJsExtension::includeStatement(
|
||||
{
|
||||
if (fullyQualifiedClassName.isEmpty())
|
||||
return {};
|
||||
const QString className = parts(fullyQualifiedClassName).last();
|
||||
const QString className = parts(fullyQualifiedClassName).constLast();
|
||||
if (className.isEmpty() || specialClasses.contains(className))
|
||||
return {};
|
||||
if (className.startsWith('Q') && className.length() > 2 && className.at(1).isUpper())
|
||||
|
||||
Reference in New Issue
Block a user