[PATCH] D46317: [clang-tidy] New check bugprone-map-subscript-operator-lookup
Kalle Huttunen via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Tue May 1 08:15:33 PDT 2018
khuttun added a comment.
This checker is inspired by Louis Brandy's excellent CppCon 2017 talk (https://www.youtube.com/watch?v=lkgszkPnV8g) where he describes the side-effects of std::map::operator[] as being one of the most common source of bugs in Facebook's C++ code. In the talk he mentions that banning the usage of the operator was discussed at Facebook. This checker ban's reading the map with it, writing is still allowed.
The documentation is intentionally still missing from the commit. If the reviewers feel that this sort of checker would be useful for clang-tidy, I'll add the documentation and more tests.
Repository:
rCTE Clang Tools Extra
https://reviews.llvm.org/D46317
More information about the cfe-commits
mailing list