Skip to content

Commit d43cd56

Browse files
pfultz2amai2012
authored andcommitted
Show line number when suggesting std::transform (#1385)
1 parent eee6cf2 commit d43cd56

2 files changed

Lines changed: 7 additions & 7 deletions

File tree

lib/checkstl.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1998,7 +1998,7 @@ void CheckStl::useStlAlgorithm()
19981998
algo = "std::copy";
19991999
else
20002000
algo = "std::transform";
2001-
useStlAlgorithmError(assignTok, algo);
2001+
useStlAlgorithmError(memberCallTok, algo);
20022002
}
20032003
continue;
20042004
}

test/teststl.cpp

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -3321,47 +3321,47 @@ class TestStl : public TestFixture {
33213321
" c.push_back(x);\n"
33223322
"}\n",
33233323
true);
3324-
ASSERT_EQUALS("(style) Consider using std::copy algorithm instead of a raw loop.\n", errout.str());
3324+
ASSERT_EQUALS("[test.cpp:4]: (style) Consider using std::copy algorithm instead of a raw loop.\n", errout.str());
33253325

33263326
check("void foo() {\n"
33273327
" std::vector<int> c;\n"
33283328
" for(int x:v)\n"
33293329
" c.push_back(f(x));\n"
33303330
"}\n",
33313331
true);
3332-
ASSERT_EQUALS("(style) Consider using std::transform algorithm instead of a raw loop.\n", errout.str());
3332+
ASSERT_EQUALS("[test.cpp:4]: (style) Consider using std::transform algorithm instead of a raw loop.\n", errout.str());
33333333

33343334
check("void foo() {\n"
33353335
" std::vector<int> c;\n"
33363336
" for(int x:v)\n"
33373337
" c.push_back(x + 1);\n"
33383338
"}\n",
33393339
true);
3340-
ASSERT_EQUALS("(style) Consider using std::transform algorithm instead of a raw loop.\n", errout.str());
3340+
ASSERT_EQUALS("[test.cpp:4]: (style) Consider using std::transform algorithm instead of a raw loop.\n", errout.str());
33413341

33423342
check("void foo() {\n"
33433343
" std::vector<int> c;\n"
33443344
" for(int x:v)\n"
33453345
" c.push_front(x);\n"
33463346
"}\n",
33473347
true);
3348-
ASSERT_EQUALS("(style) Consider using std::copy algorithm instead of a raw loop.\n", errout.str());
3348+
ASSERT_EQUALS("[test.cpp:4]: (style) Consider using std::copy algorithm instead of a raw loop.\n", errout.str());
33493349

33503350
check("void foo() {\n"
33513351
" std::vector<int> c;\n"
33523352
" for(int x:v)\n"
33533353
" c.push_front(f(x));\n"
33543354
"}\n",
33553355
true);
3356-
ASSERT_EQUALS("(style) Consider using std::transform algorithm instead of a raw loop.\n", errout.str());
3356+
ASSERT_EQUALS("[test.cpp:4]: (style) Consider using std::transform algorithm instead of a raw loop.\n", errout.str());
33573357

33583358
check("void foo() {\n"
33593359
" std::vector<int> c;\n"
33603360
" for(int x:v)\n"
33613361
" c.push_front(x + 1);\n"
33623362
"}\n",
33633363
true);
3364-
ASSERT_EQUALS("(style) Consider using std::transform algorithm instead of a raw loop.\n", errout.str());
3364+
ASSERT_EQUALS("[test.cpp:4]: (style) Consider using std::transform algorithm instead of a raw loop.\n", errout.str());
33653365

33663366
check("void foo() {\n"
33673367
" std::vector<int> c;\n"

0 commit comments

Comments
 (0)