Main reason for this change is that these checkers were implemented in the same class but had different dependency ordering. (NonNullParamChecker should run before StdCLibraryFunctionArgs to get more special warning about null arguments, but the apiModeling.StdCLibraryFunctions was a modeling checker that should run before other non-modeling checkers. The modeling checker changes state in a way that makes it impossible to detect a null argument by NonNullParamChecker.) To make it more simple, the modeling part is removed as separate checker and can be only used if checker StdCLibraryFunctions is turned on, that produces the warnings too. Modeling the functions without bug detection (for invalid argument) is not possible. The modeling of standard functions does not happen by default from this change on. Reviewed By: Szelethus Differential Revision: https://reviews.llvm.org/D151225
18 lines
605 B
C++
18 lines
605 B
C++
// RUN: %clang_analyze_cc1 %s \
|
|
// RUN: -analyzer-checker=core \
|
|
// RUN: -analyzer-checker=alpha.unix.StdCLibraryFunctions \
|
|
// RUN: -analyzer-checker=debug.StdCLibraryFunctionsTester \
|
|
// RUN: -analyzer-checker=debug.ExprInspection \
|
|
// RUN: -analyzer-config eagerly-assume=false \
|
|
// RUN: -triple i686-unknown-linux \
|
|
// RUN: -verify
|
|
|
|
void clang_analyzer_eval(int);
|
|
|
|
int __defaultparam(void *, int y = 3);
|
|
|
|
void test_arg_constraint_on_fun_with_default_param() {
|
|
__defaultparam(nullptr); // \
|
|
// expected-warning{{The 1st argument to '__defaultparam' is NULL but should not be NULL}}
|
|
}
|