From 4ed15d87b6cd4d030fee39632a1a226b5ef1cc4e Mon Sep 17 00:00:00 2001 From: PKEuS Date: Fri, 13 Jul 2012 05:15:58 -0700 Subject: [PATCH] Properly fixed test failure and line numbers in uselessCallsEmpty error --- lib/checkstl.cpp | 2 +- test/teststl.cpp | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/checkstl.cpp b/lib/checkstl.cpp index 80844b6ad..b3f7f0593 100644 --- a/lib/checkstl.cpp +++ b/lib/checkstl.cpp @@ -1347,7 +1347,7 @@ void CheckStl::uselessCalls() else if (Token::simpleMatch(tok->linkAt(2)->tokAt(-2), ", 0 )")) uselessCallsSubstrError(tok, true); } else if (Token::Match(tok, "[{}:;] %var% . empty ( ) ;") && style) - uselessCallsEmptyError(tok); + uselessCallsEmptyError(tok->next()); } } diff --git a/test/teststl.cpp b/test/teststl.cpp index 91882b8dd..274a84a2e 100644 --- a/test/teststl.cpp +++ b/test/teststl.cpp @@ -1868,7 +1868,7 @@ private: " v.empty();\n" " return v.empty();\n" "}"); - ASSERT_EQUALS("[test.cpp:1]: (warning) Useless call of function 'empty()'. Did you intend to call 'clear()' instead?\n", errout.str()); + ASSERT_EQUALS("[test.cpp:2]: (warning) Useless call of function 'empty()'. Did you intend to call 'clear()' instead?\n", errout.str()); } };