[analyzer] Add NumberObjectConversion checker.
authorArtem Dergachev <artem.dergachev@gmail.com>
Tue, 18 Oct 2016 11:06:28 +0000 (11:06 +0000)
committerArtem Dergachev <artem.dergachev@gmail.com>
Tue, 18 Oct 2016 11:06:28 +0000 (11:06 +0000)
commit940c770d279afbbf22491478e60cacfd93783149
tree40ed3bdfe67a6e639a76c8c505e727995f9d9775
parentf0b4e5db16a81e462db87c4b3d5b52ff1f751b0b
[analyzer] Add NumberObjectConversion checker.

When dealing with objects that represent numbers, such as Objective-C NSNumber,
the language provides little protection from accidentally interpreting
the value of a pointer to such object as the value of the number represented
by the object. Results of such mis-interpretation may be unexpected.

The checker attempts to fill this gap in cases when the code is obviously
incorrect.

With "Pedantic" option enabled, this checker enforces a coding style to
completely prevent errors of this kind (off by default).

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

llvm-svn: 284473
clang/include/clang/StaticAnalyzer/Checkers/Checkers.td
clang/lib/StaticAnalyzer/Checkers/CMakeLists.txt
clang/lib/StaticAnalyzer/Checkers/NumberObjectConversionChecker.cpp [new file with mode: 0644]
clang/test/Analysis/Inputs/system-header-simulator-objc.h
clang/test/Analysis/number-object-conversion.cpp [new file with mode: 0644]
clang/test/Analysis/number-object-conversion.m [new file with mode: 0644]