[analyzer] CastValueChecker: Model casts
authorCsaba Dabis <dabis.csaba98@gmail.com>
Wed, 10 Jul 2019 00:20:03 +0000 (00:20 +0000)
committerCsaba Dabis <dabis.csaba98@gmail.com>
Wed, 10 Jul 2019 00:20:03 +0000 (00:20 +0000)
commit693936ab8fe84488e9c888245890dc7936d857c3
tree0b5d13d9c5ec5b4872a5fa2896c7381cca531990
parent6a29680efb0b9866a0106e20c6682fd485ddeb4e
[analyzer] CastValueChecker: Model casts

Summary:
It models the LLVM casts:
- `cast<>`
- `dyn_cast<>`
- `cast_or_null<>`
- `dyn_cast_or_null<>`

It has a very basic support without checking the `classof()` function.

(It reapplies the reverted 'llvm-svn: 365582' patch with proper test file.)

Reviewed By: NoQ

Tags: #clang

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

llvm-svn: 365585
clang/include/clang/StaticAnalyzer/Checkers/Checkers.td
clang/include/clang/StaticAnalyzer/Core/PathSensitive/CheckerContext.h
clang/lib/StaticAnalyzer/Checkers/CMakeLists.txt
clang/lib/StaticAnalyzer/Checkers/CastValueChecker.cpp [new file with mode: 0644]
clang/test/Analysis/cast-value.cpp [new file with mode: 0644]
clang/test/Analysis/return-value-guaranteed.cpp