From c82d2cbd546f70d71493db483e8c2d82e6c022e1 Mon Sep 17 00:00:00 2001 From: Alessandro Portale Date: Thu, 17 Jan 2019 01:59:27 +0100 Subject: [PATCH] Fix warning: "Don't call QList::last() on temporary" [-Wclazy-detaching-temporary] Change-Id: I5e06e44fc45c80ea1dca518611d4f0c28a738061 Reviewed-by: Thomas Hartmann --- src/plugins/cpptools/cppfindreferences.cpp | 2 +- src/plugins/qmljseditor/quicktoolbar.cpp | 4 ++-- src/plugins/valgrind/callgrind/callgrindparser.cpp | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/src/plugins/cpptools/cppfindreferences.cpp b/src/plugins/cpptools/cppfindreferences.cpp index b017cb7e8fc..00f46399ec6 100644 --- a/src/plugins/cpptools/cppfindreferences.cpp +++ b/src/plugins/cpptools/cppfindreferences.cpp @@ -350,7 +350,7 @@ void CppFindReferences::findUsages(CPlusPlus::Symbol *symbol, if (symbol->isClass() || symbol->isForwardClassDeclaration()) { CPlusPlus::Overview overview; - parameters.prettySymbolName = overview.prettyName(context.path(symbol).last()); + parameters.prettySymbolName = overview.prettyName(context.path(symbol).constLast()); } search->setUserData(qVariantFromValue(parameters)); diff --git a/src/plugins/qmljseditor/quicktoolbar.cpp b/src/plugins/qmljseditor/quicktoolbar.cpp index f83cc2e13ee..89c6dc349b0 100644 --- a/src/plugins/qmljseditor/quicktoolbar.cpp +++ b/src/plugins/qmljseditor/quicktoolbar.cpp @@ -309,8 +309,8 @@ void QuickToolBar::setProperty(const QString &propertyName, const QVariant &valu int column; - int changeSetPos = changeSet.operationList().last().pos1; - int changeSetLength = changeSet.operationList().last().text.length(); + int changeSetPos = changeSet.operationList().constLast().pos1; + int changeSetLength = changeSet.operationList().constLast().text.length(); QTextCursor tc = m_editorWidget->textCursor(); tc.beginEditBlock(); changeSet.apply(&tc); diff --git a/src/plugins/valgrind/callgrind/callgrindparser.cpp b/src/plugins/valgrind/callgrind/callgrindparser.cpp index 620734df2f9..384da898c5f 100644 --- a/src/plugins/valgrind/callgrind/callgrindparser.cpp +++ b/src/plugins/valgrind/callgrind/callgrindparser.cpp @@ -479,7 +479,7 @@ void Parser::Private::parseCostItem(const char *begin, const char *end) const CostItem *lastCostItem = nullptr; if (!currentFunction->costItems().isEmpty()) - lastCostItem = currentFunction->costItems().last(); + lastCostItem = currentFunction->costItems().constLast(); // parse positions ("where") for (int i = 0; i < addressValuesCount; ++i) {