From 3da1de7893ffeb7d8f5d714b908caf74402e9556 Mon Sep 17 00:00:00 2001 From: PKEuS Date: Tue, 7 Mar 2017 21:18:08 +0100 Subject: [PATCH] Do not exclude std::shared_ptr and std::unique_ptr from checkPassByReference() (#7834) These two types are larger than one pointer. Hence, passing by reference is faster. --- lib/checkother.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/checkother.cpp b/lib/checkother.cpp index 723c20306..96b6c09a6 100644 --- a/lib/checkother.cpp +++ b/lib/checkother.cpp @@ -1455,7 +1455,7 @@ void CheckOther::checkPassByReference() const Token* const tok = var->typeStartToken(); if (var->isStlStringType()) { ; - } else if (var->isStlType() && Token::Match(tok, "std :: %type% <") && !Token::simpleMatch(tok->linkAt(3), "> ::") && !Token::Match(tok->tokAt(2), "initializer_list|shared_ptr|weak_ptr|unique_ptr|auto_ptr")) { + } else if (var->isStlType() && Token::Match(tok, "std :: %type% <") && !Token::simpleMatch(tok->linkAt(3), "> ::") && !Token::Match(tok->tokAt(2), "initializer_list|weak_ptr|auto_ptr")) { ; } else if (var->type() && !var->type()->isEnumType()) { // Check if type is a struct or class. // Ensure that it is a large object.