diff options
author | Devin Coughlin <dcoughlin@apple.com> | 2017-08-03 18:12:22 +0000 |
---|---|---|
committer | Devin Coughlin <dcoughlin@apple.com> | 2017-08-03 18:12:22 +0000 |
commit | f0cadcd9f385d36dc751cdb32476b32ec43306b5 (patch) | |
tree | 1934ab120846a4e22c0ca9b3ad69bbab4ba7d275 /clang/test/Coverage | |
parent | fd2c3795682fb9a3139f6411b1cf27c1304a66fc (diff) | |
download | bcm5719-llvm-f0cadcd9f385d36dc751cdb32476b32ec43306b5.tar.gz bcm5719-llvm-f0cadcd9f385d36dc751cdb32476b32ec43306b5.zip |
[Analyzer] Add support for displaying cross-file diagnostic paths in HTML output
This change adds support for cross-file diagnostic paths in html output. If the
diagnostic path is not cross-file, there is no change in the output.
Patch by Vlad Tsyrklevich!
Differential Revision: https://reviews.llvm.org/D30406
llvm-svn: 309968
Diffstat (limited to 'clang/test/Coverage')
-rw-r--r-- | clang/test/Coverage/html-diagnostics.c | 7 | ||||
-rw-r--r-- | clang/test/Coverage/html-multifile-diagnostics.c | 21 | ||||
-rw-r--r-- | clang/test/Coverage/html-multifile-diagnostics.h | 3 |
3 files changed, 31 insertions, 0 deletions
diff --git a/clang/test/Coverage/html-diagnostics.c b/clang/test/Coverage/html-diagnostics.c index 045943ae8b1..34b86cd9829 100644 --- a/clang/test/Coverage/html-diagnostics.c +++ b/clang/test/Coverage/html-diagnostics.c @@ -1,11 +1,18 @@ // RUN: rm -rf %t // RUN: %clang_cc1 -analyze -analyzer-output=html -analyzer-checker=core -o %t %s // RUN: find %t -name "*.html" -exec cat "{}" ";" | FileCheck %s +// +// RUN: rm -rf %t +// RUN: %clang_cc1 -analyze -analyzer-output=html-single-file -analyzer-checker=core -o %t %s +// RUN: find %t -name "*.html" -exec cat "{}" ";" | FileCheck %s // REQUIRES: staticanalyzer // CHECK: <h3>Annotated Source Code</h3> +// Make sure it's not generated as a multi-file HTML output +// CHECK-NOT: <h4 class=FileName>{{.*}} + // Without tweaking expr, the expr would hit to the line below // emitted to the output as comment. // CHECK: {{[D]ereference of null pointer}} diff --git a/clang/test/Coverage/html-multifile-diagnostics.c b/clang/test/Coverage/html-multifile-diagnostics.c new file mode 100644 index 00000000000..abd54ae8393 --- /dev/null +++ b/clang/test/Coverage/html-multifile-diagnostics.c @@ -0,0 +1,21 @@ +// RUN: rm -rf %t +// RUN: %clang_cc1 -analyze -analyzer-output=html -analyzer-checker=core -o %t %s +// RUN: find %t -name "*.html" -exec cat "{}" ";" | FileCheck %s + +// REQUIRES: staticanalyzer + +// CHECK: <h3>Annotated Source Code</h3> + +// Make sure it's generated as multi-file HTML output +// CHECK: <h4 class=FileName>{{.*}}html-multifile-diagnostics.c</h4> +// CHECK: <h4 class=FileName>{{.*}}html-multifile-diagnostics.h</h4> + +// Without tweaking expr, the expr would hit to the line below +// emitted to the output as comment. +// CHECK: {{[D]ereference of null pointer}} + +#include "html-multifile-diagnostics.h" + +void f0() { + f1((int*)0); +} diff --git a/clang/test/Coverage/html-multifile-diagnostics.h b/clang/test/Coverage/html-multifile-diagnostics.h new file mode 100644 index 00000000000..4a99ff0df9c --- /dev/null +++ b/clang/test/Coverage/html-multifile-diagnostics.h @@ -0,0 +1,3 @@ +void f1(int *ptr) { + *ptr = 0; +} |