llvm/clang/test/Analysis/weak-dependencies.c
Kirstóf Umann cfd6b4b811 [analyzer] Don't allow hidden checkers to emit diagnostics
Hidden checkers (those marked with Hidden in Checkers.td) are meant for
development purposes only, and are only displayed under
-analyzer-checker-help-developer, so users shouldn't see reports from them.

I moved StdLibraryFunctionsArg checker to the unix package from apiModeling as
it violated this rule. I believe this change doesn't deserve a different
revision because it is in alpha, and the name is so bad anyways I don't
immediately care where it is, because we'll have to revisit it soon enough.

Differential Revision: https://reviews.llvm.org/D81750
2020-07-06 15:34:51 +02:00

16 lines
481 B
C

// RUN: %clang_analyze_cc1 %s -verify \
// RUN: -analyzer-checker=alpha.unix.StdCLibraryFunctionArgs \
// RUN: -analyzer-checker=core
typedef __typeof(sizeof(int)) size_t;
struct FILE;
typedef struct FILE FILE;
size_t fread(void *restrict, size_t, size_t, FILE *restrict) __attribute__((nonnull(1)));
void f(FILE *F) {
int *p = 0;
fread(p, sizeof(int), 5, F); // expected-warning{{Null pointer passed to 1st parameter expecting 'nonnull' [core.NonNullParamChecker]}}
}