xref: /minix3/external/bsd/llvm/dist/clang/test/Coverage/html-diagnostics.c (revision 0a6a1f1d05b60e214de2f05a7310ddd1f0e590e7)
1f4a2713aSLionel Sambuc // RUN: rm -rf %t
2f4a2713aSLionel Sambuc // RUN: %clang_cc1 -analyze -analyzer-output=html -analyzer-checker=core -o %t %s
3*0a6a1f1dSLionel Sambuc // RUN: find %t -name "*.html" -exec cat "{}" ";" | FileCheck %s
4f4a2713aSLionel Sambuc 
5*0a6a1f1dSLionel Sambuc // REQUIRES: staticanalyzer
6f4a2713aSLionel Sambuc 
7f4a2713aSLionel Sambuc // CHECK: <h3>Annotated Source Code</h3>
8f4a2713aSLionel Sambuc 
9f4a2713aSLionel Sambuc // Without tweaking expr, the expr would hit to the line below
10f4a2713aSLionel Sambuc // emitted to the output as comment.
11f4a2713aSLionel Sambuc // CHECK: {{[D]ereference of null pointer}}
12f4a2713aSLionel Sambuc 
f0(int x)13f4a2713aSLionel Sambuc void f0(int x) {
14f4a2713aSLionel Sambuc   int *p = &x;
15f4a2713aSLionel Sambuc 
16f4a2713aSLionel Sambuc   if (x > 10) {
17f4a2713aSLionel Sambuc     if (x == 22)
18f4a2713aSLionel Sambuc       p = 0;
19f4a2713aSLionel Sambuc   }
20f4a2713aSLionel Sambuc 
21f4a2713aSLionel Sambuc   *p = 10;
22f4a2713aSLionel Sambuc }
23f4a2713aSLionel Sambuc 
24f4a2713aSLionel Sambuc 
25