Fixed #2734 (False positive: reports 'should be passed by reference' for std::streamoff)
This commit is contained in:
parent
47a1332e6a
commit
68e7003bb1
|
@ -2517,7 +2517,7 @@ void CheckOther::checkConstantFunctionParameter()
|
||||||
|
|
||||||
for (const Token *tok = _tokenizer->tokens(); tok; tok = tok->next())
|
for (const Token *tok = _tokenizer->tokens(); tok; tok = tok->next())
|
||||||
{
|
{
|
||||||
if (Token::Match(tok, "[,(] const std :: %type% %var% [,)]"))
|
if (Token::Match(tok, "[,(] const std :: string %var% [,)]"))
|
||||||
{
|
{
|
||||||
passedByValueError(tok, tok->strAt(5));
|
passedByValueError(tok, tok->strAt(5));
|
||||||
}
|
}
|
||||||
|
|
|
@ -837,6 +837,10 @@ private:
|
||||||
|
|
||||||
testPassedByValue("void f(const std::map<std::string,int> v) {}");
|
testPassedByValue("void f(const std::map<std::string,int> v) {}");
|
||||||
ASSERT_EQUALS("[test.cpp:1]: (performance) Function parameter 'v' should be passed by reference.\n", errout.str());
|
ASSERT_EQUALS("[test.cpp:1]: (performance) Function parameter 'v' should be passed by reference.\n", errout.str());
|
||||||
|
|
||||||
|
testPassedByValue("void f(const std::streamoff pos) {}");
|
||||||
|
ASSERT_EQUALS("", errout.str());
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void mathfunctionCall1()
|
void mathfunctionCall1()
|
||||||
|
|
Loading…
Reference in New Issue