diff --git a/clang/lib/StaticAnalyzer/Core/HTMLDiagnostics.cpp b/clang/lib/StaticAnalyzer/Core/HTMLDiagnostics.cpp --- a/clang/lib/StaticAnalyzer/Core/HTMLDiagnostics.cpp +++ b/clang/lib/StaticAnalyzer/Core/HTMLDiagnostics.cpp @@ -592,11 +592,11 @@ P->getLocation().asLocation().getExpansionLineNumber(); int ColumnNumber = P->getLocation().asLocation().getExpansionColumnNumber(); + ++NumExtraPieces; os << "Note:" << "line " << LineNumber << ", column " << ColumnNumber << "
" << P->getString() << ""; - ++NumExtraPieces; } } diff --git a/clang/test/Analysis/html_diagnostics/notes-links.cpp b/clang/test/Analysis/html_diagnostics/notes-links.cpp new file mode 100644 --- /dev/null +++ b/clang/test/Analysis/html_diagnostics/notes-links.cpp @@ -0,0 +1,22 @@ +// 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: Note: +//CHECK-NOT: +//CHECK-SAME: line 9, column 7 +//CHECK-SAME: line 10, column 7