[PATCH] D38455: [clang-tidy] new cppcoreguidelines-narrowing-conversions check.
Clement Courbet via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Tue Mar 20 09:36:19 PDT 2018
courbet added inline comments.
================
Comment at: clang-tidy/cppcoreguidelines/NarrowingConversionsCheck.cpp:26
+ binaryOperator(
+ anyOf(hasOperatorName("+="), hasOperatorName("-=")),
+ hasLHS(hasType(isInteger())),
----------------
aaron.ballman wrote:
> Why only these two operators? This does not match the behavior from the C++ Core Guideline check itself (https://github.com/isocpp/CppCoreGuidelines/blob/master/CppCoreGuidelines.md#Res-narrowing).
These provided the best signal to noise ratio. Also they are the most dangerous (in a loop, you might end up losing one unit per iteration). I'll add other operators later if that's fine with you.
Repository:
rCTE Clang Tools Extra
https://reviews.llvm.org/D38455
More information about the cfe-commits
mailing list