explicit-suppression.cpp revision c63a460d78a7625ff38d2b3580f78030c44f07db
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@79 {{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
70
71
72
73
74
75
76
77
78// PR15613: expected-* can't refer to diagnostics in other source files.
79// The current implementation only matches line numbers, but has an upper limit
80// of the number of lines in the main source file.
81