From d43cd56afd88e7a604db3602a03911167f778ada Mon Sep 17 00:00:00 2001 From: Paul Fultz II Date: Fri, 21 Sep 2018 03:38:30 -0500 Subject: [PATCH] Show line number when suggesting std::transform (#1385) --- lib/checkstl.cpp | 2 +- test/teststl.cpp | 12 ++++++------ 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/lib/checkstl.cpp b/lib/checkstl.cpp index 6af7b11c2..659f5e08a 100644 --- a/lib/checkstl.cpp +++ b/lib/checkstl.cpp @@ -1998,7 +1998,7 @@ void CheckStl::useStlAlgorithm() algo = "std::copy"; else algo = "std::transform"; - useStlAlgorithmError(assignTok, algo); + useStlAlgorithmError(memberCallTok, algo); } continue; } diff --git a/test/teststl.cpp b/test/teststl.cpp index a2965bbcd..c94a9acaf 100644 --- a/test/teststl.cpp +++ b/test/teststl.cpp @@ -3321,7 +3321,7 @@ private: " c.push_back(x);\n" "}\n", true); - ASSERT_EQUALS("(style) Consider using std::copy algorithm instead of a raw loop.\n", errout.str()); + ASSERT_EQUALS("[test.cpp:4]: (style) Consider using std::copy algorithm instead of a raw loop.\n", errout.str()); check("void foo() {\n" " std::vector c;\n" @@ -3329,7 +3329,7 @@ private: " c.push_back(f(x));\n" "}\n", true); - ASSERT_EQUALS("(style) Consider using std::transform algorithm instead of a raw loop.\n", errout.str()); + ASSERT_EQUALS("[test.cpp:4]: (style) Consider using std::transform algorithm instead of a raw loop.\n", errout.str()); check("void foo() {\n" " std::vector c;\n" @@ -3337,7 +3337,7 @@ private: " c.push_back(x + 1);\n" "}\n", true); - ASSERT_EQUALS("(style) Consider using std::transform algorithm instead of a raw loop.\n", errout.str()); + ASSERT_EQUALS("[test.cpp:4]: (style) Consider using std::transform algorithm instead of a raw loop.\n", errout.str()); check("void foo() {\n" " std::vector c;\n" @@ -3345,7 +3345,7 @@ private: " c.push_front(x);\n" "}\n", true); - ASSERT_EQUALS("(style) Consider using std::copy algorithm instead of a raw loop.\n", errout.str()); + ASSERT_EQUALS("[test.cpp:4]: (style) Consider using std::copy algorithm instead of a raw loop.\n", errout.str()); check("void foo() {\n" " std::vector c;\n" @@ -3353,7 +3353,7 @@ private: " c.push_front(f(x));\n" "}\n", true); - ASSERT_EQUALS("(style) Consider using std::transform algorithm instead of a raw loop.\n", errout.str()); + ASSERT_EQUALS("[test.cpp:4]: (style) Consider using std::transform algorithm instead of a raw loop.\n", errout.str()); check("void foo() {\n" " std::vector c;\n" @@ -3361,7 +3361,7 @@ private: " c.push_front(x + 1);\n" "}\n", true); - ASSERT_EQUALS("(style) Consider using std::transform algorithm instead of a raw loop.\n", errout.str()); + ASSERT_EQUALS("[test.cpp:4]: (style) Consider using std::transform algorithm instead of a raw loop.\n", errout.str()); check("void foo() {\n" " std::vector c;\n"