explicit-suppression.cpp revision a12643622ad3b85972dfdd80fe9006a3e8d8fb80
1// RUN: %clang_cc1 -analyze -analyzer-checker=core,debug.ExprInspection -analyzer-config suppress-c++-stdlib=false -verify %s
2// RUN: %clang_cc1 -analyze -analyzer-checker=core,debug.ExprInspection -analyzer-config suppress-c++-stdlib=true -DSUPPRESSED=1 -verify %s
3
4#ifdef SUPPRESSED
5// expected-no-diagnostics
6#endif
7
8#include "../Inputs/system-header-simulator-cxx.h"
9
10void clang_analyzer_eval(bool);
11
12void testCopyNull(int *I, int *E) {
13  std::copy(I, E, (int *)0);
14#ifndef SUPPRESSED
15  // This line number comes from system-header-simulator-cxx.h.
16  // expected-warning@65 {{Dereference of null pointer}}
17#endif
18}
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69// PR15613: expected-* can't refer to diagnostics in other source files.
70// The current implementation only matches line numbers, but has an upper limit
71// of the number of lines in the main source file.
72