Show line number when suggesting std::transform (#1385)

This commit is contained in:
Paul Fultz II 2018-09-21 03:38:30 -05:00 committed by amai2012
parent eee6cf20ff
commit d43cd56afd
2 changed files with 7 additions and 7 deletions

View File

@ -1998,7 +1998,7 @@ void CheckStl::useStlAlgorithm()
algo = "std::copy"; algo = "std::copy";
else else
algo = "std::transform"; algo = "std::transform";
useStlAlgorithmError(assignTok, algo); useStlAlgorithmError(memberCallTok, algo);
} }
continue; continue;
} }

View File

@ -3321,7 +3321,7 @@ private:
" c.push_back(x);\n" " c.push_back(x);\n"
"}\n", "}\n",
true); 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" check("void foo() {\n"
" std::vector<int> c;\n" " std::vector<int> c;\n"
@ -3329,7 +3329,7 @@ private:
" c.push_back(f(x));\n" " c.push_back(f(x));\n"
"}\n", "}\n",
true); 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" check("void foo() {\n"
" std::vector<int> c;\n" " std::vector<int> c;\n"
@ -3337,7 +3337,7 @@ private:
" c.push_back(x + 1);\n" " c.push_back(x + 1);\n"
"}\n", "}\n",
true); 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" check("void foo() {\n"
" std::vector<int> c;\n" " std::vector<int> c;\n"
@ -3345,7 +3345,7 @@ private:
" c.push_front(x);\n" " c.push_front(x);\n"
"}\n", "}\n",
true); 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" check("void foo() {\n"
" std::vector<int> c;\n" " std::vector<int> c;\n"
@ -3353,7 +3353,7 @@ private:
" c.push_front(f(x));\n" " c.push_front(f(x));\n"
"}\n", "}\n",
true); 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" check("void foo() {\n"
" std::vector<int> c;\n" " std::vector<int> c;\n"
@ -3361,7 +3361,7 @@ private:
" c.push_front(x + 1);\n" " c.push_front(x + 1);\n"
"}\n", "}\n",
true); 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" check("void foo() {\n"
" std::vector<int> c;\n" " std::vector<int> c;\n"