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