[clang-tidy] Improving narrowing conversions
authorGuillaume Chatelet <gchatelet@google.com>
Mon, 26 Nov 2018 16:25:55 +0000 (16:25 +0000)
committerGuillaume Chatelet <gchatelet@google.com>
Mon, 26 Nov 2018 16:25:55 +0000 (16:25 +0000)
commit10a7ee704417a9af6150c574f32befc32c3e2182
tree1136a948215962280fa959da065ba6aed8d2d741
parentb9e4852c92c0fb5cf3ab21d5a9ef3805758233b8
[clang-tidy] Improving narrowing conversions

Summary:
Newly flagged narrowing conversions:
 - integer to narrower signed integer (this is compiler implementation defined),
 - integer - floating point narrowing conversions,
 - floating point - integer narrowing conversions,
 - constants with narrowing conversions (even in ternary operator).

Reviewers: hokein, alexfh, aaron.ballman, JonasToth

Reviewed By: aaron.ballman, JonasToth

Subscribers: lebedev.ri, courbet, nemanjai, xazax.hun, kbarton, cfe-commits

Tags: #clang-tools-extra

Differential Revision: https://reviews.llvm.org/D53488

llvm-svn: 347570
clang-tools-extra/clang-tidy/cppcoreguidelines/NarrowingConversionsCheck.cpp
clang-tools-extra/clang-tidy/cppcoreguidelines/NarrowingConversionsCheck.h
clang-tools-extra/docs/ReleaseNotes.rst
clang-tools-extra/docs/clang-tidy/checks/cppcoreguidelines-narrowing-conversions.rst
clang-tools-extra/test/clang-tidy/cppcoreguidelines-narrowing-conversions-long-is-32bits.cpp [new file with mode: 0644]
clang-tools-extra/test/clang-tidy/cppcoreguidelines-narrowing-conversions-narrowingfloatingpoint-option.cpp [new file with mode: 0644]
clang-tools-extra/test/clang-tidy/cppcoreguidelines-narrowing-conversions-pedanticmode-option.cpp [new file with mode: 0644]
clang-tools-extra/test/clang-tidy/cppcoreguidelines-narrowing-conversions-unsigned-char.cpp [new file with mode: 0644]
clang-tools-extra/test/clang-tidy/cppcoreguidelines-narrowing-conversions.cpp