blob: dbdbb30c4b2f9564c563dbae5cc147c4a087f9f7 [file] [log] [blame]
Jordan Rosecc0b1bf2012-08-31 00:36:26 +00001// RUN: %clang_cc1 -analyze -analyzer-checker=core -verify %s
2// (sanity check)
3
4// RUN: rm -rf %t.dir
5// RUN: mkdir -p %t.dir
6// RUN: %clang_cc1 -analyze -analyzer-checker=core -analyzer-output=plist-html -o %t.dir/index.plist %s
Reid Kleckner2e1538f2016-10-20 23:11:45 +00007// RUN: ls %t.dir | grep '\.html' | count 1
8// RUN: grep '\.html' %t.dir/index.plist | count 1
Jordan Rosecc0b1bf2012-08-31 00:36:26 +00009
10// This tests two things: that the two calls to null_deref below are coalesced
11// into a single bug by both the plist and HTML diagnostics, and that the plist
12// diagnostics have a reference to the HTML diagnostics. (It would be nice to
13// check more carefully that the two actually match, but that's hard to write
14// in a lit RUN line.)
15
16#define CALL_FN(a) null_deref(a)
17
18void null_deref(int *a) {
19 if (a)
20 return;
21 *a = 1; // expected-warning{{null}}
22}
23
24void test1() {
25 CALL_FN(0);
26}
27
28void test2(int *p) {
29 CALL_FN(p);
30}