xref: /llvm-project/clang/test/Coverage/html-diagnostics.c (revision f0cadcd9f385d36dc751cdb32476b32ec43306b5)
18b576979SDaniel Dunbar // RUN: rm -rf %t
29eb02dfaSArgyrios Kyrtzidis // RUN: %clang_cc1 -analyze -analyzer-output=html -analyzer-checker=core -o %t %s
3bf37ee79SNAKAMURA Takumi // RUN: find %t -name "*.html" -exec cat "{}" ";" | FileCheck %s
4*f0cadcd9SDevin Coughlin //
5*f0cadcd9SDevin Coughlin // RUN: rm -rf %t
6*f0cadcd9SDevin Coughlin // RUN: %clang_cc1 -analyze -analyzer-output=html-single-file -analyzer-checker=core -o %t %s
7*f0cadcd9SDevin Coughlin // RUN: find %t -name "*.html" -exec cat "{}" ";" | FileCheck %s
8aef52f4cSDaniel Dunbar 
91fb02cb6SNAKAMURA Takumi // REQUIRES: staticanalyzer
101fb02cb6SNAKAMURA Takumi 
11aef52f4cSDaniel Dunbar // CHECK: <h3>Annotated Source Code</h3>
129642cc6aSAndrew Trick 
13*f0cadcd9SDevin Coughlin // Make sure it's not generated as a multi-file HTML output
14*f0cadcd9SDevin Coughlin // CHECK-NOT: <h4 class=FileName>{{.*}}
15*f0cadcd9SDevin Coughlin 
169642cc6aSAndrew Trick // Without tweaking expr, the expr would hit to the line below
179642cc6aSAndrew Trick // emitted to the output as comment.
189642cc6aSAndrew Trick // CHECK: {{[D]ereference of null pointer}}
1923bd6cc1SDaniel Dunbar 
f0(int x)2023bd6cc1SDaniel Dunbar void f0(int x) {
2123bd6cc1SDaniel Dunbar   int *p = &x;
2223bd6cc1SDaniel Dunbar 
2323bd6cc1SDaniel Dunbar   if (x > 10) {
2423bd6cc1SDaniel Dunbar     if (x == 22)
2523bd6cc1SDaniel Dunbar       p = 0;
2623bd6cc1SDaniel Dunbar   }
2723bd6cc1SDaniel Dunbar 
2823bd6cc1SDaniel Dunbar   *p = 10;
2923bd6cc1SDaniel Dunbar }
3023bd6cc1SDaniel Dunbar 
3123bd6cc1SDaniel Dunbar 
32