[analyzer] pr43179: Make CallDescription defensive against C variadic functions.
authorArtem Dergachev <artem.dergachev@gmail.com>
Fri, 6 Sep 2019 20:55:24 +0000 (20:55 +0000)
committerArtem Dergachev <artem.dergachev@gmail.com>
Fri, 6 Sep 2019 20:55:24 +0000 (20:55 +0000)
commit2b1b4cab9605a33a6c90079b44bdddf048104e08
tree42cb92ed9d4f895d7681658c4d64d9820e1e6407
parent7c848acf0a86f521ee432fd22d9583cd73193545
[analyzer] pr43179: Make CallDescription defensive against C variadic functions.

Most functions that our checkers react upon are not C-style variadic functions,
and therefore they have as many actual arguments as they have formal parameters.

However, it's not impossible to define a variadic function with the same name.
This will crash any checker that relies on CallDescription to check the number
of arguments but silently assumes that the number of parameters is the same.

Change CallDescription to check both the number of arguments and the number of
parameters by default.

If we're intentionally trying to match variadic functions, allow specifying
arguments and parameters separately (possibly omitting any of them).
For now we only have one CallDescription which would make use of those,
namely __builtin_va_start itself.

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

llvm-svn: 371256
clang/include/clang/StaticAnalyzer/Core/PathSensitive/CallEvent.h
clang/lib/StaticAnalyzer/Checkers/ValistChecker.cpp
clang/lib/StaticAnalyzer/Core/CallEvent.cpp
clang/test/Analysis/cast-value-weird.cpp [new file with mode: 0644]