brintos

brintos / llvm-project-archived public Read only

0
0
Text · 1.2 KiB · 22f7224 Raw
30 lines · c
1// RUN: rm -fR %t2// RUN: mkdir %t3// RUN: %clang_analyze_cc1 -analyzer-checker=core \4// RUN:                    -analyzer-output=html -o %t -verify %s5// RUN: grep -v CHECK %t/report-*.html | FileCheck %s6 7 8void foo() {9  int *x = 0;10  *x = __COUNTER__; // expected-warning{{Dereference of null pointer (loaded from variable 'x')}}11}12 13void bar() {14  int *y;15  *y = __COUNTER__; // expected-warning{{Dereference of undefined pointer value (loaded from variable 'y')}}16}17 18// The checks below confirm that both reports have the same values for __COUNTER__.19//20// FIXME: The correct values are (0, 1, 0, 1). Because we re-lex the file in order21// to detect macro expansions for HTML report purposes, they turn into (2, 3, 2, 3)22// by the time we emit HTML. But at least it's better than (2, 3, 4, 5)23// which would have been the case if we re-lexed the file *each* time we24// emitted an HTML report.25 26// CHECK: <span class='macro'>__COUNTER__<span class='macro_popup'>2</span></span>27// CHECK: <span class='macro'>__COUNTER__<span class='macro_popup'>3</span></span>28// CHECK: <span class='macro'>__COUNTER__<span class='macro_popup'>2</span></span>29// CHECK: <span class='macro'>__COUNTER__<span class='macro_popup'>3</span></span>30