xref: /llvm-project/clang/test/Analysis/html_diagnostics/control-arrows.cpp (revision 9e02f58780ab8734e5d27a0138bd477d18ae64a1)
1 // RUN: rm -fR %t
2 // RUN: mkdir %t
3 // RUN: %clang_analyze_cc1 -analyzer-checker=core \
4 // RUN:                    -analyzer-output=html -o %t -verify %s
5 // RUN: cat %t/report-*.html | FileCheck %s
6 
dereference(int * x)7 int dereference(int *x) {
8   return *x; // expected-warning{{Dereference of null pointer (loaded from variable 'x')}}
9 }
10 
foobar(bool cond,int * x)11 int foobar(bool cond, int *x) {
12   if (cond)
13     x = 0;
14   return dereference(x);
15 }
16 
17 // CHECK:          <svg
18 // CHECK:            <g
19 // CHECK-COUNT-9:      <path class="arrow" id="arrow{{[0-9]+}}"/>
20 // CHECK-NOT:          <path class="arrow" id="arrow{{[0-9]+}}"/>
21 // CHECK:            </g>
22 // CHECK-NEXT:     </svg>
23 // CHECK-NEXT:     <script type='text/javascript'>
24 // CHECK-NEXT:     const arrowIndices = [ 9,8,6,5,3,2,0 ]
25 // CHECK-NEXT:     </script>
26 //
27 // Except for arrows we still want to have grey bubbles with control notes.
28 // CHECK:          <div id="Path2" class="msg msgControl"
29 // CHECK-SAME:       <div class="PathIndex PathIndexControl">2</div>
30 // CHECK-SAME:       <td>Taking true branch</td>
31