1aeca2cc3a6f486abff3fdfb4e82903cd3ca4267eJordan Rose// RUN: %clang_cc1 -analyze -analyzer-checker=core -analyzer-output=text -verify %s
2aeca2cc3a6f486abff3fdfb4e82903cd3ca4267eJordan Rose// RUN: %clang_cc1 -analyze -analyzer-checker=core -analyzer-output=text -analyzer-config prune-paths=false -DNPRUNE=1 -verify %s
3aeca2cc3a6f486abff3fdfb4e82903cd3ca4267eJordan Rose
4aeca2cc3a6f486abff3fdfb4e82903cd3ca4267eJordan Rose// "prune-paths" is a debug option only; this is just a simple test to see that
5aeca2cc3a6f486abff3fdfb4e82903cd3ca4267eJordan Rose// it's being honored.
6aeca2cc3a6f486abff3fdfb4e82903cd3ca4267eJordan Rose
7aeca2cc3a6f486abff3fdfb4e82903cd3ca4267eJordan Rosevoid helper() {
8aeca2cc3a6f486abff3fdfb4e82903cd3ca4267eJordan Rose  extern void foo();
9aeca2cc3a6f486abff3fdfb4e82903cd3ca4267eJordan Rose  foo();
10aeca2cc3a6f486abff3fdfb4e82903cd3ca4267eJordan Rose}
11aeca2cc3a6f486abff3fdfb4e82903cd3ca4267eJordan Rose
12aeca2cc3a6f486abff3fdfb4e82903cd3ca4267eJordan Rosevoid test() {
13aeca2cc3a6f486abff3fdfb4e82903cd3ca4267eJordan Rose  helper();
14aeca2cc3a6f486abff3fdfb4e82903cd3ca4267eJordan Rose#if NPRUNE
15aeca2cc3a6f486abff3fdfb4e82903cd3ca4267eJordan Rose  // expected-note@-2 {{Calling 'helper'}}
16aeca2cc3a6f486abff3fdfb4e82903cd3ca4267eJordan Rose  // expected-note@-3 {{Returning from 'helper'}}
17aeca2cc3a6f486abff3fdfb4e82903cd3ca4267eJordan Rose#endif
18aeca2cc3a6f486abff3fdfb4e82903cd3ca4267eJordan Rose
19aeca2cc3a6f486abff3fdfb4e82903cd3ca4267eJordan Rose  *(volatile int *)0 = 1; // expected-warning {{Dereference of null pointer}}
20aeca2cc3a6f486abff3fdfb4e82903cd3ca4267eJordan Rose  // expected-note@-1 {{Dereference of null pointer}}
21aeca2cc3a6f486abff3fdfb4e82903cd3ca4267eJordan Rose}
22