llvm-project/clang/test/Analysis/std-c-library-functions-arg-constraints.cpp
Balázs Kéri ce1fb03db8 [clang][analyzer] Improve bug reports of StdLibraryFunctionsChecker.
Add an additional explanation of what is wrong if a constraint is
not satisfied, in some cases.
Additionally the bug report generation is changed to use raw_ostream.

Reviewed By: Szelethus, NoQ

Differential Revision: https://reviews.llvm.org/D144003
2023-04-12 10:24:55 +02:00

19 lines
671 B
C++

// RUN: %clang_analyze_cc1 %s \
// RUN: -analyzer-checker=core \
// RUN: -analyzer-checker=apiModeling.StdCLibraryFunctions \
// RUN: -analyzer-checker=alpha.unix.StdCLibraryFunctionArgs \
// 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}}
}