Clang Project

clang_source_code/test/Coverage/html-diagnostics.c
1// RUN: rm -rf %t
2// RUN: %clang_cc1 -analyze -analyzer-output=html -analyzer-checker=core -o %t %s
3// RUN: find %t -name "*.html" -exec cat "{}" ";" | FileCheck %s
4//
5// RUN: rm -rf %t
6// RUN: %clang_cc1 -analyze -analyzer-output=html-single-file -analyzer-checker=core -o %t %s
7// RUN: find %t -name "*.html" -exec cat "{}" ";" | FileCheck %s
8
9// REQUIRES: staticanalyzer
10
11// CHECK: <h3>Annotated Source Code</h3>
12
13// Make sure it's not generated as a multi-file HTML output
14// CHECK-NOT: <h4 class=FileName>{{.*}}
15
16// Without tweaking expr, the expr would hit to the line below
17// emitted to the output as comment.
18// CHECK: {{[D]ereference of null pointer}}
19
20void f0(int x) {
21  int *p = &x;
22
23  if (x > 10) {
24    if (x == 22)
25      p = 0;
26  }
27
28  *p = 10;
29}
30
31
32