From da198e0726f8273eea59884e2ff7d68f4a97adff Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Daniel=20Marjam=C3=A4ki?= Date: Mon, 4 Jan 2021 01:47:04 +0100 Subject: [PATCH] Fix Cppcheck self check warning; use reference to avoid data copying --- lib/checktype.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/checktype.cpp b/lib/checktype.cpp index 9d73d0ccd..87e18a996 100644 --- a/lib/checktype.cpp +++ b/lib/checktype.cpp @@ -247,7 +247,7 @@ void CheckType::checkIntegerOverflowOptimisations() if (!Token::Match(tok, "<|<=|>=|>") || !tok->isBinaryOp()) continue; - const std::string cmp = tok->str(); + const std::string &cmp = tok->str(); const Token * const lhs = tok->astOperand1(); if (!Token::Match(lhs, "[+-]") || !lhs->isBinaryOp() || !lhs->valueType() || !lhs->valueType()->isIntegral() || lhs->valueType()->sign != ValueType::Sign::SIGNED) continue;