[clang][modules] Don't prevent translation of FW_Private includes when explicitly...
[llvm-project.git] / clang / test / Analysis / returns_nonnull-attribute.cpp
blob32d7b5200ef33d648fe8663ba3e2969c4dc62a16
1 // RUN: %clang_analyze_cc1 -analyzer-checker=core,apiModeling.TrustReturnsNonnull -verify %s
3 int *foo() __attribute__((returns_nonnull));
5 int *foo_no_attribute();
7 int test_foo() {
8 int *x = foo();
9 if (x) {}
10 return *x; // no-warning
13 int test_foo_no_attribute() {
14 int *x = foo_no_attribute();
15 if (x) {}
16 return *x; // expected-warning{{Dereference of null pointer}}
19 void test(void *(*f)(void)) {
20 f(); // Shouldn't crash compiler