summaryrefslogtreecommitdiffstats
path: root/clang/test/Analysis/diagnostics/no-prune-paths.c
blob: 8f807922176e12afa9a41f4e1a6a85abc23582b8 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
// RUN: %clang_analyze_cc1 -analyzer-checker=core -analyzer-output=text -verify %s
// RUN: %clang_analyze_cc1 -analyzer-checker=core -analyzer-output=text -analyzer-config prune-paths=false -DNPRUNE=1 -verify %s

// "prune-paths" is a debug option only; this is just a simple test to see that
// it's being honored.

void helper(void) {
  extern void foo(void);
  foo();
}

void test(void) {
  helper();
#if NPRUNE
  // expected-note@-2 {{Calling 'helper'}}
  // expected-note@-3 {{Returning from 'helper'}}
#endif

  *(volatile int *)0 = 1; // expected-warning {{Dereference of null pointer}}
  // expected-note@-1 {{Dereference of null pointer}}
}