Guruprasad Hegde e73ae745b0 [analyzer] Fix incorrect link to "note" diagnostics in HTML output
IDs of the note list start from 1. Link generated for each note started
with index 0 i.e #Note0, #Note1 and so on.
As a result, first link ("#Note0") was invalid, subsequent links pointed
at wrong note.
Now, generated links to the notes start with index 1 i.e (#Note1, #Note2
and so on.

Patch by Guruprasad Hegde (gruuprasad)!

Fixes https://github.com/llvm/llvm-project/issues/64054

Differential Revision: https://reviews.llvm.org/D156724
2023-08-03 11:44:05 +02:00

23 lines
739 B
C++

// RUN: rm -fR %t
// RUN: mkdir %t
// RUN: %clang_analyze_cc1 -analyzer-checker=optin.cplusplus.UninitializedObject \
// RUN: -analyzer-output=html -o %t -verify %s
// RUN: cat %t/report-*.html | FileCheck %s
struct A {
int *iptr;
int a; // expected-note{{uninitialized field 'this->a'}}
int b; // expected-note{{uninitialized field 'this->b'}}
A (int *iptr) : iptr(iptr) {} // expected-warning{{2 uninitialized fields at the end of the constructor call [optin.cplusplus.UninitializedObject]}}
};
void f() {
A a(0);
}
//CHECK: <tr><td class="rowname">Note:</td>
//CHECK-NOT: <a href="#Note0">
//CHECK-SAME: <a href="#Note1">line 9, column 7</a>
//CHECK-SAME: <a href="#Note2">line 10, column 7</a>